mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
remove vflib from Jamfiles
remove const specifiers from return values in DataStructs add initial pass at query-query matching for Atoms and Bonds fix and test for sf.net issu 2738320 add Mol.AddRecursiveQuery() method to Mol
This commit is contained in:
@@ -28,13 +28,13 @@ namespace RDDataManip {
|
||||
double TanimotoDistanceMetric(const T1 &bv1, const T2 &bv2, unsigned int dim) {
|
||||
// the dim parameter is actually irrelevant here but we have to include it to deal with
|
||||
// template version of setMetricFunc in MetricMatricCalc
|
||||
return (1.0 - SimilarityWrapper(bv1, bv2,(const double (*)(const T1&,const T2&))TanimotoSimilarity));
|
||||
return (1.0 - SimilarityWrapper(bv1, bv2,(double (*)(const T1&,const T2&))TanimotoSimilarity));
|
||||
};
|
||||
|
||||
//! return the Tanimoto similarity between two bit vectors
|
||||
template <typename T1, typename T2>
|
||||
double TanimotoSimilarityMetric(const T1 &bv1, const T2 &bv2, unsigned int dim) {
|
||||
return SimilarityWrapper(bv1,bv2,(const double (*)(const T1&,const T2&))TanimotoSimilarity);
|
||||
return SimilarityWrapper(bv1,bv2,(double (*)(const T1&,const T2&))TanimotoSimilarity);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ NumOnBitsInCommon(const ExplicitBitVect& bv1,
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
TanimotoSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -225,7 +225,7 @@ TanimotoSimilarity(const T1& bv1,
|
||||
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
TverskySimilarity(const T1& bv1,
|
||||
const T2& bv2,
|
||||
double a,
|
||||
@@ -244,7 +244,7 @@ TverskySimilarity(const T1& bv1,
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
CosineSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -262,7 +262,7 @@ CosineSimilarity(const T1& bv1,
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
KulczynskiSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -281,7 +281,7 @@ KulczynskiSimilarity(const T1& bv1,
|
||||
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
DiceSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -299,7 +299,7 @@ DiceSimilarity(const T1& bv1,
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
SokalSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -313,7 +313,7 @@ SokalSimilarity(const T1& bv1,
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
McConnaugheySimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -343,7 +343,7 @@ inline T tmax(T v1,T v2) {
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
AsymmetricSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -361,7 +361,7 @@ AsymmetricSimilarity(const T1& bv1,
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
BraunBlanquetSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -379,7 +379,7 @@ BraunBlanquetSimilarity(const T1& bv1,
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
RusselSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -405,7 +405,7 @@ RusselSimilarity(const T1& bv1,
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
OnBitSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -436,7 +436,7 @@ OnBitSimilarity(const T1& bv1,
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
template <typename T1, typename T2>
|
||||
const int
|
||||
int
|
||||
NumBitsInCommon(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -462,7 +462,7 @@ NumBitsInCommon(const T1& bv1,
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
AllBitSimilarity(const T1& bv1,
|
||||
const T2& bv2)
|
||||
{
|
||||
@@ -644,38 +644,38 @@ BitVectToText(const T1& bv1){
|
||||
|
||||
|
||||
|
||||
template const double TanimotoSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double TverskySimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2,double a, double b);
|
||||
template const double CosineSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double KulczynskiSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double DiceSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double SokalSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double McConnaugheySimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double AsymmetricSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double BraunBlanquetSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double RusselSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double OnBitSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const int NumBitsInCommon(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template const double AllBitSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double TanimotoSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double TverskySimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2,double a, double b);
|
||||
template double CosineSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double KulczynskiSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double DiceSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double SokalSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double McConnaugheySimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double AsymmetricSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double BraunBlanquetSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double RusselSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double OnBitSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template int NumBitsInCommon(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template double AllBitSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template int NumOnBitsInCommon(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template IntVect OnBitsInCommon(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template IntVect OffBitsInCommon(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template DoubleVect OnBitProjSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
template DoubleVect OffBitProjSimilarity(const SparseBitVect& bv1,const SparseBitVect& bv2);
|
||||
|
||||
template const double TanimotoSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double TverskySimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2,double a, double b);
|
||||
template const double CosineSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double KulczynskiSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double DiceSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double SokalSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double McConnaugheySimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double AsymmetricSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double BraunBlanquetSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double RusselSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double OnBitSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const int NumBitsInCommon(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template const double AllBitSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double TanimotoSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double TverskySimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2,double a, double b);
|
||||
template double CosineSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double KulczynskiSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double DiceSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double SokalSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double McConnaugheySimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double AsymmetricSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double BraunBlanquetSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double RusselSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double OnBitSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template int NumBitsInCommon(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template double AllBitSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template IntVect OnBitsInCommon(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template IntVect OffBitsInCommon(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
template DoubleVect OnBitProjSimilarity(const ExplicitBitVect& bv1,const ExplicitBitVect& bv2);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
//! that may be of unequal size (will automatically fold as appropriate)
|
||||
template <typename T>
|
||||
double SimilarityWrapper(const T &bv1,const T &bv2,
|
||||
const double (*metric)(const T &,const T &),
|
||||
double (*metric)(const T &,const T &),
|
||||
bool returnDistance=false){
|
||||
double res=0.0;
|
||||
if(bv1.GetNumBits()>bv2.GetNumBits()){
|
||||
@@ -44,7 +44,7 @@ double SimilarityWrapper(const T &bv1,const T &bv2,
|
||||
//! \overload
|
||||
template <typename T>
|
||||
double SimilarityWrapper(const T &bv1,const T &bv2,double a,double b,
|
||||
const double (*metric)(const T &,const T &,double,double),
|
||||
double (*metric)(const T &,const T &,double,double),
|
||||
bool returnDistance=false){
|
||||
double res=0.0;
|
||||
if(bv1.GetNumBits()>bv2.GetNumBits()){
|
||||
@@ -90,7 +90,7 @@ NumOnBitsInCommon(const ExplicitBitVect & bv1,const ExplicitBitVect & bv2);
|
||||
\return <tt>(bv1&bv2)_o / [bv1_o + bv2_o - (bv1&bv2)_o]</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
TanimotoSimilarity(const T1& bv1,const T2& bv2);
|
||||
|
||||
//! returns the Cosine similarity between two bit vects
|
||||
@@ -98,7 +98,7 @@ TanimotoSimilarity(const T1& bv1,const T2& bv2);
|
||||
\return <tt>(bv1&bv2)_o / sqrt(bv1_o + bv2_o)</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
CosineSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -107,7 +107,7 @@ CosineSimilarity(const T1& bv1,
|
||||
\return <tt>(bv1&bv2)_o * [bv1_o + bv2_o] / [2 * bv1_o * bv2_o]</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
KulczynskiSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -116,7 +116,7 @@ KulczynskiSimilarity(const T1& bv1,
|
||||
\return <tt>2*(bv1&bv2)_o / [bv1_o + bv2_o]</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
DiceSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -131,7 +131,7 @@ DiceSimilarity(const T1& bv1,
|
||||
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
TverskySimilarity(const T1& bv1,
|
||||
const T2& bv2,double a,double b);
|
||||
|
||||
@@ -140,7 +140,7 @@ TverskySimilarity(const T1& bv1,
|
||||
\return <tt>(bv1&bv2)_o / [2*bv1_o + 2*bv2_o - 3*(bv1&bv2)_o]</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
SokalSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -149,7 +149,7 @@ SokalSimilarity(const T1& bv1,
|
||||
\return <tt>[(bv1&bv2)_o * (bv1_o + bv2_o) - (bv1_o * bv2_o)] / (bv1_o * bv2_o)</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
McConnaugheySimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -158,7 +158,7 @@ McConnaugheySimilarity(const T1& bv1,
|
||||
\return <tt>(bv1&bv2)_o / min(bv1_o,bv2_o)</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
AsymmetricSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -167,7 +167,7 @@ AsymmetricSimilarity(const T1& bv1,
|
||||
\return <tt>(bv1&bv2)_o / max(bv1_o,bv2_o)</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
BraunBlanquetSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -180,7 +180,7 @@ BraunBlanquetSimilarity(const T1& bv1,
|
||||
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
RusselSimilarity(const T1& bv1,
|
||||
const T2& bv2);
|
||||
|
||||
@@ -190,7 +190,7 @@ RusselSimilarity(const T1& bv1,
|
||||
\return <tt>(bv1&bv2)_o / (bv1|bv2)_o </tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
OnBitSimilarity(const T1& bv1,const T2& bv2);
|
||||
|
||||
//! returns the number of common bits (on and off) between two bit vects
|
||||
@@ -198,7 +198,7 @@ OnBitSimilarity(const T1& bv1,const T2& bv2);
|
||||
\return <tt>bv1_n - (bv1^bv2)_o</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const int
|
||||
int
|
||||
NumBitsInCommon(const T1& bv1,const T2& bv2);
|
||||
|
||||
//! returns the commong-bit similarity (on and off) between two bit vects
|
||||
@@ -206,7 +206,7 @@ NumBitsInCommon(const T1& bv1,const T2& bv2);
|
||||
\return <tt>[bv1_n - (bv1^bv2)_o] / bv1_n</tt>
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
const double
|
||||
double
|
||||
AllBitSimilarity(const T1& bv1,const T2& bv2);
|
||||
|
||||
//! returns an IntVect with indices of all on bits in common between two bit vects
|
||||
|
||||
@@ -27,11 +27,11 @@ public:
|
||||
//! returns the value of a particular bit
|
||||
virtual bool GetBit(const unsigned int which) const = 0;
|
||||
//! returns the number of bits (the length of the BitVect)
|
||||
virtual const unsigned int GetNumBits() const = 0;
|
||||
virtual unsigned int GetNumBits() const = 0;
|
||||
//! returns the number of on bits
|
||||
virtual const unsigned int GetNumOnBits() const = 0;
|
||||
virtual unsigned int GetNumOnBits() const = 0;
|
||||
//! returns the number of off bits
|
||||
virtual const unsigned int GetNumOffBits() const =0;
|
||||
virtual unsigned int GetNumOffBits() const =0;
|
||||
//! replaces the contents of \c v with indices of our on bits
|
||||
virtual void GetOnBits (IntVect& v) const = 0;
|
||||
//! clears (sets to off) all of our bits
|
||||
|
||||
@@ -104,13 +104,13 @@ ExplicitBitVect::ExplicitBitVect(const char *data,const unsigned int dataLen)
|
||||
return(ans);
|
||||
};
|
||||
|
||||
const unsigned int ExplicitBitVect::GetNumBits() const {
|
||||
unsigned int ExplicitBitVect::GetNumBits() const {
|
||||
return d_size;
|
||||
};
|
||||
const unsigned int ExplicitBitVect::GetNumOnBits() const {
|
||||
unsigned int ExplicitBitVect::GetNumOnBits() const {
|
||||
return d_numOnBits;
|
||||
};
|
||||
const unsigned int ExplicitBitVect::GetNumOffBits() const {
|
||||
unsigned int ExplicitBitVect::GetNumOffBits() const {
|
||||
return d_size - d_numOnBits;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ public:
|
||||
ExplicitBitVect operator& (const ExplicitBitVect &other) const;
|
||||
ExplicitBitVect operator| (const ExplicitBitVect &other) const;
|
||||
ExplicitBitVect operator~ () const;
|
||||
const unsigned int GetNumBits() const;
|
||||
const unsigned int GetNumOnBits() const;
|
||||
const unsigned int GetNumOffBits() const;
|
||||
unsigned int GetNumBits() const;
|
||||
unsigned int GetNumOnBits() const;
|
||||
unsigned int GetNumOffBits() const;
|
||||
|
||||
void GetOnBits (IntVect& v) const;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
//! returns a (const) pointer to our raw storage
|
||||
const IntSet *GetBitSet() const { return dp_bits;}
|
||||
|
||||
const unsigned int GetNumBits() const { return d_size; };
|
||||
unsigned int GetNumBits() const { return d_size; };
|
||||
bool SetBit(const unsigned int which);
|
||||
bool SetBit(const IntSetIter which);
|
||||
bool UnSetBit(const unsigned int which);
|
||||
@@ -66,8 +66,8 @@ public:
|
||||
bool GetBit(const IntVectIter which) const;
|
||||
bool GetBit(const IntSetIter which) const;
|
||||
|
||||
const unsigned int GetNumOnBits() const { return dp_bits->size(); };
|
||||
const unsigned int GetNumOffBits() const { return d_size - dp_bits->size(); };
|
||||
unsigned int GetNumOnBits() const { return dp_bits->size(); };
|
||||
unsigned int GetNumOffBits() const { return d_size - dp_bits->size(); };
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ EBV *ff2(const EBV &ev1, int factor=2) {
|
||||
|
||||
template <typename T>
|
||||
double SimilarityWrapper(const T &bv1,const std::string &pkl,
|
||||
const double (*metric)(const T &,const T &),bool returnDistance){
|
||||
double (*metric)(const T &,const T &),bool returnDistance){
|
||||
T bv2(pkl);
|
||||
return SimilarityWrapper(bv1,bv2,metric,returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
double SimilarityWrapper(const T &bv1,const std::string &pkl,double a,double b,
|
||||
const double (*metric)(const T &,const T &,double,double),bool returnDistance){
|
||||
double (*metric)(const T &,const T &,double,double),bool returnDistance){
|
||||
T bv2(pkl);
|
||||
return SimilarityWrapper(bv1,bv2,a,b,metric,returnDistance);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ double SimilarityWrapper(const T &bv1,const std::string &pkl,double a,double b,
|
||||
|
||||
template <typename T>
|
||||
python::list BulkWrapper(const T &bv1,python::list bvs,
|
||||
const double (*metric)(const T &,const T &),
|
||||
double (*metric)(const T &,const T &),
|
||||
bool returnDistance){
|
||||
python::list res;
|
||||
unsigned int nbvs=python::extract<unsigned int>(bvs.attr("__len__")());
|
||||
@@ -48,7 +48,7 @@ python::list BulkWrapper(const T &bv1,python::list bvs,
|
||||
|
||||
template <typename T>
|
||||
python::list BulkWrapper(const T &bv1,python::list bvs,double a,double b,
|
||||
const double (*metric)(const T &,const T &,double,double),
|
||||
double (*metric)(const T &,const T &,double,double),
|
||||
bool returnDistance){
|
||||
python::list res;
|
||||
unsigned int nbvs=python::extract<unsigned int>(bvs.attr("__len__")());
|
||||
@@ -62,53 +62,53 @@ python::list BulkWrapper(const T &bv1,python::list bvs,double a,double b,
|
||||
template <typename T1, typename T2>
|
||||
double TanimotoSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))TanimotoSimilarity,
|
||||
(double (*)(const T1&,const T1&))TanimotoSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkTanimotoSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))TanimotoSimilarity,
|
||||
(double (*)(const T&,const T&))TanimotoSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double TverskySimilarity_w(const T1 &bv1,const T2 &bv2,double a,double b,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,a,b,
|
||||
(const double (*)(const T1&,const T1&,double,double))TverskySimilarity,
|
||||
(double (*)(const T1&,const T1&,double,double))TverskySimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkTverskySimilarity(const T &bv1,python::list bvs,double a,double b,
|
||||
bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,a,b,
|
||||
(const double (*)(const T&,const T&,double,double))TverskySimilarity,
|
||||
(double (*)(const T&,const T&,double,double))TverskySimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double CosineSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))CosineSimilarity,
|
||||
(double (*)(const T1&,const T1&))CosineSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkCosineSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))CosineSimilarity,
|
||||
(double (*)(const T&,const T&))CosineSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double KulczynskiSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))KulczynskiSimilarity,
|
||||
(double (*)(const T1&,const T1&))KulczynskiSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkKulczynskiSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))KulczynskiSimilarity,
|
||||
(double (*)(const T&,const T&))KulczynskiSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
@@ -116,99 +116,99 @@ python::list BulkKulczynskiSimilarity(const T &bv1,python::list bvs,bool returnD
|
||||
template <typename T1, typename T2>
|
||||
double DiceSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))DiceSimilarity,
|
||||
(double (*)(const T1&,const T1&))DiceSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkDiceSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))DiceSimilarity,
|
||||
(double (*)(const T&,const T&))DiceSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double SokalSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))SokalSimilarity,
|
||||
(double (*)(const T1&,const T1&))SokalSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkSokalSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))SokalSimilarity,
|
||||
(double (*)(const T&,const T&))SokalSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double McConnaugheySimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))McConnaugheySimilarity,
|
||||
(double (*)(const T1&,const T1&))McConnaugheySimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkMcConnaugheySimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))McConnaugheySimilarity,
|
||||
(double (*)(const T&,const T&))McConnaugheySimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double AsymmetricSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))AsymmetricSimilarity,
|
||||
(double (*)(const T1&,const T1&))AsymmetricSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkAsymmetricSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))AsymmetricSimilarity,
|
||||
(double (*)(const T&,const T&))AsymmetricSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double BraunBlanquetSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))BraunBlanquetSimilarity,
|
||||
(double (*)(const T1&,const T1&))BraunBlanquetSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkBraunBlanquetSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))BraunBlanquetSimilarity,
|
||||
(double (*)(const T&,const T&))BraunBlanquetSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double RusselSimilarity_w(const T1 &bv1,const T2 &bv2,bool returnDistance){
|
||||
return SimilarityWrapper(bv1,bv2,
|
||||
(const double (*)(const T1&,const T1&))RusselSimilarity,
|
||||
(double (*)(const T1&,const T1&))RusselSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkRusselSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))RusselSimilarity,
|
||||
(double (*)(const T&,const T&))RusselSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
python::list BulkOnBitSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))OnBitSimilarity,
|
||||
(double (*)(const T&,const T&))OnBitSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
template <typename T>
|
||||
python::list BulkAllBitSimilarity(const T &bv1,python::list bvs,bool returnDistance){
|
||||
return BulkWrapper(bv1,bvs,
|
||||
(const double (*)(const T&,const T&))AllBitSimilarity,
|
||||
(double (*)(const T&,const T&))AllBitSimilarity,
|
||||
returnDistance);
|
||||
}
|
||||
|
||||
|
||||
#define DBL_DEF(_funcname_,_bulkname_,_help_) { \
|
||||
python::def( # _funcname_,(const double (*)(const SBV &,const SBV &))_funcname_,\
|
||||
python::def( # _funcname_,(double (*)(const SBV &,const SBV &))_funcname_,\
|
||||
(python::args("v1"),python::args("v2"))); \
|
||||
python::def( # _funcname_,(const double (*)(const EBV &,const EBV &))_funcname_,\
|
||||
python::def( # _funcname_,(double (*)(const EBV &,const EBV &))_funcname_,\
|
||||
(python::args("v1"),python::args("v2")),_help_);\
|
||||
python::def( # _bulkname_,(python::list (*)(const EBV &,python::list,bool))_bulkname_,\
|
||||
(python::args("v1"),python::args("v2"),python::args("returnDistance")=0));\
|
||||
@@ -297,9 +297,9 @@ struct BitOps_wrapper {
|
||||
(DoubleVect (*)(const EBV&,const EBV&))OffBitProjSimilarity);
|
||||
|
||||
python::def("NumBitsInCommon",
|
||||
(const int (*)(const SBV&,const SBV&))NumBitsInCommon);
|
||||
(int (*)(const SBV&,const SBV&))NumBitsInCommon);
|
||||
python::def("NumBitsInCommon",
|
||||
(const int (*)(const EBV&,const EBV&))NumBitsInCommon,
|
||||
(int (*)(const EBV&,const EBV&))NumBitsInCommon,
|
||||
"Returns the total number of bits in common between the two bit vectors"
|
||||
);
|
||||
python::def("OnBitsInCommon",
|
||||
|
||||
@@ -9,7 +9,7 @@ exe sample : sample.cpp
|
||||
../../../GraphMol//GraphMol
|
||||
../../../DataStructs//DataStructs
|
||||
../../../RDGeneral//RDGeneral ../../../Geometry//RDGeometry
|
||||
../../..//vflib ../../..//lapacklibs
|
||||
../../..//lapacklibs
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ lib RDKFuncs : RDKFuncs_wrap.cpp RDKFuncs.cpp
|
||||
../../../GraphMol/Substruct//Substruct
|
||||
../../../GraphMol/ChemReactions//ChemReactions
|
||||
../../../RDGeneral//RDGeneral ../../../Geometry//RDGeometry /RDKit//lapacklibs
|
||||
/RDKit//vflib
|
||||
: <cflags>-fno-strict-aliasing <include>/usr/include/java <include>/usr/include/java/linux <include>. ;
|
||||
|
||||
cpp RDKFuncs_wrap.cpp : RDKFuncs.i : <main-target-type>JAVA_WRAPPER ;
|
||||
|
||||
@@ -10,7 +10,7 @@ lib rdk_funcs : rdk_funcs.cpp
|
||||
../../GraphMol//GraphMol
|
||||
/RDKit//DataStructs
|
||||
/RDKit//RDGeneral /RDKit//Geometry
|
||||
/RDKit//vflib /RDKit//lapacklibs
|
||||
/RDKit//lapacklibs
|
||||
;
|
||||
|
||||
install lib-install : rdk_funcs : <location>. ;
|
||||
|
||||
@@ -11,7 +11,7 @@ install lib-install : ChemReactions : <location>$(RDBASE)/bin ;
|
||||
exe testReaction : testReaction.cpp ChemReactions
|
||||
../FileParsers//FileParsers ../SmilesParse//SmilesParse
|
||||
../Substruct//Substruct ..//GraphMol ../../RDGeneral//RDGeneral
|
||||
../../Geometry//RDGeometry ../..//vflib ;
|
||||
../../Geometry//RDGeometry ;
|
||||
|
||||
install regrs : testReaction
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -11,7 +11,7 @@ python-extension rdChemReactions : rdChemReactions.cpp
|
||||
../..//GraphMol
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs ../../../RDBoost//RDBoost
|
||||
../../..//vflib
|
||||
|
||||
;
|
||||
|
||||
install pymod : rdChemReactions
|
||||
|
||||
@@ -10,7 +10,7 @@ install lib-install : ChemTransforms : <location>$(RDBASE)/bin ;
|
||||
|
||||
exe main : testChemTransforms.cpp ChemTransforms
|
||||
../FileParsers//FileParsers ../SmilesParse//SmilesParse
|
||||
../Substruct//Substruct ..//GraphMol ../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ../..//vflib ;
|
||||
../Substruct//Substruct ..//GraphMol ../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ;
|
||||
|
||||
install regrs : main
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -10,7 +10,7 @@ install lib-install : Depictor : <location>$(RDBASE)/bin ;
|
||||
|
||||
exe testDepictor : testDepictor.cpp Depictor ../SmilesParse//SmilesParse
|
||||
../FileParsers//FileParsers
|
||||
../Substruct//Substruct ..//GraphMol ../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ../..//vflib ;
|
||||
../Substruct//Substruct ..//GraphMol ../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ;
|
||||
|
||||
install regrs : testDepictor
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -10,7 +10,7 @@ install lib-install : Descriptors : <location>$(RDBASE)/bin ;
|
||||
|
||||
exe testDescriptors : test.cpp Descriptors
|
||||
../FileParsers//FileParsers ../SmilesParse//SmilesParse ../Subgraphs//Subgraphs
|
||||
../Substruct//Substruct ..//GraphMol ../../DataStructs//DataStructs ../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ../..//lapacklibs ../..//vflib ;
|
||||
../Substruct//Substruct ..//GraphMol ../../DataStructs//DataStructs ../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ../..//lapacklibs ;
|
||||
|
||||
install regrs : testDescriptors
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -11,7 +11,7 @@ python-extension rdMolDescriptors : rdMolDescriptors.cpp
|
||||
../..//GraphMol
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs ../../../RDBoost//RDBoost
|
||||
../../..//vflib ../../..//lapacklibs
|
||||
../../..//lapacklibs
|
||||
;
|
||||
|
||||
install pymod : rdMolDescriptors
|
||||
|
||||
@@ -73,38 +73,33 @@ namespace RDKit {
|
||||
chiralCenters,
|
||||
1.0, 0.1,
|
||||
0,basinThresh);
|
||||
unsigned int nPasses=0;
|
||||
field->initialize();
|
||||
if(field->calcEnergy() > ERROR_TOL){
|
||||
int needMore = 1;
|
||||
while(needMore){
|
||||
//std::cerr<<"********* Minimize1 from: "<<field->calcEnergy()<<std::endl;
|
||||
needMore = field->minimize(200,optimizerForceTol);
|
||||
++nPasses;
|
||||
}
|
||||
//std::cerr<<"********* Finished1 at "<<field->calcEnergy()<<std::endl;
|
||||
}
|
||||
unsigned int nPasses=0;
|
||||
field->initialize();
|
||||
if(field->calcEnergy() > ERROR_TOL){
|
||||
int needMore = 1;
|
||||
while(needMore){
|
||||
needMore = field->minimize(200,optimizerForceTol);
|
||||
++nPasses;
|
||||
}
|
||||
}
|
||||
// now redo the minimization if we have a chiral center, this
|
||||
// time removing the chiral constraints and
|
||||
// increasing the weight on the fourth dimension
|
||||
if (chiralCenters.size()>0 || useRandomCoords) {
|
||||
ForceFields::ForceField *field2 = DistGeom::constructForceField(*mmat, positions,
|
||||
chiralCenters,
|
||||
0.1, 1.0, 0,
|
||||
basinThresh);
|
||||
field2->initialize();
|
||||
if(field2->calcEnergy() > ERROR_TOL){
|
||||
int needMore = 1;
|
||||
while(needMore){
|
||||
//std::cerr<<"********* Minimize2 from: "<<field2->calcEnergy()<<std::endl;
|
||||
needMore = field2->minimize(200,optimizerForceTol);
|
||||
}
|
||||
//std::cerr<<"********* Finished2 at "<<field2->calcEnergy()<<std::endl;
|
||||
}
|
||||
delete field2;
|
||||
//std::cerr<<"********* Field1 again: "<<field->calcEnergy()<<std::endl;
|
||||
chiralCenters,
|
||||
0.1, 1.0, 0,
|
||||
basinThresh);
|
||||
field2->initialize();
|
||||
if(field2->calcEnergy() > ERROR_TOL){
|
||||
int needMore = 1;
|
||||
while(needMore){
|
||||
needMore = field2->minimize(200,optimizerForceTol);
|
||||
}
|
||||
}
|
||||
delete field2;
|
||||
}
|
||||
delete field;
|
||||
delete field;
|
||||
}
|
||||
return gotCoords;
|
||||
}
|
||||
@@ -121,7 +116,7 @@ namespace RDKit {
|
||||
nbrs.clear();
|
||||
nbrs.reserve(4);
|
||||
// find the neighbors of this atom and enter them into the
|
||||
// nbr list along with their CIPRanks
|
||||
// nbr list along with their CIPRanks
|
||||
boost::tie(beg,end) = mol.getAtomBonds(*ati);
|
||||
while (beg != end) {
|
||||
oatom = mol[*beg]->getOtherAtom(*ati);
|
||||
@@ -132,7 +127,7 @@ namespace RDKit {
|
||||
++beg;
|
||||
}
|
||||
// if we have less than 4 heavy atoms as neighbors,
|
||||
// we need to include the chiral center into the mix
|
||||
// we need to include the chiral center into the mix
|
||||
// we should at least have 3 though
|
||||
bool includeSelf = false;
|
||||
CHECK_INVARIANT(nbrs.size() >= 3, "Cannot be a chiral center");
|
||||
@@ -153,18 +148,18 @@ namespace RDKit {
|
||||
if (cipCode == "S") {
|
||||
// postive chiral volume
|
||||
DistGeom::ChiralSet *cset = new DistGeom::ChiralSet(nbrs[0].second,
|
||||
nbrs[1].second,
|
||||
nbrs[2].second,
|
||||
nbrs[1].second,
|
||||
nbrs[2].second,
|
||||
nbrs[3].second,
|
||||
5.0, 100.0);
|
||||
5.0, 100.0);
|
||||
DistGeom::ChiralSetPtr cptr(cset);
|
||||
chiralCenters.push_back(cptr);
|
||||
} else {
|
||||
DistGeom::ChiralSet *cset = new DistGeom::ChiralSet(nbrs[0].second,
|
||||
nbrs[1].second,
|
||||
nbrs[2].second,
|
||||
nbrs[1].second,
|
||||
nbrs[2].second,
|
||||
nbrs[3].second,
|
||||
-100.0, -5.0);
|
||||
-100.0, -5.0);
|
||||
DistGeom::ChiralSetPtr cptr(cset);
|
||||
chiralCenters.push_back(cptr);
|
||||
}
|
||||
@@ -184,7 +179,7 @@ namespace RDKit {
|
||||
}
|
||||
|
||||
bool _isConfFarFromRest(const ROMol &mol, const Conformer &conf,
|
||||
double threshold) {
|
||||
double threshold) {
|
||||
// NOTE: it is tempting to use some triangle inequality to prune
|
||||
// conformations here but some basic testing has shown very
|
||||
// little advantage and given that the time for pruning fades in
|
||||
@@ -217,7 +212,7 @@ namespace RDKit {
|
||||
bool useRandomCoords,double boxSizeMult,
|
||||
bool randNegEig, unsigned int numZeroFail,
|
||||
const std::map<int,RDGeom::Point3D> *coordMap,
|
||||
double optimizerForceTol,double basinThresh){
|
||||
double optimizerForceTol,double basinThresh){
|
||||
INT_VECT confIds;
|
||||
confIds=EmbedMultipleConfs(mol,1,maxIterations,seed,clearConfs,
|
||||
useRandomCoords,boxSizeMult,randNegEig,
|
||||
|
||||
@@ -16,7 +16,7 @@ exe main.exe : testDgeomHelpers.cpp DistGeomHelpers ../../DistGeom//DistGeom
|
||||
../../Numerics/Optimizer//Optimizer ../../Numerics/EigenSolvers//EigenSolvers
|
||||
../../Numerics/Alignment//Alignment
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//lapacklibs ../..//vflib ;
|
||||
../..//lapacklibs ;
|
||||
|
||||
install regrs : main.exe
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -254,7 +254,6 @@ class TestCase(unittest.TestCase) :
|
||||
conf.GetAtomPosition(3))
|
||||
self.failUnless(abs(vol-tgtVol)<1,"%s %s"%(vol,tgtVol))
|
||||
|
||||
|
||||
tgtVol=3.5
|
||||
expected = [-3.62, -3.67, -3.72, 3.91, 3.95, 3.98, 3.90, 3.94, 3.98, 3.91]
|
||||
nPos=0
|
||||
|
||||
@@ -39,9 +39,6 @@ exe testMol2ToMol : testMol2ToMol.cpp FileParsers
|
||||
../SmilesParse//SmilesParse ..//GraphMol
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry ;
|
||||
|
||||
lib profiler : : <name>profiler ;
|
||||
|
||||
|
||||
install regrs : test1 testMolSupplier testMolWriter testTplParser testMol2ToMol
|
||||
: <location>testExecs ;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ exe testHelpers : testHelpers.cpp ForceFieldHelpers
|
||||
../../Numerics/EigenSolvers//EigenSolvers
|
||||
../..//Numerics/Alignment//Alignment
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//vflib ;
|
||||
;
|
||||
|
||||
install regrs : testHelpers
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -13,7 +13,7 @@ python-extension rdForceFieldHelpers : rdForceFields.cpp
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs
|
||||
../../../RDBoost//RDBoost
|
||||
../../..//vflib
|
||||
|
||||
;
|
||||
|
||||
install pymod : rdForceFieldHelpers
|
||||
|
||||
@@ -15,7 +15,7 @@ exe test1 : test1.cpp FragCatalog
|
||||
../Substruct//Substruct ../FileParsers//FileParsers
|
||||
..//GraphMol ../../DataStructs//DataStructs
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//lapacklibs ../..//vflib ;
|
||||
../..//lapacklibs ;
|
||||
|
||||
install regrs : test1
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -14,7 +14,7 @@ python-extension rdfragcatalog : rdfragcatalog.cpp
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs
|
||||
../../../RDBoost//RDBoost
|
||||
../../..//vflib ../../..//lapacklibs
|
||||
../../..//lapacklibs
|
||||
;
|
||||
|
||||
install pymod : rdfragcatalog
|
||||
|
||||
@@ -21,17 +21,18 @@ exe MolOpsTest : molopstest.cpp GraphMol
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ;
|
||||
exe testCanon : testCanon.cpp GraphMol
|
||||
./SmilesParse//SmilesParse ./Substruct//Substruct
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ..//vflib ;
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ;
|
||||
exe testChirality : testChirality.cpp GraphMol
|
||||
./SmilesParse//SmilesParse ./FileParsers//FileParsers
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ..//vflib ;
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ;
|
||||
exe testPickler : testPickler.cpp GraphMol
|
||||
./SmilesParse//SmilesParse ./FileParsers//FileParsers ./Substruct//Substruct
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ..//vflib ;
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ;
|
||||
exe itertest : itertest.cpp GraphMol
|
||||
./SmilesParse//SmilesParse
|
||||
../RDGeneral//RDGeneral ../Geometry//RDGeometry ;
|
||||
|
||||
alias all : all-libraries all-wrappers regrs ;
|
||||
|
||||
install regrs : test1 cptest querytest MolOpsTest testCanon testChirality testPickler itertest
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -17,7 +17,7 @@ exe testMolAlign : testMolAlign.cpp MolAlign ../MolTransforms//MolTransforms
|
||||
../..//Numerics/Alignment//Alignment
|
||||
../Substruct//Substruct ..//GraphMol
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//vflib ;
|
||||
;
|
||||
|
||||
install regrs : testMolAlign
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -14,7 +14,7 @@ python-extension rdMolAlign : rdMolAlign.cpp
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs
|
||||
../../../RDBoost//RDBoost
|
||||
../../..//vflib
|
||||
|
||||
;
|
||||
|
||||
install pymod : rdMolAlign
|
||||
|
||||
@@ -14,7 +14,7 @@ exe testFeatures : testFeatures.cpp MolChemicalFeatures
|
||||
../Substruct//Substruct
|
||||
..//GraphMol
|
||||
../../DataStructs//DataStructs ../../RDGeneral//RDGeneral
|
||||
../../Geometry//RDGeometry ../..//vflib
|
||||
../../Geometry//RDGeometry
|
||||
;
|
||||
|
||||
install regrs : testFeatures
|
||||
|
||||
@@ -12,7 +12,7 @@ python-extension rdMolChemicalFeatures : rdMolChemicalFeatures.cpp
|
||||
../..//GraphMol
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs ../../../RDBoost//RDBoost
|
||||
../../..//vflib
|
||||
|
||||
;
|
||||
|
||||
install pymod : rdMolChemicalFeatures
|
||||
|
||||
@@ -52,17 +52,106 @@ void QueryAtom::expandQuery(QUERYATOM_QUERY *what,
|
||||
}
|
||||
}
|
||||
|
||||
// FIX: the const crap here is all mucked up.
|
||||
bool QueryAtom::Match(const Atom::ATOM_SPTR what) const {
|
||||
return Match(what.get());
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool localMatch(ATOM_EQUALS_QUERY const *q1,ATOM_EQUALS_QUERY const *q2){
|
||||
if(q1->getNegation()==q2->getNegation()){
|
||||
return q1->getVal()==q2->getVal();
|
||||
} else {
|
||||
return q1->getVal()!=q2->getVal();
|
||||
}
|
||||
}
|
||||
bool queriesMatch(QueryAtom::QUERYATOM_QUERY const *q1,
|
||||
QueryAtom::QUERYATOM_QUERY const *q2){
|
||||
PRECONDITION(q1,"no q1");
|
||||
PRECONDITION(q2,"no q2");
|
||||
|
||||
static const unsigned int nQueries=18;
|
||||
static std::string equalityQueries[nQueries]={"AtomRingBondCount","AtomRingSize","AtomMinRingSize","AtomImplicitValence",\
|
||||
"AtomExplicitValence","AtomTotalValence","AtomAtomicNum","AtomExplicitDegree",\
|
||||
"AtomTotalDegree","AtomHCount","AtomIsAromatic","AtomIsAliphatic","AtomUnsaturated",\
|
||||
"AtomMass","AtomFormalCharge","AtomHybridization","AtomInRing","AtomInNRings"};
|
||||
|
||||
bool res=false;
|
||||
std::string d1=q1->getDescription();
|
||||
std::string d2=q2->getDescription();
|
||||
if(d1=="AtomNull"||d2=="AtomNull"){
|
||||
res = true;
|
||||
} else if(d1=="AtomOr"){
|
||||
// FIX: handle negation on AtomOr and AtomAnd
|
||||
for(QueryAtom::QUERYATOM_QUERY::CHILD_VECT_CI iter1=q1->beginChildren();iter1!=q1->endChildren();++iter1){
|
||||
if(d2=="AtomOr"){
|
||||
for(QueryAtom::QUERYATOM_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(iter1->get(),iter2->get())){
|
||||
res=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(queriesMatch(iter1->get(),q2)) {
|
||||
res=true;
|
||||
}
|
||||
}
|
||||
if(res) break;
|
||||
}
|
||||
} else if(d1=="AtomAnd"){
|
||||
res=true;
|
||||
for(QueryAtom::QUERYATOM_QUERY::CHILD_VECT_CI iter1=q1->beginChildren();iter1!=q1->endChildren();++iter1){
|
||||
bool matched=false;
|
||||
if(d2=="AtomAnd"){
|
||||
for(QueryAtom::QUERYATOM_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(iter1->get(),iter2->get())){
|
||||
matched=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
matched = queriesMatch(iter1->get(),q2);
|
||||
}
|
||||
if(!matched){
|
||||
res=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// FIX : handle AtomXOr
|
||||
} else if(d2=="AtomOr"){
|
||||
// FIX: handle negation on AtomOr and AtomAnd
|
||||
for(QueryAtom::QUERYATOM_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(q1,iter2->get())) {
|
||||
res=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(d2=="AtomAnd"){
|
||||
res=true;
|
||||
for(QueryAtom::QUERYATOM_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(q1,iter2->get())){
|
||||
res=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(d1==d2){
|
||||
if(std::find(&equalityQueries[0],&equalityQueries[nQueries],d1)!= &equalityQueries[nQueries]){
|
||||
res=localMatch(static_cast<ATOM_EQUALS_QUERY const *>(q1),
|
||||
static_cast<ATOM_EQUALS_QUERY const *>(q2));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} //end of local namespace
|
||||
|
||||
bool QueryAtom::Match(Atom const *what) const {
|
||||
PRECONDITION(what,"bad query atom");
|
||||
PRECONDITION(dp_query,"no query set");
|
||||
return dp_query->Match(what);
|
||||
if(!what->hasQuery()){
|
||||
return dp_query->Match(what);
|
||||
} else {
|
||||
return queriesMatch(dp_query,what->getQuery());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}; // end o' namespace
|
||||
|
||||
@@ -58,21 +58,13 @@ void QueryBond::setBondDir(BondDir bD) {
|
||||
// situations, whatever those may be.
|
||||
//
|
||||
d_dirTag = bD;
|
||||
#if 0
|
||||
if(dp_query){
|
||||
delete dp_query;
|
||||
dp_query = 0;
|
||||
}
|
||||
dp_query = makeBondDirEqualsQuery(bD);
|
||||
}
|
||||
|
||||
|
||||
bool QueryBond::Match(const Bond::BOND_SPTR what) const {
|
||||
return Match(what.get());
|
||||
}
|
||||
|
||||
bool QueryBond::Match(Bond const *what) const {
|
||||
PRECONDITION(dp_query,"no query set");
|
||||
return dp_query->Match(what);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QueryBond::expandQuery(QUERYBOND_QUERY *what,
|
||||
@@ -106,4 +98,105 @@ void QueryBond::expandQuery(QUERYBOND_QUERY *what,
|
||||
}
|
||||
}
|
||||
|
||||
bool QueryBond::Match(const Bond::BOND_SPTR what) const {
|
||||
return Match(what.get());
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
bool localMatch(BOND_EQUALS_QUERY const *q1,BOND_EQUALS_QUERY const *q2){
|
||||
if(q1->getNegation()==q2->getNegation()){
|
||||
return q1->getVal()==q2->getVal();
|
||||
} else {
|
||||
return q1->getVal()!=q2->getVal();
|
||||
}
|
||||
}
|
||||
|
||||
bool queriesMatch(QueryBond::QUERYBOND_QUERY const *q1,
|
||||
QueryBond::QUERYBOND_QUERY const *q2){
|
||||
PRECONDITION(q1,"no q1");
|
||||
PRECONDITION(q2,"no q2");
|
||||
|
||||
static const unsigned int nQueries=6;
|
||||
static std::string equalityQueries[nQueries]={"BondRingSize","BondMinRingSize","BondOrder","BondDir",\
|
||||
"BondInRing","BondInNRings"};
|
||||
|
||||
bool res=false;
|
||||
std::string d1=q1->getDescription();
|
||||
std::string d2=q2->getDescription();
|
||||
if(d1=="BondNull"||d2=="BondNull"){
|
||||
res = true;
|
||||
} else if(d1=="BondOr"){
|
||||
// FIX: handle negation on BondOr and BondAnd
|
||||
for(QueryBond::QUERYBOND_QUERY::CHILD_VECT_CI iter1=q1->beginChildren();iter1!=q1->endChildren();++iter1){
|
||||
if(d2=="BondOr"){
|
||||
for(QueryBond::QUERYBOND_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(iter1->get(),iter2->get())){
|
||||
res=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(queriesMatch(iter1->get(),q2)) {
|
||||
res=true;
|
||||
}
|
||||
}
|
||||
if(res) break;
|
||||
}
|
||||
} else if(d1=="BondAnd"){
|
||||
res=true;
|
||||
for(QueryBond::QUERYBOND_QUERY::CHILD_VECT_CI iter1=q1->beginChildren();iter1!=q1->endChildren();++iter1){
|
||||
bool matched=false;
|
||||
if(d2=="BondAnd"){
|
||||
for(QueryBond::QUERYBOND_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(iter1->get(),iter2->get())){
|
||||
matched=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
matched = queriesMatch(iter1->get(),q2);
|
||||
}
|
||||
if(!matched){
|
||||
res=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// FIX : handle BondXOr
|
||||
} else if(d2=="BondOr"){
|
||||
// FIX: handle negation on BondOr and BondAnd
|
||||
for(QueryBond::QUERYBOND_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(q1,iter2->get())) {
|
||||
res=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(d2=="BondAnd"){
|
||||
res=true;
|
||||
for(QueryBond::QUERYBOND_QUERY::CHILD_VECT_CI iter2=q2->beginChildren();iter2!=q2->endChildren();++iter2){
|
||||
if(queriesMatch(q1,iter2->get())){
|
||||
res=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(std::find(&equalityQueries[0],&equalityQueries[nQueries],d1)!= &equalityQueries[nQueries]){
|
||||
res=localMatch(static_cast<BOND_EQUALS_QUERY const *>(q1),
|
||||
static_cast<BOND_EQUALS_QUERY const *>(q2));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} //end of local namespace
|
||||
|
||||
bool QueryBond::Match(Bond const *what) const {
|
||||
PRECONDITION(dp_query,"no query set");
|
||||
if(!what->hasQuery()){
|
||||
return dp_query->Match(what);
|
||||
} else {
|
||||
return queriesMatch(dp_query,what->getQuery());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // end o' namespace
|
||||
|
||||
@@ -15,7 +15,7 @@ cpp sln.tab.cpp : sln.yy : <bison.prefix>yysln_ ;
|
||||
|
||||
exe test : test.cpp SLNParse
|
||||
..//GraphMol ../SmilesParse//SmilesParse
|
||||
../Substruct//Substruct ../..//vflib
|
||||
../Substruct//Substruct
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ python-extension rdSLNParse : rdSLNParse.cpp
|
||||
../..//GraphMol
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs ../../../RDBoost//RDBoost
|
||||
/RDKit//vflib
|
||||
;
|
||||
|
||||
install pymod : rdSLNParse
|
||||
|
||||
@@ -15,7 +15,7 @@ exe main : testShapeHelpers.cpp ShapeHelpers
|
||||
../../Numerics/Alignment//Alignment
|
||||
..//GraphMol ../../DataStructs//DataStructs
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//lapacklibs ../..//vflib
|
||||
../..//lapacklibs
|
||||
;
|
||||
|
||||
install regrs : main
|
||||
|
||||
@@ -11,7 +11,7 @@ python-extension rdShapeHelpers : rdShapeHelpers.cpp
|
||||
../../../Numerics/EigenSolvers//EigenSolvers
|
||||
../../../Geometry//RDGeometry
|
||||
../../../RDGeneral//RDGeneral ../../../DataStructs//DataStructs ../../../RDBoost//RDBoost
|
||||
../../..//vflib ../../..//lapacklibs
|
||||
../../..//lapacklibs
|
||||
;
|
||||
|
||||
install pymod : rdShapeHelpers
|
||||
|
||||
@@ -7,7 +7,7 @@ local RDBASE = [ os.environ RDBASE ] ;
|
||||
|
||||
|
||||
lib SmilesParse : lex.yysmiles.cpp smiles.tab.cpp lex.yysmarts.cpp smarts.tab.cpp InputFiller.cpp SmilesParse.cpp SmilesParseOps.cpp SmilesWrite.cpp SmartsWrite.cpp
|
||||
..//GraphMol ../..//RDGeneral//RDGeneral ../../Geometry//RDGeometry ../..//vflib
|
||||
..//GraphMol ../..//RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
: <include>. <toolset>msvc:<link>static
|
||||
<toolset>msvc:<define>YY_NO_UNISTD_H
|
||||
;
|
||||
@@ -29,7 +29,7 @@ exe test : test.cpp SmilesParse ..//GraphMol
|
||||
exe smatest : smatest.cpp SmilesParse
|
||||
..//GraphMol ../Substruct//Substruct
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//vflib ;
|
||||
;
|
||||
|
||||
install regrs : test smatest
|
||||
: <location>testExecs ;
|
||||
|
||||
@@ -262,12 +262,10 @@ A {
|
||||
|
||||
[\\] { yysmarts_lval.bond = new QueryBond(Bond::SINGLE);
|
||||
yysmarts_lval.bond->setBondDir(Bond::ENDDOWNRIGHT);
|
||||
yysmarts_lval.bond->setQuery(makeBondDirEqualsQuery(Bond::ENDDOWNRIGHT));
|
||||
return BOND_TOKEN; }
|
||||
|
||||
[\/] { yysmarts_lval.bond = new QueryBond(Bond::SINGLE);
|
||||
yysmarts_lval.bond->setBondDir(Bond::ENDUPRIGHT);
|
||||
yysmarts_lval.bond->setQuery(makeBondDirEqualsQuery(Bond::ENDUPRIGHT));
|
||||
return BOND_TOKEN; }
|
||||
|
||||
|
||||
|
||||
@@ -1146,6 +1146,20 @@ void testMiscSmartsWriting(){
|
||||
BOOST_LOG(rdInfoLog) << "\tdone" << std::endl;
|
||||
}
|
||||
|
||||
void testSmartsStereochem(){
|
||||
BOOST_LOG(rdInfoLog) << "-------------------------------------" << std::endl;
|
||||
BOOST_LOG(rdInfoLog) << "Testing handling (or lack thereof) of stereochem in smarts (sf.net issue 2738320)" << std::endl;
|
||||
|
||||
_checkMatches("C/C=C/C", "CC=CC", 1, 4);
|
||||
_checkMatches("C/C=C/C", "C/C=C/C", 1, 4);
|
||||
_checkMatches("C/C=C/C", "C\\C=C\\C", 1, 4);
|
||||
_checkMatches("C/C=C/C", "C/C=C\\C", 1, 4);
|
||||
|
||||
BOOST_LOG(rdInfoLog) << "\tdone" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -1174,5 +1188,6 @@ main(int argc, char *argv[])
|
||||
testIssue1914154();
|
||||
testMiscSmartsWriting();
|
||||
//testIssue1804420();
|
||||
testSmartsStereochem();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ local RDBASE = [ os.environ RDBASE ] ;
|
||||
|
||||
|
||||
lib Substruct : SubstructMatch.cpp SubstructUtils.cpp
|
||||
..//GraphMol ../..//RDGeneral//RDGeneral ../..//vflib
|
||||
..//GraphMol ../..//RDGeneral//RDGeneral
|
||||
: <toolset>msvc:<link>static ; #<link>static ;
|
||||
install lib-install : Substruct : <location>$(RDBASE)/bin ;
|
||||
|
||||
exe test1 : test1.cpp Substruct ..//GraphMol
|
||||
../../RDGeneral//RDGeneral ../../Geometry//RDGeometry
|
||||
../..//vflib
|
||||
|
||||
;
|
||||
|
||||
install regrs : test1
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <DataStructs/ExplicitBitVect.h>
|
||||
#include <GraphMol/RDKitBase.h>
|
||||
#include <GraphMol/RDKitQueries.h>
|
||||
#include <GraphMol/Substruct/SubstructMatch.h>
|
||||
#include <GraphMol/Subgraphs/Subgraphs.h>
|
||||
#include <GraphMol/Fingerprints/Fingerprints.h>
|
||||
@@ -49,6 +50,34 @@ namespace RDKit{
|
||||
return res;
|
||||
}
|
||||
|
||||
void addRecursiveQuery(ROMol &mol,
|
||||
const ROMol &query,
|
||||
unsigned int atomIdx,
|
||||
bool preserveExistingQuery){
|
||||
if(atomIdx>=mol.getNumAtoms()){
|
||||
throw_value_error("atom index exceeds mol.GetNumAtoms()");
|
||||
}
|
||||
RecursiveStructureQuery *q = new RecursiveStructureQuery(new ROMol(query));
|
||||
|
||||
Atom *oAt=mol.getAtomWithIdx(atomIdx);
|
||||
if(!oAt->hasQuery()){
|
||||
QueryAtom qAt(*oAt);
|
||||
static_cast<RWMol &>(mol).replaceAtom(atomIdx,&qAt);
|
||||
oAt = mol.getAtomWithIdx(atomIdx);
|
||||
}
|
||||
|
||||
|
||||
if(!preserveExistingQuery){
|
||||
// FIX: this leaks a query atom on oAt
|
||||
oAt->setQuery(q);
|
||||
} else {
|
||||
oAt->expandQuery(q,Queries::COMPOSITE_AND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void sanitizeMol(ROMol &mol) {
|
||||
RWMol &wmol = static_cast<RWMol &>(mol);
|
||||
MolOps::sanitizeMol(wmol);
|
||||
@@ -370,7 +399,7 @@ namespace RDKit{
|
||||
docString.c_str());
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
docString="Returns the molecule's distance matrix.\n\
|
||||
docString="Returns the molecule's topological distance matrix.\n\
|
||||
\n\
|
||||
ARGUMENTS:\n\
|
||||
\n\
|
||||
@@ -845,6 +874,28 @@ namespace RDKit{
|
||||
docString.c_str(),
|
||||
python::return_value_policy<python::manage_new_object>());
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
docString="Adds a recursive query to an atom\n\
|
||||
\n\
|
||||
ARGUMENTS:\n\
|
||||
\n\
|
||||
- mol: the molecule to be modified\n\
|
||||
\n\
|
||||
- query: the molecule to be used as the recursive query (this will be copied)\n\
|
||||
\n\
|
||||
- atomIdx: the atom to modify\n\
|
||||
\n\
|
||||
- preserveExistingQuery: (optional) if this is set, existing query information on the atom will be preserved\n\
|
||||
\n\
|
||||
RETURNS: None\n\
|
||||
\n";
|
||||
python::def("AddRecursiveQuery", addRecursiveQuery,
|
||||
(python::arg("mol"),python::arg("query"),
|
||||
python::arg("atomIdx"),python::arg("preserveExistingQuery")=true),
|
||||
docString.c_str());
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -391,9 +391,9 @@ class TestCase(unittest.TestCase):
|
||||
self.failUnless(m2.GetNumAtoms()==5)
|
||||
m2 = Chem.RemoveHs(m2)
|
||||
self.failUnless(m2.GetNumAtoms()==4)
|
||||
|
||||
m = Chem.MolFromSmiles('CC[H]',False)
|
||||
self.failUnless(m.GetNumAtoms()==3)
|
||||
print 'merge'
|
||||
m2 = Chem.MergeQueryHs(m)
|
||||
self.failUnless(m2.GetNumAtoms()==2)
|
||||
self.failUnless(m2.GetAtomWithIdx(1).HasQuery())
|
||||
@@ -1909,6 +1909,37 @@ CAS<~>
|
||||
sdSup = Chem.CompressedSDMolSupplier(fileN, 0)
|
||||
for mol in sdSup :
|
||||
self.failUnless(not mol.HasProp("numArom"))
|
||||
|
||||
def test57AddRecursiveQuery(self):
|
||||
q1 = Chem.MolFromSmiles('CC')
|
||||
q2 = Chem.MolFromSmiles('CO')
|
||||
Chem.AddRecursiveQuery(q1,q2,1)
|
||||
|
||||
m1 = Chem.MolFromSmiles('OCC')
|
||||
self.failUnless(m1.HasSubstructMatch(q2))
|
||||
self.failUnless(m1.HasSubstructMatch(q1))
|
||||
self.failUnless(m1.HasSubstructMatch(q1))
|
||||
self.failUnless(m1.GetSubstructMatch(q1)==(2,1))
|
||||
|
||||
q3 = Chem.MolFromSmiles('CS')
|
||||
Chem.AddRecursiveQuery(q1,q3,1)
|
||||
|
||||
self.failIf(m1.HasSubstructMatch(q3))
|
||||
self.failIf(m1.HasSubstructMatch(q1))
|
||||
|
||||
m2 = Chem.MolFromSmiles('OC(S)C')
|
||||
self.failUnless(m2.HasSubstructMatch(q1))
|
||||
self.failUnless(m2.GetSubstructMatch(q1)==(3,1))
|
||||
|
||||
m3 = Chem.MolFromSmiles('SCC')
|
||||
self.failUnless(m3.HasSubstructMatch(q3))
|
||||
self.failIf(m3.HasSubstructMatch(q1))
|
||||
|
||||
q1 = Chem.MolFromSmiles('CC')
|
||||
Chem.AddRecursiveQuery(q1,q2,1)
|
||||
Chem.AddRecursiveQuery(q1,q3,1,False)
|
||||
self.failUnless(m3.HasSubstructMatch(q1))
|
||||
self.failUnless(m3.GetSubstructMatch(q1)==(2,1))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -330,7 +330,184 @@ void test6(){
|
||||
massVal=queryAtomMass(a);
|
||||
TEST_ASSERT(massVal==static_cast<int>(RDKit::round(13.000*massIntegerConversionFactor)));
|
||||
|
||||
BOOST_LOG(rdErrorLog) << "Done!" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void testQueryQueryMatches(){
|
||||
BOOST_LOG(rdInfoLog) << "-------------------------------------" << std::endl;
|
||||
BOOST_LOG(rdInfoLog) << "Testing query--query matches" << std::endl;
|
||||
|
||||
// =====================================
|
||||
// ATOMS
|
||||
// =====================================
|
||||
{
|
||||
QueryAtom a1,a2;
|
||||
a1.setQuery(makeAtomNullQuery());
|
||||
a2.setQuery(makeAtomNullQuery());
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1,a2(6);
|
||||
a1.setQuery(makeAtomNullQuery());
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(8);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(6);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1,a2;
|
||||
a1.setQuery(makeAtomAromaticQuery());
|
||||
a2.setQuery(makeAtomAromaticQuery());
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1,a2;
|
||||
a1.setQuery(makeAtomAromaticQuery());
|
||||
a2.setQuery(makeAtomAliphaticQuery());
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(8);
|
||||
a1.expandQuery(makeAtomNumEqualsQuery(8),Queries::COMPOSITE_OR);
|
||||
a2.expandQuery(makeAtomNumEqualsQuery(9),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(8);
|
||||
a1.expandQuery(makeAtomNumEqualsQuery(7),Queries::COMPOSITE_OR);
|
||||
a2.expandQuery(makeAtomNumEqualsQuery(9),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(6);
|
||||
a1.expandQuery(makeAtomExplicitValenceQuery(3),Queries::COMPOSITE_AND);
|
||||
a2.expandQuery(makeAtomExplicitValenceQuery(3),Queries::COMPOSITE_AND);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(6);
|
||||
a1.expandQuery(makeAtomExplicitValenceQuery(3),Queries::COMPOSITE_AND);
|
||||
a2.expandQuery(makeAtomExplicitValenceQuery(4),Queries::COMPOSITE_AND);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(8);
|
||||
a1.expandQuery(makeAtomExplicitValenceQuery(3),Queries::COMPOSITE_AND);
|
||||
a2.expandQuery(makeAtomExplicitValenceQuery(3),Queries::COMPOSITE_AND);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryAtom a1(6),a2(8);
|
||||
a1.expandQuery(makeAtomNumEqualsQuery(8),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
// =====================================
|
||||
// BONDS
|
||||
// =====================================
|
||||
|
||||
{
|
||||
QueryBond a1,a2;
|
||||
a1.setQuery(makeBondNullQuery());
|
||||
a2.setQuery(makeBondNullQuery());
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1,a2(Bond::SINGLE);
|
||||
a1.setQuery(makeBondNullQuery());
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::SINGLE);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::DOUBLE);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::DOUBLE);
|
||||
a1.expandQuery(makeBondOrderEqualsQuery(Bond::DOUBLE),Queries::COMPOSITE_OR);
|
||||
a2.expandQuery(makeBondOrderEqualsQuery(Bond::AROMATIC),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::DOUBLE);
|
||||
a1.expandQuery(makeBondOrderEqualsQuery(Bond::TRIPLE),Queries::COMPOSITE_OR);
|
||||
a2.expandQuery(makeBondOrderEqualsQuery(Bond::AROMATIC),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::DOUBLE);
|
||||
a1.expandQuery(makeBondMinRingSizeQuery(4),Queries::COMPOSITE_OR);
|
||||
a2.expandQuery(makeBondMinRingSizeQuery(4),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::DOUBLE);
|
||||
a1.expandQuery(makeBondMinRingSizeQuery(4),Queries::COMPOSITE_AND);
|
||||
a2.expandQuery(makeBondMinRingSizeQuery(4),Queries::COMPOSITE_AND);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::SINGLE);
|
||||
a1.expandQuery(makeBondMinRingSizeQuery(5),Queries::COMPOSITE_AND);
|
||||
a2.expandQuery(makeBondMinRingSizeQuery(4),Queries::COMPOSITE_AND);
|
||||
TEST_ASSERT(!a1.Match(&a2));
|
||||
TEST_ASSERT(!a2.Match(&a1));
|
||||
}
|
||||
|
||||
{
|
||||
QueryBond a1(Bond::SINGLE),a2(Bond::AROMATIC);
|
||||
a1.expandQuery(makeBondOrderEqualsQuery(Bond::AROMATIC),Queries::COMPOSITE_OR);
|
||||
TEST_ASSERT(a1.Match(&a2));
|
||||
TEST_ASSERT(a2.Match(&a1));
|
||||
}
|
||||
|
||||
BOOST_LOG(rdErrorLog) << "Done!" << std::endl;
|
||||
}
|
||||
@@ -344,5 +521,8 @@ int main(){
|
||||
test4();
|
||||
test5();
|
||||
test6();
|
||||
testQueryQueryMatches();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
Code/Jamroot
11
Code/Jamroot
@@ -17,16 +17,13 @@ use-project RDKit_Externals
|
||||
project RDKit
|
||||
: requirements <include>. <threading>multi
|
||||
<include>$(BOOSTHOME)
|
||||
<include>$(RDBASE)/External/Lapack++/include
|
||||
<include>$(RDBASE)/External/vflib-2.0/include
|
||||
#<define>USE_VFLIB
|
||||
<toolset>gcc:<cflags>-Wno-unused-function
|
||||
<toolset>gcc:<cflags>-Wno-deprecated
|
||||
<toolset>darwin:<cflags>-Wno-unused-function
|
||||
<toolset>gcc:<cflags>-fno-strict-aliasing
|
||||
<toolset>msvc:<define>WIN32
|
||||
<include>/usr/lib/python2.5/site-packages/numpy-1.2.1-py2.5-linux-i686.egg/numpy/core/include
|
||||
<address-model>64:<cflags>-fPIC
|
||||
<include>MISSING
|
||||
<address-model>64:<cflags>-fPIC
|
||||
# <define>RDK_USELAPACKPP #<- uncomment this to use lapack++
|
||||
<target-os>windows:<define>BOOST_NUMERIC_BINDINGS_USE_CLAPACK
|
||||
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
|
||||
@@ -35,7 +32,10 @@ project RDKit
|
||||
|
||||
alias all-libraries : Catalogs DistGeom ForceField DataManip/MetricMatrixCalc DataStructs Geometry Query RDBoost RDGeneral Numerics SimDivPickers ChemicalFeatures GraphMol
|
||||
;
|
||||
alias all : all-libraries all-wrappers ;
|
||||
|
||||
alias minimal : DistGeom ForceField DataStructs Geometry Query RDGeneral Numerics ChemicalFeatures GraphMol//minimal
|
||||
;
|
||||
|
||||
alias all-wrappers : RDBoost/Wrap
|
||||
DataStructs/Wrap
|
||||
@@ -83,6 +83,5 @@ lib blas
|
||||
# if you want to use Lapack++, use this version:
|
||||
#alias lapacklibs : /RDKit_Externals//Lapack++ lapack blas ;
|
||||
alias lapacklibs : lapack blas ;
|
||||
alias vflib : /RDKit_Externals//vflib ;
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ use-project RDKit_Externals
|
||||
project RDKit
|
||||
: requirements <include>. <threading>multi
|
||||
<include>$(BOOSTHOME)
|
||||
<include>$(RDBASE)/External/vflib-2.0/include
|
||||
#<define>USE_VFLIB
|
||||
<toolset>gcc:<cflags>-Wno-unused-function
|
||||
<toolset>gcc:<cflags>-Wno-deprecated
|
||||
<toolset>darwin:<cflags>-Wno-unused-function
|
||||
@@ -34,6 +32,7 @@ project RDKit
|
||||
|
||||
alias all-libraries : Catalogs DistGeom ForceField DataManip/MetricMatrixCalc DataStructs Geometry Query RDBoost RDGeneral Numerics SimDivPickers ChemicalFeatures GraphMol
|
||||
;
|
||||
alias all : all-libraries all-wrappers ;
|
||||
|
||||
alias minimal : DistGeom ForceField DataStructs Geometry Query RDGeneral Numerics ChemicalFeatures GraphMol//minimal
|
||||
;
|
||||
@@ -84,5 +83,4 @@ lib blas
|
||||
# if you want to use Lapack++, use this version:
|
||||
#alias lapacklibs : /RDKit_Externals//Lapack++ lapack blas ;
|
||||
alias lapacklibs : lapack blas ;
|
||||
alias vflib : /RDKit_Externals//vflib ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user