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()); } }
/// <summary> /// Returns whether the chemical structure contains a specified substructure. /// </summary> /// <param name="substructureQuery">The specified substructure to search for.</param> /// <returns>True if this chemical structure contains the specified substructure.</returns> public bool HasSubstructure(ChemicalStructure substructureQuery) { bool hasSubstructure = false; using (Indigo indigo = new Indigo()) { // Load inputs. IndigoObject structure = CreateIndigoStructure(indigo); IndigoObject substructure = indigo.loadQueryMolecule(substructureQuery.MolfileContents); // Perform the match. IndigoObject substructureMatcher = indigo.substructureMatcher(structure); hasSubstructure = (substructureMatcher.match(substructure) != null); // Dispose. structure.Dispose(); substructure.Dispose(); substructureMatcher.Dispose(); } return(hasSubstructure); }