Ejemplo n.º 1
0
        /// <summary> Removes the singly bonded oxygen from the acid group of the AminoAcid.
        ///
        /// </summary>
        /// <param name="acid">AminoAcid from which to remove the oxygen
        /// </param>
        /// <throws>  CDKException when the C-terminus is not defined for the given AminoAcid  </throws>
        public static void removeAcidicOxygen(IAminoAcid acid)
        {
            if (acid.getCTerminus() == null)
            {
                throw new CDKException("Cannot remove oxygen: C-terminus is not defined!");
            }

            IBond[] bonds = acid.getConnectedBonds(acid.getCTerminus());
            // ok, look for the oxygen which is singly bonded
            for (int i = 0; i < bonds.Length; i++)
            {
                if (bonds[i].Order == CDKConstants.BONDORDER_SINGLE)
                {
                    IAtom[] atoms = bonds[i].getAtoms();
                    for (int j = 0; j < atoms.Length; j++)
                    {
                        if (atoms[j].Symbol.Equals("O"))
                        {
                            // yes, we found a singly bonded oxygen!
                            acid.removeAtomAndConnectedElectronContainers(atoms[j]);
                        }
                    }
                }
            }
        }
        /// <summary> Removes the singly bonded oxygen from the acid group of the AminoAcid.
        /// 
        /// </summary>
        /// <param name="acid">AminoAcid from which to remove the oxygen
        /// </param>
        /// <throws>  CDKException when the C-terminus is not defined for the given AminoAcid  </throws>
        public static void removeAcidicOxygen(IAminoAcid acid)
        {
            if (acid.getCTerminus() == null)
                throw new CDKException("Cannot remove oxygen: C-terminus is not defined!");

            IBond[] bonds = acid.getConnectedBonds(acid.getCTerminus());
            // ok, look for the oxygen which is singly bonded
            for (int i = 0; i < bonds.Length; i++)
            {
                if (bonds[i].Order == CDKConstants.BONDORDER_SINGLE)
                {
                    IAtom[] atoms = bonds[i].getAtoms();
                    for (int j = 0; j < atoms.Length; j++)
                    {
                        if (atoms[j].Symbol.Equals("O"))
                        {
                            // yes, we found a singly bonded oxygen!
                            acid.removeAtomAndConnectedElectronContainers(atoms[j]);
                        }
                    }
                }
            }
        }