/** * Writes an array of Reaction to an OutputStream in MDL rdf format. * * @param reactions Array of Reactions that is written to an OutputStream */ private void writeReactionSet(IReactionSet reactions) throws CDKException { for (IReaction iReaction : reactions.reactions()) { writeReaction(iReaction); } }
public static void removeElectronContainer(IReactionSet set, IElectronContainer electrons) { for (IReaction reaction : set.reactions()) { ReactionManipulator.removeElectronContainer(reaction, electrons); } }
public static IReaction getRelevantReaction(IReactionSet set, IAtom atom) { for (IReaction reaction : set.reactions()) { IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, atom); if (container != null) { // a match! return reaction; } } return null; }
public static int getAtomCount(IReactionSet set) { int count = 0; for (IReaction iReaction : set.reactions()) { count += ReactionManipulator.getAtomCount(iReaction); } return count; }
public static IReaction getRelevantReaction(IReactionSet set, IBond bond) { for (IReaction reaction : set.reactions()) { IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, bond); if (container != null) { // a match! return reaction; } } return null; }
public static IAtomContainer getRelevantAtomContainer(IReactionSet set, IBond bond) { for (IReaction reaction : set.reactions()) { IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, bond); if (container != null) { // a match! return container; } } return null; }
public static List<IChemObject> getAllChemObjects(IReactionSet set) { ArrayList<IChemObject> list = new ArrayList<IChemObject>(); list.add(set); for (IReaction reaction : set.reactions()) { list.addAll(ReactionManipulator.getAllChemObjects(reaction)); } return list; }
public static int getBondCount(IReactionSet set) { int count = 0; for (IReaction iReaction : set.reactions()) { count += ReactionManipulator.getBondCount(iReaction); } return count; }
public static Set<String> currentIds(IReactionSet reactionSet) { Set<String> ids = new HashSet<String>(); for (IReaction reaction : reactionSet.reactions()) { ids.add(reaction.getID()); } return ids; } }
/** * Writes an array of Reaction to an OutputStream in MDL rdf format. * * @param som Array of Reactions that is written to an OutputStream */ private void writeReactionSet(IReactionSet reactions) throws CDKException { for (Iterator<IReaction> it = reactions.reactions().iterator(); it.hasNext();) { writeReaction(it.next()); } }
public static void removeAtomAndConnectedElectronContainers(IReactionSet set, IAtom atom) { for (IReaction reaction : set.reactions()) { ReactionManipulator.removeAtomAndConnectedElectronContainers(reaction, atom); } }
public static IAtomContainer getRelevantAtomContainer(IReactionSet set, IAtom atom) { for (IReaction reaction : set.reactions()) { IAtomContainer container = ReactionManipulator.getRelevantAtomContainer(reaction, atom); if (container != null) { // a match! return container; } } return null; }
public static List<String> getAllIDs(IReactionSet set) { List<String> IDlist = new ArrayList<String>(); if (set.getID() != null) IDlist.add(set.getID()); for (IReaction reaction : set.reactions()) { IDlist.addAll(ReactionManipulator.getAllIDs(reaction)); } return IDlist; }
/** * * @param reactionSet * @throws java.lang.Exception */ public synchronized void standardize(IReactionSet reactionSet) throws Exception { for (IReaction reaction : reactionSet.reactions()) { IReaction standardizedReaction = standardize(reaction); reactionSet.addReaction(standardizedReaction); } }
/** * Calculate the average bond length for the bonds in a reaction set. * @param reactionSet the reaction set to use * @return the average bond length */ public static double calculateAverageBondLength(IReactionSet reactionSet) { double averageBondModelLength = 0.0; for (IReaction reaction : reactionSet.reactions()) { averageBondModelLength += calculateAverageBondLength(reaction); } return averageBondModelLength / reactionSet.getReactionCount(); }
public static Rectangle2D calculateBounds(IReactionSet reactionSet) { Rectangle2D totalBounds = new Rectangle2D.Double(); for (IReaction reaction : reactionSet.reactions()) { Rectangle2D reactionBounds = calculateBounds(reaction); if (totalBounds.isEmpty()) { totalBounds = reactionBounds; } else { Rectangle2D.union(totalBounds, reactionBounds, totalBounds); } } return totalBounds; }
private static void createIDsForReactionSet(IReactionSet reactionSet, List<String> tabuList) { if (tabuList == null) tabuList = ReactionSetManipulator.getAllIDs(reactionSet); if (null == reactionSet.getID()) { // generate new ID for the set reactionSetCount = setID(REACTIONSET_PREFIX, reactionSetCount, reactionSet, tabuList); } for (Iterator<IReaction> reaction = reactionSet.reactions().iterator(); reaction.hasNext();) { createIDsForReaction(reaction.next(), tabuList); } }
private static void setReactionIDs(IChemModel chemModel) { // we give all reactions an ID, in case they have none // IDs are needed for handling in JCP IReactionSet reactionSet = chemModel.getReactionSet(); if (reactionSet != null) { int i = 0; for (IReaction reaction : reactionSet.reactions()) { if (reaction.getID() == null) reaction.setID("Reaction " + (++i)); } } }
private CMLReactionList cdkReactionSetToCMLReactionList(IReactionSet reactionSet, boolean setIDs) { CMLReactionList reactionList = new CMLReactionList(); if (useCMLIDs && setIDs) { IDCreator.createIDs(reactionSet); } if (reactionSet.getID() != null && !reactionSet.getID().equals("")) reactionList.setId(reactionSet.getID()); Iterator<IReaction> reactionIter = reactionSet.reactions().iterator(); while (reactionIter.hasNext()) { reactionList.appendChild(cdkReactionToCMLReaction(reactionIter.next(), false)); } return reactionList; }
private CMLReactionList cdkReactionSetToCMLReactionList(IReactionSet reactionSet, boolean setIDs) { CMLReactionList reactionList = new CMLReactionList(); if (useCMLIDs && setIDs) { IDCreator.createIDs(reactionSet); } if (reactionSet.getID() != null && !reactionSet.getID().equals("")) reactionList.setId(reactionSet.getID()); Iterator<IReaction> reactionIter = reactionSet.reactions().iterator(); while (reactionIter.hasNext()) { reactionList.appendChild(cdkReactionToCMLReaction(reactionIter.next(), false)); } return reactionList; }