示例#1
0
        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));
        }
示例#2
0
        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]-
        }
示例#3
0
        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);
        }