private static int getSMSDSolutionCount(IAtomContainer queryMol, IAtomContainer target) throws CDKException { Substructure substructure = new Substructure(queryMol, target, true, true, true, false); if (substructure.isSubgraph()) { return 1; } else { return 0; } }
private synchronized boolean substructureAlgorithm() throws CDKException { if (DEBUG) { System.out.println("Check substructureAlgorithm"); } Substructure mcs; if (getQuery() instanceof IQueryAtomContainer) { mcs = new Substructure((IQueryAtomContainer) getQuery(), getTarget(), atomMatcher, bondMatcher, true); } else { mcs = new Substructure(getQuery(), getTarget(), atomMatcher, bondMatcher, true); } clearMaps(); if (mcs.isSubgraph()) { getMCSList().addAll(mcs.getAllAtomMapping()); } return mcs.isSubgraph(); }
/** * If either is a subgraph * * @param ac1 * @param ac2 * @return * @throws CDKException */ public static boolean isMatch(IAtomContainer ac1, IAtomContainer ac2, boolean either) throws CDKException { AtomMatcher atomMatcher = AtomBondMatcher.atomMatcher(false, true); BondMatcher bondMatcher = AtomBondMatcher.bondMatcher(true, true); if (ac1.getAtomCount() <= ac2.getAtomCount()) { Substructure pattern = new Substructure(ac1, ac2, atomMatcher, bondMatcher, false); // create pattern return pattern.isSubgraph(); } if (either && ac1.getAtomCount() >= ac2.getAtomCount()) { Substructure pattern = new Substructure(ac2, ac1, atomMatcher, bondMatcher, false); // create pattern return pattern.isSubgraph(); } return false; }
private synchronized boolean substructureAlgorithm() throws CDKException { Substructure mcs; if (getQuery() instanceof IQueryAtomContainer) { mcs = new Substructure((IQueryAtomContainer) getQuery(), getTarget(), true); } else { mcs = new Substructure(getQuery(), getTarget(), isMatchBonds(), isMatchRings(), isMatchAtomType(), true); } clearMaps(); if (mcs.isSubgraph()) { getMCSList().addAll(mcs.getAllAtomMapping()); } return mcs.isSubgraph(); }
private synchronized boolean substructureAlgorithm() throws CDKException { Substructure mcs; if (getQuery() instanceof IQueryAtomContainer) { mcs = new Substructure((IQueryAtomContainer) getQuery(), getTarget(), true); } else { mcs = new Substructure(getQuery(), getTarget(), isMatchBonds(), isMatchRings(), isMatchAtomType(), true); } clearMaps(); if (mcs.isSubgraph()) { getMCSList().addAll(mcs.getAllAtomMapping()); } return mcs.isSubgraph(); }
if (source.getAtomCount() <= target.getAtomCount()) { try { s = new Substructure(source, target, atomMatcher, bondMatcher, false); s.setChemFilters(true, true, true); return s.getFirstAtomMapping().getMappingsByAtoms();
private static BaseMapping runSubstructure( IAtomContainer query, IAtomContainer target, int filter, boolean matchBonds, boolean matchRings, boolean matchAtomTypes) throws CDKException { // XXX - if clean and configure is 'true', is that not duplicate configuring? BaseMapping smsd = new Substructure(query, target, matchBonds, matchRings, matchAtomTypes, true); if (smsd.isSubgraph()) { if (filter == 0) { smsd.setChemFilters(false, false, false); } if (filter == 1) { smsd.setChemFilters(true, false, false); } if (filter == 2) { smsd.setChemFilters(true, true, false); } if (filter == 3) { smsd.setChemFilters(true, true, true); } } return smsd; }
private synchronized boolean isSubgraphIdentical(IAtomContainer _mol, IAtomContainer _rMol, boolean removeHydrogen) throws CDKException, IOException { // System.out.println("Graph matching"); IAtomContainer mol1 = _mol; IAtomContainer mol2 = _rMol; AtomMatcher atomMatcher = AtomBondMatcher.atomMatcher(true, true); BondMatcher bondMatcher = AtomBondMatcher.bondMatcher(true, true); Substructure mcs = new Substructure(mol1, mol2, atomMatcher, bondMatcher, false); mcs.setChemFilters(false, false, false); return mcs.isSubgraph() && !mcs.isStereoMisMatch() && mol1.getAtomCount() == mol2.getAtomCount(); }
bm = AtomBondMatcher.bondMatcher(false, isHasPerfectRings()); substructure = new Substructure(ac1, ac2, am, bm, true); System.out.println("---1.3---"); substructure = new Substructure(ac1, ac2, am, bm, true); } else if (moleculeConnected && !substructure.isSubgraph()) { System.out.println("---1.2---"); substructure = new Substructure(ac1, ac2, am, bm, true); bm = AtomBondMatcher.bondMatcher(false, isHasPerfectRings()); substructure = new Substructure(ac2, ac1, am, bm, true); System.out.println("---2.3---"); substructure = new Substructure(ac2, ac1, am, bm, true); } else if (moleculeConnected && !substructure.isSubgraph()) { am = AtomBondMatcher.atomMatcher(false, false); System.out.println("---2.2---"); substructure = new Substructure(ac2, ac1, am, bm, true);
private boolean isSubgraphIdentical(IAtomContainer qMol, IAtomContainer tMol, boolean removeHydrogen) throws CDKException, IOException, CloneNotSupportedException { // System.out.println("Graph matching"); IAtomContainer mol1 = qMol.clone(); IAtomContainer mol2 = tMol.clone(); if (removeHydrogen) { mol1 = removeHydrogens(mol1); percieveAtomTypesAndConfigureAtoms(mol1); aromatizeMolecule(mol1); mol2 = removeHydrogens(mol2); percieveAtomTypesAndConfigureAtoms(mol2); aromatizeMolecule(mol2); } if (mol1.getAtomCount() != mol2.getAtomCount()) { return false; } AtomMatcher atomMatcher = AtomBondMatcher.atomMatcher(true, true); BondMatcher bondMatcher = AtomBondMatcher.bondMatcher(true, true); Substructure mcs = new Substructure(mol1, mol2, atomMatcher, bondMatcher, false); mcs.setChemFilters(true, true, true); return mcs.isSubgraph() && !mcs.isStereoMisMatch(); } }
BondMatcher bondMatcher = AtomBondMatcher.bondMatcher(true, true); Substructure isomorphism = new Substructure(ac1, ac2, atomMatcher, bondMatcher, false); if (isomorphism.isSubgraph()) { isomorphism.setChemFilters(true, true, true);