コード例 #1
0
        public static void removeElectronContainer(IChemModel chemModel, IElectronContainer electrons)
        {
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                if (crystal.contains(electrons))
                {
                    crystal.removeElectronContainer(electrons);
                }
                return;
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                SetOfMoleculesManipulator.removeElectronContainer(moleculeSet, electrons);
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                SetOfReactionsManipulator.removeElectronContainer(reactionSet, electrons);
            }
        }
コード例 #2
0
        public static void removeAtomAndConnectedElectronContainers(IChemModel chemModel, IAtom atom)
        {
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                if (crystal.contains(atom))
                {
                    crystal.removeAtomAndConnectedElectronContainers(atom);
                }
                return;
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                SetOfMoleculesManipulator.removeAtomAndConnectedElectronContainers(moleculeSet, atom);
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                SetOfReactionsManipulator.removeAtomAndConnectedElectronContainers(reactionSet, atom);
            }
        }
コード例 #3
0
ファイル: MDLRXNReader.cs プロジェクト: carlhuth/GenXSource
 /// <summary> Takes an object which subclasses IChemObject, e.g.Molecule, and will read
 /// this (from file, database, internet etc). If the specific implementation
 /// does not support a specific IChemObject it will throw an Exception.
 ///
 /// </summary>
 /// <param name="object">                             The object that subclasses
 /// IChemObject
 /// </param>
 /// <returns>                                     The IChemObject read
 /// </returns>
 /// <exception cref="CDKException">
 /// </exception>
 public override IChemObject read(IChemObject object_Renamed)
 {
     if (object_Renamed is IReaction)
     {
         return((IChemObject)readReaction(object_Renamed.Builder));
     }
     else if (object_Renamed is IChemModel)
     {
         IChemModel      model       = object_Renamed.Builder.newChemModel();
         ISetOfReactions reactionSet = object_Renamed.Builder.newSetOfReactions();
         reactionSet.addReaction(readReaction(object_Renamed.Builder));
         model.SetOfReactions = reactionSet;
         return(model);
     }
     else if (object_Renamed is IChemFile)
     {
         IChemFile     chemFile = object_Renamed.Builder.newChemFile();
         IChemSequence sequence = object_Renamed.Builder.newChemSequence();
         sequence.addChemModel((IChemModel)read(object_Renamed.Builder.newChemModel()));
         chemFile.addChemSequence(sequence);
         return(chemFile);
     }
     else
     {
         throw new CDKException("Only supported are Reaction and ChemModel, and not " + object_Renamed.GetType().FullName + ".");
     }
 }
コード例 #4
0
 public virtual void createIDs(ISetOfReactions reactionSet)
 {
     IReaction[] reactions = reactionSet.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         createIDs(reactions[i]);
     }
 }
コード例 #5
0
 public static void removeElectronContainer(ISetOfReactions set_Renamed, IElectronContainer electrons)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         ReactionManipulator.removeElectronContainer(reaction, electrons);
     }
 }
コード例 #6
0
 public static void removeAtomAndConnectedElectronContainers(ISetOfReactions set_Renamed, IAtom atom)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         ReactionManipulator.removeAtomAndConnectedElectronContainers(reaction, atom);
     }
 }
コード例 #7
0
 public static void setAtomProperties(ISetOfReactions set_Renamed, System.Object propKey, System.Object propVal)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         ReactionManipulator.setAtomProperties(reaction, propKey, propVal);
     }
 }
コード例 #8
0
 public static void removeAtomAndConnectedElectronContainers(ISetOfReactions set_Renamed, IAtom atom)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         ReactionManipulator.removeAtomAndConnectedElectronContainers(reaction, atom);
     }
 }
コード例 #9
0
 public static void removeElectronContainer(ISetOfReactions set_Renamed, IElectronContainer electrons)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         ReactionManipulator.removeElectronContainer(reaction, electrons);
     }
 }
コード例 #10
0
 public static int getBondCount(ISetOfReactions set_Renamed)
 {
     int count = 0;
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         count += ReactionManipulator.getBondCount(reactions[i]);
     }
     return count;
 }
コード例 #11
0
 /// <deprecated> This method has a serious performace impact. Try to use
 /// other methods.
 /// </deprecated>
 public static IAtomContainer getAllInOneContainer(ISetOfReactions set_Renamed)
 {
     IAtomContainer container = set_Renamed.Builder.newAtomContainer();
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         container.add(ReactionManipulator.getAllInOneContainer(reaction));
     }
     return container;
 }
