* Fixes #3460

* add a test for #3460
This commit is contained in:
Greg Landrum
2020-10-04 05:13:37 +02:00
committed by GitHub
parent 810ea846a5
commit f3afc3ebc8
2 changed files with 20 additions and 1 deletions

View File

@@ -451,6 +451,24 @@ Broken azide to N=N+=N- [N:2]=[N:3]=[N:4]>>[NH0:2]=[NH0+:3]=[NH0-:4])DATA";
}
}
TEST_ASSERT(count == 1);
BOOST_LOG(rdInfoLog) << "Finished" << std::endl;
}
void testGithub3460() {
BOOST_LOG(rdInfoLog) << "-----------------------\n Testing Github #3460: "
"Normalization rule incorrectly matches sulfones"
<< std::endl;
std::stringstream captureLog;
rdInfoLog->SetTee(captureLog);
Normalizer nn;
auto mol = "[O-][S+]1Nc2c(Cl)cc(Cl)c3c(Cl)cc(Cl)c(c23)N1"_smiles;
TEST_ASSERT(mol);
ROMOL_SPTR normalized(nn.normalize(*mol));
rdInfoLog->ClearTee();
auto logged = captureLog.str();
TEST_ASSERT(logged.find("Running Normalizer") != std::string::npos);
TEST_ASSERT(logged.find("Rule applied: C/S+NtoC/S=N+") == std::string::npos);
BOOST_LOG(rdInfoLog) << "Finished" << std::endl;
}
int main() {
@@ -461,5 +479,6 @@ int main() {
#endif
testGithub2414();
testNormalizeMultipleAltSmarts();
testGithub3460();
return 0;
}

View File

@@ -9,7 +9,7 @@ Sulfoxide to -S+(O-)- [!O:1][S+0;X3:2](=[O:3])[!O:4]>>[*:1][S+1:2]([O-:3])[*:4]
// Equivalent to #1.5 in InChI technical manual
Phosphate to P(O-)=O [O,S,Se,Te;-1:1][P+;D4:2][O,S,Se,Te;-1:3]>>[*+0:1]=[P+0;D5:2][*-1:3]
// Equivalent to #1.8 in InChI technical manual
C/S+N to C/S=N+ [C,S;X3+1:1]([NX3:2])[NX3!H0:3]>>[*+0:1]([N:2])=[N+:3]
C/S+N to C/S=N+ [C,S&!$([S+]-[O-]);X3+1:1]([NX3:2])[NX3!H0:3]>>[*+0:1]([N:2])=[N+:3]
// Equivalent to #1.8 in InChI technical manual
P+N to P=N+ [P;X4+1:1]([NX3:2])[NX3!H0:3]>>[*+0:1]([N:2])=[N+:3]
Normalize hydrazine-diazonium [CX4:1][NX3H:2]-[NX3H:3][CX4:4][NX2+:5]#[NX1:6]>>[CX4:1][NH0:2]=[NH+:3][C:4][N+0:5]=[NH:6]