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)); }
private void RemoveHydrogenConstraints(IndigoObject mol) { // all this typically < 0.1 msec List <int> HList = new List <int>(); foreach (IndigoObject atom in mol.iterateAtoms()) { atom.removeConstraints("hydrogens"); // critical !! if (atom.atomicNumber() == 1) { HList.Add(atom.index()); } } mol.removeAtoms(HList); // e.g. to make -n[H]- substructure of -n[C]- }
private double calculateRgrpMassShift(fragmentationRule rule, IndigoObject structure) { Console.Out.WriteLine(rule._MassShift1); double mshift = 0.00; foreach (IndigoObject atom in structure.iterateAtoms()) { if (atom.symbol().Equals("R")) { try { double RgrpMassShift = double.Parse(rmasses[rmasses.IndexOf(rmasses.Find(x => x.index == atom.index()))].interfaceText.Text); mshift += RgrpMassShift; } catch (FormatException e) { MessageBox.Show("All R-Groups must have masses... R Group #" + atom.index() + " does not!"); } } } Console.Out.WriteLine("MASS SHIFT FINAL " + mshift); return(mshift); }