Added AtomComparator.AtomCompareAnyHeavyAtom and test cases to FMCS code (#2656)

* Added AtomComparator.AtomCompareAnyHeavyAtom and test cases to FMCS code

* Added AtomComparator.AtomCompareAnyHeavyAtom

* Added AtomComparator.AtomCompareAnyHeavyAtom - fixed test typo

* Added AtomComparator.AtomCompareAnyHeavyAtom and test cases to FMCS code (2)

* Added AtomComparator.AtomCompareAnyHeavyAtom - fixed test cases

* Added AtomComparator.AtomCompareAnyHeavyAtom and test cases

* Update Code/GraphMol/FMCS/FMCS.cpp

Co-Authored-By: Greg Landrum <greg.landrum@gmail.com>

* Reverted tabs to 4 spaces

* Update FMCS.cpp
This commit is contained in:
Steve Roughley
2019-10-03 16:19:22 +01:00
committed by Greg Landrum
parent b92c265348
commit 710bdfa60b
6 changed files with 125 additions and 2 deletions

View File

@@ -86,6 +86,37 @@ public class FMCSTests extends GraphMolTest {
assertEquals(false,mcs.getCanceled());
}
@Test
public void testAtomCompareAnyHeavyAtom() {
ROMol_Vect mols = new ROMol_Vect();
mols.add(RWMol.MolFromSmiles("[H]c1ccccc1C",0, false));
mols.add(RWMol.MolFromSmiles("[H]c1ccccc1O",0, false));
// H matches H, O matches C
MCSResult mcs=RDKFuncs.findMCS(mols,true,1,60,false,false,false,false,false,
AtomComparator.AtomCompareAnyHeavyAtom,
BondComparator.BondCompareAny);
assertEquals(8,mcs.getNumAtoms());
assertEquals(8,mcs.getNumBonds());
//assertEquals("[#6]1:,-[#6]:,-[#6]:,-[#6]:,-[#6]:,-[#6]:,-1",mcs.getSmartsString());
assertEquals(false,mcs.getCanceled());
}
@Test
public void testAtomCompareAnyHeavyAtom1() {
ROMol_Vect mols = new ROMol_Vect();
mols.add(RWMol.MolFromSmiles("[H]c1ccccc1C",0, false));
mols.add(RWMol.MolFromSmiles("Oc1ccccc1O",0, false));
// O matches C, H does not match O
MCSResult mcs=RDKFuncs.findMCS(mols,true,1,60,false,false,false,false,false,
AtomComparator.AtomCompareAnyHeavyAtom,
BondComparator.BondCompareAny);
assertEquals(7,mcs.getNumAtoms());
assertEquals(7,mcs.getNumBonds());
//assertEquals("[#6]1:,-[#6]:,-[#6]:,-[#6]:,-[#6]:,-[#6]:,-1",mcs.getSmartsString());
assertEquals(false,mcs.getCanceled());
}
public static void main(String args[]) {
org.junit.runner.JUnitCore.main("org.RDKit.FMCSTests");