コード例 #12
0
 public static System.Collections.IList getAllChemObjects(ISetOfReactions set_Renamed)
 {
     System.Collections.ArrayList list = new System.Collections.ArrayList();
     IReaction[] reactions             = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         list.AddRange(ReactionManipulator.getAllChemObjects(reaction));
     }
     return(list);
 }
コード例 #13
0
 public static System.Collections.ArrayList getAllIDs(ISetOfReactions set_Renamed)
 {
     System.Collections.ArrayList IDlist = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         IDlist.AddRange(ReactionManipulator.getAllIDs(reaction));
     }
     return(IDlist);
 }
コード例 #14
0
        public static int getBondCount(ISetOfReactions set_Renamed)
        {
            int count = 0;

            IReaction[] reactions = set_Renamed.Reactions;
            for (int i = 0; i < reactions.Length; i++)
            {
                count += ReactionManipulator.getBondCount(reactions[i]);
            }
            return(count);
        }
コード例 #15
0
        public static IReaction getRelevantReaction(IChemModel chemModel, IAtom atom)
        {
            IReaction reaction = null;

            if (chemModel.SetOfReactions != null)
            {
                ISetOfReactions reactionSet = chemModel.SetOfReactions;
                reaction = SetOfReactionsManipulator.getRelevantReaction(reactionSet, atom);
            }
            return(reaction);
        }
コード例 #16
0
        public static ISetOfMolecules getAllMolecules(ISetOfReactions set_Renamed)
        {
            ISetOfMolecules moleculeSet = set_Renamed.Builder.newSetOfMolecules();

            IReaction[] reactions = set_Renamed.Reactions;
            for (int i = 0; i < reactions.Length; i++)
            {
                IReaction reaction = reactions[i];
                moleculeSet.add(ReactionManipulator.getAllMolecules(reaction));
            }
            return(moleculeSet);
        }
コード例 #17
0
ファイル: ChemFileCDO.cs プロジェクト: carlhuth/GenXSource
        //protected internal LoggingTool logger;

        /// <summary> Basic contructor</summary>
        public ChemFileCDO(IChemFile file)
        {
            //logger = new LoggingTool(this);
            currentChemFile       = file;
            currentChemSequence   = file.Builder.newChemSequence();
            currentChemModel      = file.Builder.newChemModel();
            currentSetOfMolecules = file.Builder.newSetOfMolecules();
            currentSetOfReactions = null;
            currentReaction       = null;
            currentMolecule       = file.Builder.newMolecule();
            atomEnumeration       = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
        }
コード例 #18
0
        /// <deprecated> This method has a serious performace impact. Try to use
        /// other methods.
        /// </deprecated>
        public static IAtomContainer getAllInOneContainer(ISetOfReactions set_Renamed)
        {
            IAtomContainer container = set_Renamed.Builder.newAtomContainer();

            IReaction[] reactions = set_Renamed.Reactions;
            for (int i = 0; i < reactions.Length; i++)
            {
                IReaction reaction = reactions[i];
                container.add(ReactionManipulator.getAllInOneContainer(reaction));
            }
            return(container);
        }
コード例 #19
0
 public static IAtomContainer getRelevantAtomContainer(ISetOfReactions set_Renamed, IBond bond)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction      reaction  = reactions[i];
         IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, bond);
         if (container != null)
         {
             // a match!
             return(container);
         }
     }
     return(null);
 }
コード例 #20
0
        public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IBond bond)
        {
            IAtomContainer result = null;

            if (chemModel.SetOfMolecules != null)
            {
                ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;
                result = SetOfMoleculesManipulator.getRelevantAtomContainer(moleculeSet, bond);
                if (result != null)
                {
                    return(result);
                }
            }
            if (chemModel.SetOfReactions != null)
            {
                ISetOfReactions reactionSet = chemModel.SetOfReactions;
                return(SetOfReactionsManipulator.getRelevantAtomContainer(reactionSet, bond));
            }
            // This should never happen.
            return(null);
        }
コード例 #21
0
        public virtual void createIDs(IChemModel model)
        {
            ICrystal crystal = model.Crystal;

            if (crystal != null)
            {
                createIDs(crystal);
            }
            ISetOfMolecules moleculeSet = model.SetOfMolecules;

            if (moleculeSet != null)
            {
                createIDs(moleculeSet);
            }
            ISetOfReactions reactionSet = model.SetOfReactions;

            if (reactionSet != null)
            {
                createIDs(reactionSet);
            }
        }
