private byte[] RenderHighlightedObject(IndigoObject mol, IndigoObject query) { query.aromatize(); IndigoObject matcher = indigo.substructureMatcher(mol); foreach (IndigoObject match in matcher.iterateMatches(query)) { foreach (IndigoObject queryAtom in query.iterateAtoms()) { IndigoObject atom = match.mapAtom(queryAtom); atom.highlight(); foreach (IndigoObject nei in atom.iterateNeighbors()) { if (!nei.isPseudoatom() && !nei.isRSite() && nei.atomicNumber() == 1) { nei.highlight(); nei.bond().highlight(); } } } foreach (IndigoObject bond in query.iterateBonds()) { match.mapBond(bond).highlight(); } } indigo.setOption("render-coloring", false); mol.dearomatize(); mol.layout(); return(renderer.renderToBuffer(mol)); }
public void test1() { string strQmol = "[H]/N=C(C)/N1CCCCC1"; //shows problem! //string strQmol = "[H]/N=C(C)/N"; // still shows problem //string strQmol = "[H]/N=C(C)/C"; // no problem //string strQmol = "[H]/N=C(C)/C(C)(C)"; // no problem again // string strLmol = "[H]/N=C(C)/N1CCCCC1CCC"; string strLmol = "N(C(=N([H])[H])c1cccc(C=CCN(C(=O)CCC(=O)OCC)c2ccc(OC3CCN(C(=N[H])C)CC3)c(C(F)(F)F)c2)c1)([H])[H]"; IndigoObject qmol = indigo.loadQueryMolecule(strQmol); IndigoObject mol = indigo.loadMolecule(strLmol); System.Diagnostics.Debug.WriteLine("QueryMol 1: " + qmol.smiles()); //qmol.clearCisTrans(); // string problem = mol.checkAmbiguousH(); problem = mol.checkBadValence(); System.Diagnostics.Debug.WriteLine("QueryMol 2: " + qmol.smiles()); System.Diagnostics.Debug.WriteLine("Largermol is : " + mol.smiles()); IndigoObject matcher = indigo.substructureMatcher(mol); indigo.setOption("embedding-uniqueness", "atoms"); foreach (IndigoObject m in matcher.iterateMatches(qmol)) { System.Diagnostics.Debug.WriteLine(m.highlightedTarget().smiles()); } }