Skip to content

Commit f6e5d7a

Browse files
authored
1 parent 527a7ad commit f6e5d7a

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

Code/GraphMol/MolStandardize/Tautomer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int scoreSubstructs(const ROMol &mol) {
115115
{"C=hetero", "[C]=[!#1;!#6]", 1},
116116
{"aromatic C = exocyclic N", "[c]=!@[N]", -1},
117117
{"methyl", "[CX4H3]", 1},
118-
{"guanidine terminal=N", "[#7][#6](=[NR0])[#7H0]", 1},
118+
{"guanidine terminal=N", "[#7]C(=[NR0])[#7H0]", 1},
119119
{"guanidine endocyclic=N", "[#7;R][#6;R]([N])=[#7;R]", 2},
120120
{"aci-nitro", "[#6]=[N+]([O-])[OH]", -4}};
121121
int score = 0;
@@ -131,7 +131,7 @@ int scoreSubstructs(const ROMol &mol) {
131131
// std::cerr << " " << matches.size() << " matches to " << term.name
132132
// << std::endl;
133133
// }
134-
score += matches.size() * term.score;
134+
score += static_cast<int>(matches.size()) * term.score;
135135
}
136136
return score;
137137
}

Code/GraphMol/MolStandardize/testTautomer.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ std::vector<std::pair<std::string, std::string>> canonTautomerData{
592592
{"CNC(C)=O", "CNC(C)=O"},
593593
{"S=C(N)N", "NC(N)=S"},
594594
{"SC(N)=N", "NC(N)=S"},
595-
{"N=c1[nH]ccn(C)1", "Cn1cc[nH]c1=N"},
595+
{"N=c1[nH]ccn(C)1", "Cn1ccnc1N"},
596596
{"CN=c1[nH]cncc1", "CNc1ccncn1"},
597597
{"Oc1cccc2ccncc12", "Oc1cccc2ccncc12"},
598598
{"O=c1cccc2cc[nH]cc1-2", "Oc1cccc2ccncc12"},
@@ -1330,6 +1330,30 @@ void testTautomerEnumeratorResult_const_iterator() {
13301330
}
13311331
}
13321332

1333+
void testGithub3430() {
1334+
BOOST_LOG(rdInfoLog) << "-----------------------\n testGithub3430"
1335+
<< std::endl;
1336+
// The "guanidine terminal=N" rule should not apply to aromatic C
1337+
// as this balances the "aromatic C = exocyclic N" rule with no net
1338+
// effect on the score
1339+
std::vector<ROMOL_SPTR> mols{"Cc1ccc(NC(=O)N=c2[nH]c(C)cn2C)nc1"_smiles,
1340+
"CCCCC(=O)N=c1nc(C)c2ncn(C)c2[nH]1"_smiles,
1341+
"c12ccccc1[nH]c(=N)[nH]2"_smiles};
1342+
for (auto mol : mols) {
1343+
TEST_ASSERT(mol);
1344+
TautomerEnumerator te;
1345+
auto res = te.enumerate(*mol);
1346+
std::vector<int> scores;
1347+
scores.reserve(res.size());
1348+
std::transform(res.begin(), res.end(), std::back_inserter(scores),
1349+
[](const ROMOL_SPTR &m) {
1350+
return TautomerScoringFunctions::scoreTautomer(*m);
1351+
});
1352+
std::sort(scores.begin(), scores.end(), std::greater<int>());
1353+
TEST_ASSERT(scores[1] < scores[0]);
1354+
}
1355+
}
1356+
13331357
int main() {
13341358
RDLog::InitLogs();
13351359
#if 1
@@ -1346,5 +1370,6 @@ int main() {
13461370
testGithub2990();
13471371
testPickCanonicalCIPChangeOnChiralCenter();
13481372
testTautomerEnumeratorResult_const_iterator();
1373+
testGithub3430();
13491374
return 0;
13501375
}

0 commit comments

Comments
 (0)