コード例 #22
0
        public static int getBondCount(IChemModel chemModel)
        {
            int      count   = 0;
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                count += crystal.getBondCount();
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                count += SetOfMoleculesManipulator.getBondCount(moleculeSet);
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                count += SetOfReactionsManipulator.getBondCount(reactionSet);
            }
            return(count);
        }
コード例 #23
0
        /// <summary> Puts all the Molecules of this container together in one
        /// AtomContainer.
        ///
        /// </summary>
        /// <returns>  The AtomContainer with all the Molecules of this container
        ///
        /// </returns>
        /// <deprecated> This method has a serious performace impact. Try to use
        /// other methods.
        /// </deprecated>
        public static IAtomContainer getAllInOneContainer(IChemModel chemModel)
        {
            IAtomContainer container = chemModel.Builder.newAtomContainer();
            ICrystal       crystal   = chemModel.Crystal;

            if (crystal != null)
            {
                container.add(crystal);
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                container.add(SetOfMoleculesManipulator.getAllInOneContainer(moleculeSet));
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                container.add(SetOfReactionsManipulator.getAllInOneContainer(reactionSet));
            }
            return(container);
        }
コード例 #24
0
        public static System.Collections.IList getAllChemObjects(IChemModel chemModel)
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            list.Add(chemModel);
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                list.Add(crystal);
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                list.AddRange(SetOfMoleculesManipulator.getAllChemObjects(moleculeSet));
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                list.AddRange(SetOfReactionsManipulator.getAllChemObjects(reactionSet));
            }
            return(list);
        }
コード例 #25
0
        //protected internal LoggingTool logger;

        /// <summary> Basic contructor</summary>
        public ChemFileCDO(IChemFile file)
        {
            //logger = new LoggingTool(this);
            currentChemFile = file;
            currentChemSequence = file.Builder.newChemSequence();
            currentChemModel = file.Builder.newChemModel();
            currentSetOfMolecules = file.Builder.newSetOfMolecules();
            currentSetOfReactions = null;
            currentReaction = null;
            currentMolecule = file.Builder.newMolecule();
            atomEnumeration = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
        }
コード例 #26
0
 public static System.Collections.ArrayList getAllIDs(ISetOfReactions set_Renamed)
 {
     System.Collections.ArrayList IDlist = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         IDlist.AddRange(ReactionManipulator.getAllIDs(reaction));
     }
     return IDlist;
 }
コード例 #27
0
 /// <summary> Returns all the AtomContainer's of a Reaction.</summary>
 public static IAtomContainer[] getAllAtomContainers(ISetOfReactions set_Renamed)
 {
     return(SetOfMoleculesManipulator.getAllAtomContainers(getAllMolecules(set_Renamed)));
 }
コード例 #28
0
 /// <summary> Returns all the AtomContainer's of a Reaction.</summary>
 public static IAtomContainer[] getAllAtomContainers(ISetOfReactions set_Renamed)
 {
     return SetOfMoleculesManipulator.getAllAtomContainers(getAllMolecules(set_Renamed));
 }
