private synchronized void mcsBuilder(IQueryAtomContainer mol1, IAtomContainer mol2) { int rBondCount = mol1.getBondCount(); int pBondCount = mol2.getBondCount(); int rAtomCount = mol1.getAtomCount(); int pAtomCount = mol2.getAtomCount(); if ((rBondCount == 0 && rAtomCount > 0) || (pBondCount == 0 && pAtomCount > 0)) { singleMapping(); } else { chooseAlgorithm(rBondCount, pBondCount); } if (!allAtomMCS.isEmpty() && !firstAtomMCS.isEmpty() && firstAtomMCS.size() > 1) { setAllBondMaps(makeBondMapsOfAtomMaps(mol1, mol2, allAtomMCS)); if (getAllBondMaps().iterator().hasNext()) { setFirstBondMap(getAllBondMaps().iterator().next()); } } }
private synchronized void mcsBuilder(IQueryAtomContainer mol1, IAtomContainer mol2) { int rBondCount = mol1.getBondCount(); int pBondCount = mol2.getBondCount(); int rAtomCount = mol1.getAtomCount(); int pAtomCount = mol2.getAtomCount(); if ((rBondCount == 0 && rAtomCount > 0) || (pBondCount == 0 && pAtomCount > 0)) { singleMapping(); } else { chooseAlgorithm(); } }
private synchronized void mcsBuilder(IQueryAtomContainer mol1, IAtomContainer mol2) { int rBondCount = mol1.getBondCount(); int pBondCount = mol2.getBondCount(); int rAtomCount = mol1.getAtomCount(); int pAtomCount = mol2.getAtomCount(); if ((rBondCount == 0 && rAtomCount > 0) || (pBondCount == 0 && pAtomCount > 0)) { singleMapping(); } else { chooseAlgorithm(); } }
/** * Returns single mapping solutions. * @param source * @param target * @param removeHydrogen * @return Mappings * @throws CDKException */ protected List<Map<IAtom, IAtom>> getOverLaps(IQueryAtomContainer source, IAtomContainer target, boolean removeHydrogen) throws CDKException { mappings = new ArrayList<Map<IAtom, IAtom>>(); connectedBondOrder = new TreeMap<Integer, Double>(); this.source = source; this.target = target; if (source.getAtomCount() == 1 || (source.getAtomCount() > 0 && source.getBondCount() == 0)) { setSourceSingleAtomMap(source, removeHydrogen); } if (target.getAtomCount() == 1 || (target.getAtomCount() > 0 && target.getBondCount() == 0)) { setTargetSingleAtomMap(removeHydrogen); } postFilter(); return mappings; }
for (int atomIndex = 0; atomIndex < query.getBondCount(); atomIndex++) { Integer indexI = query.indexOf(query.getBond(atomIndex).getAtom(0)); Integer indexJ = query.indexOf(query.getBond(atomIndex).getAtom(1));
/** * Returns single mapping solutions. * * @param source * @param target * @return Mappings * @throws CDKException */ protected synchronized List<Map<IAtom, IAtom>> getOverLaps( IQueryAtomContainer source, IAtomContainer target) throws CDKException { List<Map<IAtom, IAtom>> mappings = new ArrayList<>(); this.source = source; this.target = target; if (source.getAtomCount() == 1 || (source.getAtomCount() > 0 && source.getBondCount() == 0)) { setSourceSingleAtomMap(mappings); } if (target.getAtomCount() == 1 || (target.getAtomCount() > 0 && target.getBondCount() == 0)) { setTargetSingleAtomMap(mappings); } return postFilter(mappings); }
/** * Returns single mapping solutions. * * @param source * @param target * @return Mappings * @throws CDKException */ protected synchronized List<Map<IAtom, IAtom>> getOverLaps( IQueryAtomContainer source, IAtomContainer target) throws CDKException { List<Map<IAtom, IAtom>> mappings = new ArrayList<>(); this.source = source; this.target = target; if (source.getAtomCount() == 1 || (source.getAtomCount() > 0 && source.getBondCount() == 0)) { setSourceSingleAtomMap(mappings); } if (target.getAtomCount() == 1 || (target.getAtomCount() > 0 && target.getBondCount() == 0)) { setTargetSingleAtomMap(mappings); } return postFilter(mappings); }
for (int atomIndex = 0; atomIndex < query.getBondCount(); atomIndex++) { Integer indexI = query.indexOf(query.getBond(atomIndex).getAtom(0)); Integer indexJ = query.indexOf(query.getBond(atomIndex).getAtom(1));
for (int atomIndex = 0; atomIndex < query.getBondCount(); atomIndex++) { Integer indexI = query.indexOf(query.getBond(atomIndex).getBegin()); Integer indexJ = query.indexOf(query.getBond(atomIndex).getEnd());
for (int atomIndex = 0; atomIndex < query.getBondCount(); atomIndex++) { Integer indexI = query.getAtomNumber(query.getBond(atomIndex).getAtom(0)); Integer indexJ = query.getAtomNumber(query.getBond(atomIndex).getAtom(1));
if (cTab1Copy.get(atomIndex * 4 + 3).compareToIgnoreCase("X") == 0) { step1(atomIndex, counter); McGregorChecks.changeCharBonds(indexJ, signs[counter], query.getBondCount(), (IQueryAtomContainer) query, cTab1Copy); int cor_atom = searchCorrespondingAtom(newNeighborNumA, indexJ, 1, mapped_atoms); McGregorChecks.changeCharBonds(cor_atom, signs[counter], target.getBondCount(), target, cTab2Copy); if (cTab1Copy.get(atomIndex * 4 + 2).compareToIgnoreCase("X") == 0) { step3(atomIndex, counter); McGregorChecks.changeCharBonds(indexI, signs[counter], query.getBondCount(), (IQueryAtomContainer) query, cTab1Copy); int cor_atom = searchCorrespondingAtom(newNeighborNumA, indexI, 1, mapped_atoms); McGregorChecks.changeCharBonds(cor_atom, signs[counter], target.getBondCount(), target, cTab2Copy);
if (cTab1Copy.get(atomIndex * 4 + 3).compareToIgnoreCase("X") == 0) { step1(atomIndex, counter); McGregorChecks.changeCharBonds(indexJ, signs[counter], query.getBondCount(), (IQueryAtomContainer) query, cTab1Copy); int cor_atom = searchCorrespondingAtom(newNeighborNumA, indexJ, 1, mapped_atoms); McGregorChecks.changeCharBonds(cor_atom, signs[counter], target.getBondCount(), target, cTab2Copy); if (cTab1Copy.get(atomIndex * 4 + 2).compareToIgnoreCase("X") == 0) { step3(atomIndex, counter); McGregorChecks.changeCharBonds(indexI, signs[counter], query.getBondCount(), (IQueryAtomContainer) query, cTab1Copy); int cor_atom = searchCorrespondingAtom(newNeighborNumA, indexI, 1, mapped_atoms); McGregorChecks.changeCharBonds(cor_atom, signs[counter], target.getBondCount(), target, cTab2Copy);
if (cTab1Copy.get(atomIndex * 4 + 3).compareToIgnoreCase("X") == 0) { step1(atomIndex, counter); McGregorChecks.changeCharBonds(indexJ, signs[counter], query.getBondCount(), (IQueryAtomContainer) query, cTab1Copy); int cor_atom = searchCorrespondingAtom(newNeighborNumA, indexJ, 1, mapped_atoms); McGregorChecks.changeCharBonds(cor_atom, signs[counter], target.getBondCount(), target, cTab2Copy); if (cTab1Copy.get(atomIndex * 4 + 2).compareToIgnoreCase("X") == 0) { step3(atomIndex, counter); McGregorChecks.changeCharBonds(indexI, signs[counter], query.getBondCount(), (IQueryAtomContainer) query, cTab1Copy); int cor_atom = searchCorrespondingAtom(newNeighborNumA, indexI, 1, mapped_atoms); McGregorChecks.changeCharBonds(cor_atom, signs[counter], target.getBondCount(), target, cTab2Copy);
private IQuery build(IQueryAtomContainer queryMolecule) { VFQueryBuilder result = new VFQueryBuilder(); for (IAtom atoms : queryMolecule.atoms()) { IQueryAtom atom = (IQueryAtom) atoms; VFAtomMatcher matcher = createAtomMatcher(atom, queryMolecule); if (matcher != null) { result.addNode(matcher, atom); } } for (int i = 0; i < queryMolecule.getBondCount(); i++) { IBond bond = queryMolecule.getBond(i); IQueryAtom atomI = (IQueryAtom) bond.getBegin(); IQueryAtom atomJ = (IQueryAtom) bond.getEnd(); result.connect(result.getNode(atomI), result.getNode(atomJ), createBondMatcher((IQueryBond) bond)); } return result; }
@Test public void testReadPcoreDef() throws Exception { String filename = "data/pcore/pcore.xml"; InputStream ins = PharmacophoreUtilityTest.class.getClassLoader().getResourceAsStream(filename); List<PharmacophoreQuery> defs = PharmacophoreUtils.readPharmacophoreDefinitions(ins); Assert.assertEquals(2, defs.size()); IQueryAtomContainer def1 = defs.get(0); Assert.assertEquals(4, def1.getAtomCount()); Assert.assertEquals(2, def1.getBondCount()); Assert.assertEquals("An imaginary pharmacophore definition", def1.getProperty("description")); Assert.assertEquals("Imaginary", def1.getTitle()); IQueryAtomContainer def2 = defs.get(1); Assert.assertEquals(3, def2.getAtomCount()); Assert.assertEquals(3, def2.getBondCount()); Assert.assertNull(def2.getTitle()); String[] ids = {"Aromatic", "Hydroxyl", "BasicAmine"}; for (IAtom atom : def2.atoms()) { String sym = atom.getSymbol(); boolean found = false; for (String s : ids) { if (sym.equals(s)) { found = true; break; } } Assert.assertTrue("'" + sym + "' in pcore.xml is invalid", found); } }
Assert.assertEquals(2, def1.getBondCount()); Assert.assertEquals("A modified definition for the D1 receptor", def1.getProperty("description"));