fix and test issue 3415534

This commit is contained in:
Greg Landrum
2011-09-30 03:23:30 +00:00
parent b434870824
commit ed133927ec
4 changed files with 73 additions and 22 deletions

View File

@@ -44,8 +44,9 @@ namespace RDKit{
unsigned int res=0;
for(ROMol::ConstAtomIterator iter=mol.beginAtoms();
iter!=mol.endAtoms();++iter){
if( ((*iter)->getAtomicNum()==7 || (*iter)->getAtomicNum()==8) &&
((*iter)->getNumImplicitHs() || (*iter)->getNumExplicitHs() || (*iter)->getTotalNumHs(true)) ) ++res;
if( ((*iter)->getAtomicNum()==7 || (*iter)->getAtomicNum()==8) ) {
res += (*iter)->getTotalNumHs(true);
}
}
return res;
}

View File

@@ -29,12 +29,12 @@ namespace RDKit{
*/
unsigned int calcLipinskiHBA(const ROMol &mol);
const std::string lipinskiHBDVersion="1.0.0";
const std::string lipinskiHBDVersion="2.0.0";
//! calculates the standard Lipinski HBA definition
/*!
\param mol the molecule of interest
\return the number of Ns and Os with at least one H in the molecule
\return the number of N-H and O-H bonds in the molecule
*/
unsigned int calcLipinskiHBD(const ROMol &mol);

View File

@@ -634,6 +634,55 @@ void testMolFormula(){
}
void testIssue3415534(){
BOOST_LOG(rdErrorLog) << "-------------------------------------" << std::endl;
BOOST_LOG(rdErrorLog) << " Test Issue 3415534." << std::endl;
{
ROMol *mol= SmilesToMol("CN");
TEST_ASSERT(mol);
int nHBD=calcLipinskiHBD(*mol);
TEST_ASSERT(nHBD==2);
delete mol;
}
{
ROMol *mol= SmilesToMol("CNC");
TEST_ASSERT(mol);
int nHBD=calcLipinskiHBD(*mol);
TEST_ASSERT(nHBD==1);
delete mol;
}
{
ROMol *mol= SmilesToMol("C[NH3+]");
TEST_ASSERT(mol);
int nHBD=calcLipinskiHBD(*mol);
TEST_ASSERT(nHBD==3);
delete mol;
}
{
ROMol *mol= SmilesToMol("CO");
TEST_ASSERT(mol);
int nHBD=calcLipinskiHBD(*mol);
TEST_ASSERT(nHBD==1);
delete mol;
}
{
ROMol *mol= SmilesToMol("C[OH2+]");
TEST_ASSERT(mol);
int nHBD=calcLipinskiHBD(*mol);
TEST_ASSERT(nHBD==2);
delete mol;
}
{
ROMol *mol= SmilesToMol("COC");
TEST_ASSERT(mol);
int nHBD=calcLipinskiHBD(*mol);
TEST_ASSERT(nHBD==0);
delete mol;
}
BOOST_LOG(rdErrorLog) << " done" << std::endl;
}
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
@@ -651,5 +700,6 @@ int main(){
testLipinski1();
testVSADescriptors();
testMolFormula();
testIssue3415534();
#endif
}

View File

@@ -419,7 +419,7 @@ Nc1ccc2C(=O)c3ccccc3C(=O)c2c1
3
> <NUM_LIPINSKIHDONORS> (5)
1
2
> <NUM_RINGS> (5)
3
@@ -1150,7 +1150,7 @@ Nc1ccnc2cc(Cl)ccc12
2
> <NUM_LIPINSKIHDONORS> (13)
1
2
> <NUM_RINGS> (13)
2
@@ -1501,7 +1501,7 @@ CCCCCCCCCCCCCCCc1cc(O)ccc1N
2
> <NUM_LIPINSKIHDONORS> (17)
2
3
> <NUM_RINGS> (17)
1
@@ -1859,7 +1859,7 @@ Cc1cc(O)nc2nc(N)ccc12
4
> <NUM_LIPINSKIHDONORS> (21)
2
3
> <NUM_RINGS> (21)
2
@@ -1951,7 +1951,7 @@ CCOC(=O)c1cnc2nc(N)ccc2c1O
6
> <NUM_LIPINSKIHDONORS> (22)
2
3
> <NUM_RINGS> (22)
2
@@ -2724,7 +2724,7 @@ Cc1cc(C)c(N)c(C)c1
1
> <NUM_LIPINSKIHDONORS> (31)
1
2
> <NUM_RINGS> (31)
1
@@ -3264,7 +3264,7 @@ CCC(CC)(C(OC(=O)N)c1ccccc1)c2ccccc2
3
> <NUM_LIPINSKIHDONORS> (37)
1
2
> <NUM_RINGS> (37)
2
@@ -3720,7 +3720,7 @@ COc1cc([N+](=O)[O-])c(N)c(c1)[N+](=O)[O-]
8
> <NUM_LIPINSKIHDONORS> (42)
1
2
> <NUM_RINGS> (42)
1
@@ -3808,7 +3808,7 @@ NN=C(c1ccccc1)c2ccccc2
2
> <NUM_LIPINSKIHDONORS> (43)
1
2
> <NUM_RINGS> (43)
2
@@ -4464,7 +4464,7 @@ CCc1cnc(C)cc1N
2
> <NUM_LIPINSKIHDONORS> (50)
1
2
> <NUM_RINGS> (50)
1
@@ -5386,7 +5386,7 @@ CC(C)(C(=O)N)c1ccccc1
2
> <NUM_LIPINSKIHDONORS> (60)
1
2
> <NUM_RINGS> (60)
1
@@ -7409,7 +7409,7 @@ Nc1ccc(Cl)nc1
2
> <NUM_LIPINSKIHDONORS> (81)
1
2
> <NUM_RINGS> (81)
1
@@ -13029,7 +13029,7 @@ Nc1ccccc1C(=O)O
3
> <NUM_LIPINSKIHDONORS> (144)
2
3
> <NUM_RINGS> (144)
1
@@ -13268,7 +13268,7 @@ Nc1ccccc1S(=O)(=O)O
4
> <NUM_LIPINSKIHDONORS> (147)
2
3
> <NUM_RINGS> (147)
1
@@ -14778,7 +14778,7 @@ Nc1ccc(C=Cc2ccc(N)cc2S(=O)(=O)O)c(c1)S(=O)(=O)O
8
> <NUM_LIPINSKIHDONORS> (163)
4
6
> <NUM_RINGS> (163)
2
@@ -15169,7 +15169,7 @@ Nc1ccc(c2ccccc12)S(=O)(=O)O
4
> <NUM_LIPINSKIHDONORS> (168)
2
3
> <NUM_RINGS> (168)
2
@@ -16714,7 +16714,7 @@ CCCCOC(=O)N
3
> <NUM_LIPINSKIHDONORS> (187)
1
2
> <NUM_RINGS> (187)
0
@@ -17411,7 +17411,7 @@ CNCC(=O)N
3
> <NUM_LIPINSKIHDONORS> (195)
2
3
> <NUM_RINGS> (195)
0