コード例 #29
0
 /// <summary> Procedure required by the CDOInterface. This function is only
 /// supposed to be called by the JCFL library
 /// </summary>
 public virtual void startObject(System.String objectType)
 {
     //logger.debug("START:" + objectType);
     if (objectType.Equals("Molecule"))
     {
         if (currentChemModel == null)
             currentChemModel = currentChemFile.Builder.newChemModel();
         if (currentSetOfMolecules == null)
             currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules();
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
     else if (objectType.Equals("Atom"))
     {
         currentAtom = currentChemFile.Builder.newAtom("H");
         //logger.debug("Atom # " + numberOfAtoms);
         numberOfAtoms++;
     }
     else if (objectType.Equals("Bond"))
     {
         bond_id = null;
         bond_stereo = -99;
     }
     else if (objectType.Equals("Animation"))
     {
         currentChemSequence = currentChemFile.Builder.newChemSequence();
     }
     else if (objectType.Equals("Frame"))
     {
         currentChemModel = currentChemFile.Builder.newChemModel();
     }
     else if (objectType.Equals("SetOfMolecules"))
     {
         currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules();
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
     else if (objectType.Equals("Crystal"))
     {
         currentMolecule = currentChemFile.Builder.newCrystal(currentMolecule);
     }
     else if (objectType.Equals("a-axis") || objectType.Equals("b-axis") || objectType.Equals("c-axis"))
     {
         crystal_axis_x = 0.0;
         crystal_axis_y = 0.0;
         crystal_axis_z = 0.0;
     }
     else if (objectType.Equals("SetOfReactions"))
     {
         currentSetOfReactions = currentChemFile.Builder.newSetOfReactions();
     }
     else if (objectType.Equals("Reaction"))
     {
         if (currentSetOfReactions == null)
             startObject("SetOfReactions");
         currentReaction = currentChemFile.Builder.newReaction();
     }
     else if (objectType.Equals("Reactant"))
     {
         if (currentReaction == null)
             startObject("Reaction");
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
     else if (objectType.Equals("Product"))
     {
         if (currentReaction == null)
             startObject("Reaction");
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
 }
コード例 #30
0
ファイル: ChemFileCDO.cs プロジェクト: carlhuth/GenXSource
 /// <summary> Procedure required by the CDOInterface. This function is only
 /// supposed to be called by the JCFL library
 /// </summary>
 public virtual void startObject(System.String objectType)
 {
     //logger.debug("START:" + objectType);
     if (objectType.Equals("Molecule"))
     {
         if (currentChemModel == null)
         {
             currentChemModel = currentChemFile.Builder.newChemModel();
         }
         if (currentSetOfMolecules == null)
         {
             currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules();
         }
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
     else if (objectType.Equals("Atom"))
     {
         currentAtom = currentChemFile.Builder.newAtom("H");
         //logger.debug("Atom # " + numberOfAtoms);
         numberOfAtoms++;
     }
     else if (objectType.Equals("Bond"))
     {
         bond_id     = null;
         bond_stereo = -99;
     }
     else if (objectType.Equals("Animation"))
     {
         currentChemSequence = currentChemFile.Builder.newChemSequence();
     }
     else if (objectType.Equals("Frame"))
     {
         currentChemModel = currentChemFile.Builder.newChemModel();
     }
     else if (objectType.Equals("SetOfMolecules"))
     {
         currentSetOfMolecules = currentChemFile.Builder.newSetOfMolecules();
         currentMolecule       = currentChemFile.Builder.newMolecule();
     }
     else if (objectType.Equals("Crystal"))
     {
         currentMolecule = currentChemFile.Builder.newCrystal(currentMolecule);
     }
     else if (objectType.Equals("a-axis") || objectType.Equals("b-axis") || objectType.Equals("c-axis"))
     {
         crystal_axis_x = 0.0;
         crystal_axis_y = 0.0;
         crystal_axis_z = 0.0;
     }
     else if (objectType.Equals("SetOfReactions"))
     {
         currentSetOfReactions = currentChemFile.Builder.newSetOfReactions();
     }
     else if (objectType.Equals("Reaction"))
     {
         if (currentSetOfReactions == null)
         {
             startObject("SetOfReactions");
         }
         currentReaction = currentChemFile.Builder.newReaction();
     }
     else if (objectType.Equals("Reactant"))
     {
         if (currentReaction == null)
         {
             startObject("Reaction");
         }
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
     else if (objectType.Equals("Product"))
     {
         if (currentReaction == null)
         {
             startObject("Reaction");
         }
         currentMolecule = currentChemFile.Builder.newMolecule();
     }
 }
コード例 #31
0
 public static IAtomContainer getRelevantAtomContainer(ISetOfReactions set_Renamed, IBond bond)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, bond);
         if (container != null)
         {
             // a match!
             return container;
         }
     }
     return null;
 }
コード例 #32
0
 public static void setAtomProperties(ISetOfReactions set_Renamed, System.Object propKey, System.Object propVal)
 {
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         ReactionManipulator.setAtomProperties(reaction, propKey, propVal);
     }
 }
コード例 #33
0
 public static System.Collections.IList getAllChemObjects(ISetOfReactions set_Renamed)
 {
     System.Collections.ArrayList list = new System.Collections.ArrayList();
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         list.AddRange(ReactionManipulator.getAllChemObjects(reaction));
     }
     return list;
 }
コード例 #34
0
ファイル: IDCreator.cs プロジェクト: xuchuansheng/GenXSource
 public virtual void createIDs(ISetOfReactions reactionSet)
 {
     IReaction[] reactions = reactionSet.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         createIDs(reactions[i]);
     }
 }
コード例 #35
0
 public static ISetOfMolecules getAllMolecules(ISetOfReactions set_Renamed)
 {
     ISetOfMolecules moleculeSet = set_Renamed.Builder.newSetOfMolecules();
     IReaction[] reactions = set_Renamed.Reactions;
     for (int i = 0; i < reactions.Length; i++)
     {
         IReaction reaction = reactions[i];
         moleculeSet.add(ReactionManipulator.getAllMolecules(reaction));
     }
     return moleculeSet;
 }