Class SugarDetectionUtility
This class extends SugarRemovalUtility to provide functionality for separating
glycosides into their aglycone and glycosidic components.
The main feature is the ability to create copies of both the aglycone
and individual sugar fragments from a given molecule, with proper handling of attachment
points and stereochemistry, and some optional postprocessing possibilities.
The extraction process supports:
- Detection and extraction of both circular and linear sugar moieties
- Preservation of stereochemistry at connection points
- Proper saturation of broken bonds with either R-groups or implicit hydrogen atoms
- Post-processing of sugar fragments including bond splitting (O-glycosidic, ether, ester, peroxide)
- Duplication of connecting heteroatoms (oxygen, nitrogen, sulfur) in glycosidic bonds, to produce more sensible educts
- Optional mapping of atoms and bonds from the original molecule to their copies in the aglycone and sugar fragments
All sugar detection and removal operations respect the settings inherited from the
parent SugarRemovalUtility class, including terminal vs. non-terminal sugar
removal, preservation mode settings, various detection thresholds, etc. In two cases, the initial
SugarRemovalUtility results are corrected for extraction:
- When a sugar would lose its C6
- When a sugar is on the "carboxy end" of an ester bond to the aglycone
Usage Example:
SugarDetectionUtility utility = new SugarDetectionUtility(SilentChemObjectBuilder.getInstance());
//check the overloaded variants of this method for more options
List<IAtomContainer> fragments = utility.copyAndExtractAglyconeAndSugars(molecule);
IAtomContainer aglycone = fragments.get(0); // First element is always the aglycone
// Subsequent elements are individual sugar fragments
- Author:
- Jonas Schaub (jonas.schaub@uni-jena.de | jonas-schaub@gmx.de | JonasSchaub on GitHub)
-
Nested Class Summary
Nested classes/interfaces inherited from class SugarRemovalUtility
SugarRemovalUtility.PreservationModeModifier and TypeClassDescriptionstatic enumEnum with options for how to determine whether a substructure that gets disconnected from the molecule during the removal of a sugar moiety should be preserved or can get removed along with the sugar. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSMARTS pattern for detecting cross-linking ether bonds between linear sugar moieties for postprocessing after extraction.static final StringSMARTS pattern for detecting ester bonds between circular sugar moieties for postprocessing after extraction.static final StringSMARTS pattern for detecting ester bonds between linear sugar moieties for postprocessing after extraction.static final StringSMARTS pattern for detecting ether bonds between linear sugar moieties for postprocessing after extraction.static final booleanDefault for extractCircularSugars parameter in copyAndExtractAglyconeAndSugars methods.static final booleanDefault for extractLinearSugars parameter in copyAndExtractAglyconeAndSugars methods.static final booleanDefault for limitPostProcessingBySize parameter in copyAndExtractAglyconeAndSugars methods.static final booleanDefault for markAttachPointsByR parameter in copyAndExtractAglyconeAndSugars methods.static final StringSMARTS pattern for detecting glycosidic bonds (ether bonds) between circular sugar moieties for postprocessing after extraction.static final StringSMARTS pattern for detecting peroxide bonds between circular sugar moieties for postprocessing after extraction.static final StringSMARTS pattern for detecting peroxide bonds between linear sugar moieties for postprocessing after extraction.static final booleanDefault for postProcessSugars parameter in copyAndExtractAglyconeAndSugars methods.Fields inherited from class SugarRemovalUtility
CIRCULAR_SUGARS_SMILES, DETECT_CIRCULAR_SUGARS_ONLY_WITH_ENOUGH_EXOCYCLIC_OXYGEN_ATOMS_DEFAULT, DETECT_CIRCULAR_SUGARS_ONLY_WITH_O_GLYCOSIDIC_BOND_DEFAULT, DETECT_CIRCULAR_SUGARS_WITH_KETO_GROUPS_DEFAULT, DETECT_LINEAR_ACIDIC_SUGARS_DEFAULT, DETECT_LINEAR_SUGARS_IN_RINGS_DEFAULT, DETECT_SPIRO_RINGS_AS_CIRCULAR_SUGARS_DEFAULT, ESTER_SMARTS_PATTERN, ETHER_SMARTS_PATTERN, EXOCYCLIC_OXYGEN_ATOMS_TO_ATOMS_IN_RING_RATIO_THRESHOLD_DEFAULT, INDEX_PROPERTY_KEY, IS_SPIRO_ATOM_PROPERTY_KEY, LINEAR_ACIDIC_SUGARS_SMILES, LINEAR_SUGAR_CANDIDATE_MAX_SIZE_DEFAULT, LINEAR_SUGAR_CANDIDATE_MIN_SIZE_DEFAULT, LINEAR_SUGARS_SMILES, PEROXIDE_SMARTS_PATTERN, PRESERVATION_MODE_DEFAULT, REMOVE_ONLY_TERMINAL_SUGARS_DEFAULT, TOO_SMALL_DISCONNECTED_PART_TO_PRESERVE_PROPERTY_KEYModifier and TypeFieldDescriptionprotected static final String[]Circular sugar structures represented as SMILES codes.static final booleanDefault setting for whether detected circular sugar candidates must have a sufficient number of attached, single-bonded exocyclic oxygen atoms in order to be detected as a sugar moiety (default: true).static final booleanDefault setting for whether only circular sugar moieties that are attached to the parent structure or other sugar moieties via an O-glycosidic bond should be detected and subsequently removed (default: false).static final booleanDefault setting for whether sugar-like rings that have keto groups should also be detected as circular sugars (default: false).static final booleanDefault setting for whether to include the linear acidic sugar patterns in the linear sugar structures used for initial detection of linear sugars in a given molecule (default: false).static final booleanDefault setting for whether linear sugar structures that are part of a ring should be detected (default: false).static final booleanDefault setting for whether to include spiro rings in the initial set of detected rings considered for circular sugar detection (default: false).static final StringDaylight SMARTS pattern for matching ester bonds between linear sugars.static final StringDaylight SMARTS pattern for matching ether bonds between linear sugars.static final doubleDefault setting for the minimum ratio of attached exocyclic, single-bonded oxygen atoms to the number of atoms in the candidate circular sugar structure to reach in order to be classified as a sugar moiety if the number of exocyclic oxygen atoms should be evaluated (default: 0.5 so at a minimum 3 connected, exocyclic oxygen atoms for a six-membered ring, for example).static final StringProperty key for index that is added to any IAtom object in a given IAtomContainer object for internal unique identification of the respective IAtom object.static final StringKey for property that is added to IAtom objects that connect a spiro ring system for identification and preservation of these atoms in the removal process.protected static final String[]Linear acidic sugar structures represented as SMILES codes.static final intDefault setting for the maximum number of carbon atoms a linear sugar candidate can have in order to be detected as a sugar moiety (and subsequently be removed, default: 7, inclusive).static final intDefault setting for the minimum number of carbon atoms a linear sugar candidate must have in order to be detected as a sugar moiety (and subsequently be removed, default: 4, inclusive).protected static final String[]Linear sugar structures represented as SMILES codes.static final StringDaylight SMARTS pattern for matching peroxide bonds between linear sugars.static final SugarRemovalUtility.PreservationModeDefault setting for how to determine whether a substructure that gets disconnected from the molecule during the removal of a sugar moiety should be preserved or can get removed along with the sugar.static final booleanDefault setting for whether only terminal sugar moieties should be removed, i.e. those that when removed do not cause a split of the remaining molecular structure into two or more disconnected substructures (default: true).static final StringKey for property that is added to IAtom objects that belong to unconnected parts of an input molecule that would be cleared away because it is too small according to the set preservation mode for preservation of these atoms in the removal process. -
Constructor Summary
ConstructorsConstructorDescriptionSugarDetectionUtility(IChemObjectBuilder builder) Sole constructor of this class. -
Method Summary
Modifier and TypeMethodDescriptionExtracts copies of the aglycone and sugar parts of the given molecule (if there are any).copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR, boolean postProcessSugars) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR, boolean postProcessSugars, boolean limitPostProcessingBySize) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR, boolean postProcessSugars, boolean limitPostProcessingBySize, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IBond, IBond> inputBondToBondCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).protected voidcorrectC6Separation(IAtomContainer mol, IAtomContainer copyForAglycone, IAtomContainer copyForSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap, IAtom aglyconeCarbon, IAtom aglyconeCarbonOriginalAtom, IBond bond) Corrects the separation of C6 carbon atoms that were incorrectly placed in the aglycone during sugar extraction.protected voidcorrectCarboxyGroupSeparation(IAtomContainer mol, IAtomContainer copyForAglycone, IAtomContainer copyForSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IBond, IBond> inputBondToBondCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap, IAtom aglyconeCarbon, IAtom aglyconeCarbonOriginalAtom, IAtom ketoOxygenInAglycone, IAtom etherOxygenInAglycone, IBond bond) Corrects the separation of carboxy groups that were incorrectly split between aglycone and sugar fragments during extraction.protected IAtomContainerdeeperCopy(IAtomContainer mol, Map<IAtom, IAtom> origToCopyAtomMap, Map<IBond, IBond> origToCopyBondMap) Creates a relatively deep ("deeper" than cloning but not as extensive) copy of the given atom container mol and fills the given maps with a mapping of the original atoms and bonds to the atoms and bonds in the copy.protected IAtomdeeperCopy(IAtom atom, IAtomContainer container) Creates a relatively deep ("deeper" than cloning but not as extensive) copy of the given atom and adds it to the given container.protected IBonddeeperCopy(IBond bond, IAtom begin, IAtom end) Creates a relatively deep ("deeper" than cloning but not as extensive) copy of the given bond between the given begin and end atoms.int[]getAtomIndicesOfGroup(IAtomContainer mol, IAtomContainer group, Map<IAtom, IAtom> inputAtomToAtomCopyMap) Returns the indices of atoms in the input molecule that correspond to atoms in the given group.int[]getBondIndicesOfGroup(IAtomContainer mol, IAtomContainer group, Map<IBond, IBond> inputBondToBondCopyMap) Returns the indices of bonds in the input molecule that correspond to bonds in the given group.int[]getGroupIndicesForAllAtoms(IAtomContainer mol, List<IAtomContainer> aglyconeAndSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap) Assigns group indices to all atoms in the input molecule based on their membership in the aglycone or sugar fragments.protected booleanisCarbonAtom(IAtom atom) Checks whether the given atom is a carbon atom.protected booleanisFragmentTooSmall(IAtomContainer molecule, IBond bondToBreak, boolean isCriterionForCircularSugars) Checks whether breaking the specified bond would result in a fragment that is too small by the set criterion.protected booleanisHeteroAtom(IAtom atom) Checks whether the given atom is a hetero-atom (i.e. non-carbon and non-hydrogen).protected booleanisPseudoAtom(IAtom atom) Checks whether the given atom is a pseudo atom.protected voidmapBondStereoElement(IAtomContainer mol, IBond bond, IAtomContainer receivingContainer, Map<IAtom, IAtom> inputAtomToAtomCopyMap, Map<IBond, IBond> inputBondToBondCopyMap) Maps a stereo element from the original molecule (mol) to the receiving container (a copy of the former) if the specified bond is involved in it and all its components (focus and carriers) are part of the receiving container.protected voidpreprocessSugarRemovalResults(IAtomContainer mol, IAtomContainer copyForAglycone, IAtomContainer copyForSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IBond, IBond> inputBondToBondCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap) Preprocesses the results of sugar removal to correct special cases where the separation was not chemically optimal.protected voidsaturate(IAtom copyAtomToSaturate, IAtomContainer copyContainer, boolean markAttachPointsByR, IAtom originalAtom, IBond originalBond) Saturates a broken bond at an attachment point by either adding an R-group or increasing the implicit hydrogen count.protected voidsplitEsters(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize, boolean splitCircularSugars) Splits ester bonds in the given molecule (circular or linear sugar moieties) and optionally marks the attachment points with R-groups.protected voidsplitEtherEsterPeroxideBondsLinearSugarsPostProcessing(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize) Splits ether, ester, and peroxide bonds in the given molecule (linear sugar moieties) and optionally marks the attachment points with R-groups.protected voidsplitEthersCrossLinking(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize) Splits cross-linking ether bonds in the given molecule (linear sugar moieties) and optionally marks the attachment points with R-groups.protected voidsplitOGlycosidicBondsAndEthers(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize, boolean splitCircularSugars) Splits O-glycosidic (ether) groups connecting circular or linear sugars in the given molecule and optionally marks the attachment points with R-groups.protected voidsplitOGlycosidicEsterPeroxideBondsCircularSugarsPostProcessing(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize) Splits O-glycosidic (ether), ester, and peroxide bonds in the given molecule (circular sugar moieties) and optionally marks the attachment points with R-groups.protected voidsplitPeroxides(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize, boolean splitCircularSugars) Splits peroxide groups in the given molecule (circular or linear sugar moieties) and optionally marks the attachment points with R-groups.Methods inherited from class SugarRemovalUtility
addCircularSugarToPatternsList, addCircularSugarToPatternsList, addLinearSugarToPatternsList, addLinearSugarToPatternsList, addUniqueIndicesToAtoms, areAllExocyclicBondsSingle, areCircularSugarsWithKetoGroupsDetected, areLinearAcidicSugarsDetected, areLinearSugarsInRingsDetected, areOnlyCircularSugarsWithEnoughExocyclicOxygenAtomsDetected, areOnlyCircularSugarsWithOGlycosidicBondDetected, areOnlyTerminalSugarsRemoved, areSpiroRingsDetectedAsCircularSugars, basicCopy, checkUniqueIndicesOfAtoms, clearCircularSugarPatternsList, clearLinearSugarPatternsList, combineOverlappingCandidates, detectLinearSugarCandidatesByPatternMatching, detectPotentialSugarCycles, doesRingHaveEnoughExocyclicOxygenAtoms, flagTooSmallDisconnectedPartsToPreserve, generateSubstructureIdentifier, getCircularSugarCandidates, getCircularSugarPatternsList, getExocyclicOxygenAtomCount, getExocyclicOxygenAtomsToAtomsInRingRatioThresholdSetting, getLinearSugarCandidateMaxSizeSetting, getLinearSugarCandidateMinSizeSetting, getLinearSugarCandidates, getLinearSugarPatternsList, getNumberOfCircularAndLinearSugars, getNumberOfCircularSugars, getNumberOfLinearSugars, getPreservationModeSetting, getPreservationModeThresholdSetting, hasCircularOrLinearSugars, hasCircularSugars, hasGlycosidicBond, hasLinearSugars, isMoleculeEmptyAfterRemovalOfThisRing, isQualifiedForGlycosidicBondExemption, isTerminal, isTooSmallToPreserve, removeAndReturnCircularAndLinearSugars, removeAndReturnCircularSugars, removeAndReturnLinearSugars, removeAtomsOfCircularSugarsFromCandidates, removeCircularAndLinearSugars, removeCircularSugarFromPatternsList, removeCircularSugarFromPatternsList, removeCircularSugars, removeCyclicAtomsFromSugarCandidates, removeLinearSugarFromPatternsList, removeLinearSugarFromPatternsList, removeLinearSugars, removeSugarCandidates, removeTooSmallAndTooLargeCandidates, removeTooSmallDisconnectedStructures, restoreDefaultSettings, setDetectCircularSugarsOnlyWithEnoughExocyclicOxygenAtomsSetting, setDetectCircularSugarsOnlyWithOGlycosidicBondSetting, setDetectCircularSugarsWithKetoGroupsSetting, setDetectLinearAcidicSugarsSetting, setDetectLinearSugarsInRingsSetting, setDetectSpiroRingsAsCircularSugarsSetting, setExocyclicOxygenAtomsToAtomsInRingRatioThresholdSetting, setLinearSugarCandidateMaxSizeSetting, setLinearSugarCandidateMinSizeSetting, setPreservationModeSetting, setPreservationModeThresholdSetting, setRemoveOnlyTerminalSugarsSetting, splitEtherEsterAndPeroxideBondsExtraction, updateLinearSugarPatternsModifier and TypeMethodDescriptionbooleanaddCircularSugarToPatternsList(String smilesCode) Allows to add an additional sugar ring (represented as a SMILES string) to the list of circular sugar structures an input molecule is scanned for in circular sugar detection.booleanaddCircularSugarToPatternsList(IAtomContainer circularSugar) Allows to add an additional sugar ring to the list of circular sugar structures an input molecule is scanned for in circular sugar detection.booleanaddLinearSugarToPatternsList(String smilesCode) Allows to add an additional linear sugar (represented as SMILES string) to the list of linear sugar structures an input molecule is scanned for in linear sugar detection.booleanaddLinearSugarToPatternsList(IAtomContainer linearSugar) Allows to add an additional linear sugar to the list of linear sugar structures an input molecule is scanned for in linear sugar detection.protected voidaddUniqueIndicesToAtoms(IAtomContainer moleculeParam) Adds an index as property to all atom objects of the given atom container to identify them uniquely within the atom container and its copies.protected booleanareAllExocyclicBondsSingle(IAtomContainer ringToTest, IAtomContainer originalMolecule, boolean ignoreKetoGroups) Checks whether all exocyclic bonds connected to a given ring fragment of a parent atom container are of single order.booleanSpecifies whether potential sugar cycles with keto groups are detected in circular sugar detection.booleanSpecifies whether linear acidic sugar patterns are currently included in the linear sugar structures used for initial detection of linear sugars in a given molecule.booleanSpecifies whether linear sugar structures that are part of a ring should be detected according to the current settings.booleanSpecifies whether detected circular sugar candidates must have a sufficient number of attached exocyclic oxygen atoms in order to be detected as a sugar moiety.booleanSpecifies whether only circular sugar moieties that are attached to the parent structure or other sugar moieties via an O-glycosidic bond should be detected and subsequently removed.booleanSpecifies whether only terminal sugar moieties should be removed, i.e. those that when removed do not cause a split of the remaining molecular structure into two or more disconnected substructures.booleanSpecifies whether spiro rings are included in the initial set of detected rings considered for circular sugar detection.protected IAtomContainerbasicCopy(IAtomContainer molecule) Generates a very basic copy of the given molecule, intended for testing whether one of its substructures is terminal inSugarRemovalUtility.isTerminal(IAtomContainer, IAtomContainer, List).protected booleancheckUniqueIndicesOfAtoms(IAtomContainer moleculeParam) Checks whether all atoms in the given molecule have a unique (in the given molecule) index as property.voidClears all the circular sugar structures an input molecule is scanned for in circular sugar detection.voidClears all the linear sugar structures an input molecule is scanned for in linear sugar detection.protected List<IAtomContainer> combineOverlappingCandidates(List<IAtomContainer> candidateList) Combines all overlapping (i.e. sharing the same atoms or bonds) structures in the given list into one atom container, respectively, to return distinct, non-overlapping substructures.protected List<IAtomContainer> detectLinearSugarCandidatesByPatternMatching(IAtomContainer moleculeParam) Initial detection of linear sugar candidates by substructure search for the linear sugar patterns in the given molecule.protected List<IAtomContainer> detectPotentialSugarCycles(IAtomContainer moleculeParam, boolean includeSpiroRings, boolean ignoreKetoGroups) Detects and returns cycles of the given molecule that are isolated (spiro rings included or not according to the boolean parameter), isomorphic to the circular sugar patterns, and only have exocyclic single bonds (keto groups ignored or not according to the boolean parameter).protected booleandoesRingHaveEnoughExocyclicOxygenAtoms(int numberOfAtomsInRing, int numberOfAttachedExocyclicOxygenAtoms) Simple decision-making function for deciding whether a candidate sugar ring has enough attached, single-bonded exocyclic oxygen atoms according to the set threshold.protected voidflagTooSmallDisconnectedPartsToPreserve(IAtomContainer moleculeParam) Checks the given input molecule for unconnected parts that would be cleared away after sugar removal, in order to add a flag to the atoms of these parts to be able to preserve them in the later removal.protected StringgenerateSubstructureIdentifier(IAtomContainer substructure) Creates an identifier string for substructures of a molecule, based on the unique indices of the included atoms.getCircularSugarCandidates(IAtomContainer moleculeParam) Extracts circular sugar moieties from the given molecule, according to the current settings for circular sugar detection.Returns a list of atom containers representing the circular sugar structures an input molecule is scanned for in circular sugar detection.protected intgetExocyclicOxygenAtomCount(IAtomContainer ringToTest, IAtomContainer originalMolecule) Returns the number of attached exocyclic oxygen atoms of a given ring in the original atom container.doubleReturns the currently set minimum ratio of attached, exocyclic, single-bonded oxygen atoms to the number of atoms in the candidate circular sugar structure to reach in order to be classified as a sugar moiety if the number of exocyclic oxygen atoms should be evaluated.intReturns the currently set maximum number of carbon atoms a linear sugar candidate can have in order to be detected as a sugar moiety (and subsequently be removed).intReturns the currently set minimum number of carbon atoms a linear sugar candidate must have in order to be detected as a sugar moiety (and subsequently be removed).getLinearSugarCandidates(IAtomContainer moleculeParam) Extracts linear sugar moieties from the given molecule, according to the current settings for linear sugar detection.Returns a list of atom containers representing the linear sugar structures an input molecule is scanned for in linear sugar detection.intgetNumberOfCircularAndLinearSugars(IAtomContainer moleculeParam) Detects circular and linear sugar moieties in the given molecule according to the current settings for circular and linear sugar detection and returns the number of detected moieties.intgetNumberOfCircularSugars(IAtomContainer moleculeParam) Detects circular sugar moieties in the given molecule according to the current settings for circular sugar detection and returns the number of detected moieties.intgetNumberOfLinearSugars(IAtomContainer moleculeParam) Detects linear sugar moieties in the given molecule according to the current settings for linear sugar detection and returns the number of detected moieties.Returns the current setting for how to determine whether a substructure that gets disconnected from the molecule during the removal of a sugar moiety should be preserved or can get removed along with the sugar.intReturns the current threshold of e.g. molecular weight or heavy atom count (depending on the currently set preservation mode) a substructure that gets disconnected from the molecule by the removal of a sugar moiety has to reach in order to be preserved and not discarded.booleanhasCircularOrLinearSugars(IAtomContainer moleculeParam) Detects circular and linear sugar moieties in the given molecule, according to the current settings for sugar detection.booleanhasCircularSugars(IAtomContainer moleculeParam) Detects circular sugar moieties in the given molecule, according to the current settings for circular sugar detection.protected booleanhasGlycosidicBond(IAtomContainer ringToTest, IAtomContainer originalMolecule) Checks all exocyclic connections of the given ring to detect an O-glycosidic bond.booleanhasLinearSugars(IAtomContainer moleculeParam) Detects linear sugar moieties in the given molecule, according to the current settings for linear sugar detection.protected booleanisMoleculeEmptyAfterRemovalOfThisRing(IAtomContainer ringParam, IAtomContainer moleculeParam) Checks whether the given molecule would be empty after removal of the given ring.booleanisQualifiedForGlycosidicBondExemption(IAtomContainer moleculeParam) Tests whether the given molecule qualifies for the glycosidic bond exemption.protected booleanisTerminal(IAtomContainer substructure, IAtomContainer parentMolecule, List<IAtomContainer> candidateList) Checks whether the given substructure is terminal (i.e. it can be removed without producing multiple unconnected structures in the remaining molecule) in the given parent molecule.protected booleanisTooSmallToPreserve(IAtomContainer moleculeParam) Checks whether the given molecule or structure is too small to be kept according to the current preservation mode and threshold setting.removeAndReturnCircularAndLinearSugars(IAtomContainer moleculeParam) Removes circular and linear sugar moieties from the given atom container and returns the resulting aglycone (at list index 0) and the removed sugar moieties (this operation modifies the given atom container, so clone the object beforehand if you need to preserve its original structure!).removeAndReturnCircularSugars(IAtomContainer moleculeParam) Removes circular sugar moieties from the given atom container and returns the resulting aglycone (at list index 0) and the removed circular sugar moieties (this operation modifies the given atom container, so clone the object beforehand if you need to preserve its original structure!).removeAndReturnLinearSugars(IAtomContainer moleculeParam) Removes linear sugar moieties from the given atom container and returns the resulting aglycone (at list index 0) and the removed linear sugar moieties (this operation modifies the given atom container, so clone the object beforehand if you need to preserve its original structure!).protected voidremoveAtomsOfCircularSugarsFromCandidates(List<IAtomContainer> candidateList, IAtomContainer parentMolecule) Removes all atoms belonging to possible circular sugars, as returned by the method for initial circular sugar detection, from the given linear sugar candidates.booleanremoveCircularAndLinearSugars(IAtomContainer moleculeParam) Removes circular and linear sugar moieties from the given atom container (this operation modifies the given atom container, so clone the object beforehand if you need to preserve its original structure!).booleanremoveCircularSugarFromPatternsList(String smilesCode) Allows to remove a sugar ring pattern (represented as SMILES string) from the list of circular sugar structures an input molecule is scanned for in circular sugar detection.booleanremoveCircularSugarFromPatternsList(IAtomContainer circularSugar) Allows to remove a sugar ring from the list of circular sugar structures an input molecule is scanned for in circular sugar detection.booleanremoveCircularSugars(IAtomContainer moleculeParam) Removes circular sugar moieties from the given atom container (this operation modifies the given atom container, so clone the object beforehand if you need to preserve its original structure!).protected voidremoveCyclicAtomsFromSugarCandidates(List<IAtomContainer> candidateList, IAtomContainer moleculeParam) Removes all atoms that are part of a cycle from the given linear sugar candidates.booleanremoveLinearSugarFromPatternsList(String smilesCode) Allows to remove a linear sugar pattern (represented as SMILES string) from the list of linear sugar structures an input molecule is scanned for in linear sugar detection.booleanremoveLinearSugarFromPatternsList(IAtomContainer linearSugar) Allows to remove a linear sugar pattern from the list of linear sugar structures an input molecule is scanned for in linear sugar detection.booleanremoveLinearSugars(IAtomContainer moleculeParam) Removes linear sugar moieties from the given atom container (this operation modifies the given atom container, so clone the object beforehand if you need to preserve its original structure!).protected List<IAtomContainer> removeSugarCandidates(IAtomContainer moleculeParam, List<IAtomContainer> candidateList) Removes the given sugar moieties (or substructures in general) from the given molecule and returns the removed moieties (not the aglycone!).protected List<IAtomContainer> removeTooSmallAndTooLargeCandidates(List<IAtomContainer> candidateList) Discards all linear sugar candidates that are too small or too big according to the current settings.protected voidremoveTooSmallDisconnectedStructures(IAtomContainer moleculeParam) Removes all unconnected fragments that are too small to keep according to the current preservation mode and threshold setting.voidSets all settings to their default values (see public static constants or enquire via get/is methods).voidSets the option to only detect (and subsequently remove) circular sugars that have a sufficient number of attached, exocyclic, single-bonded oxygen atoms.voidsetDetectCircularSugarsOnlyWithOGlycosidicBondSetting(boolean bool) Sets the option to only detect (and subsequently remove) circular sugar moieties that are attached to the parent structure or other sugar moieties via an O-glycosidic bond.voidsetDetectCircularSugarsWithKetoGroupsSetting(boolean bool) Sets the option to detect potential sugar cycles with keto groups as circular sugars in circular sugar detection.voidsetDetectLinearAcidicSugarsSetting(boolean bool) Sets the option to include linear acidic sugar patterns in the linear sugar structures used for initial detection of linear sugars in a given molecule.voidsetDetectLinearSugarsInRingsSetting(boolean bool) Sets the option to detect linear sugar structures that are part of a ring.voidsetDetectSpiroRingsAsCircularSugarsSetting(boolean bool) Sets the option to include spiro rings in the initial set of detected rings considered for circular sugar detection.booleansetExocyclicOxygenAtomsToAtomsInRingRatioThresholdSetting(double threshold) Sets the minimum ratio of attached, exocyclic, single-bonded oxygen atoms to the number of atoms in the candidate circular sugar structure to reach in order to be classified as a sugar moiety if the number of exocyclic oxygen atoms should be evaluated.voidsetLinearSugarCandidateMaxSizeSetting(int maxSize) Sets the maximum number of carbon atoms a linear sugar candidate can have in order to be detected as a sugar moiety (and subsequently be removed).voidsetLinearSugarCandidateMinSizeSetting(int minSize) Sets the minimum number of carbon atoms a linear sugar candidate must have in order to be detected as a sugar moiety (and subsequently be removed).voidSets the preservation mode for structures that get disconnected by sugar removal and the preservation mode threshold is set to the default value of the given enum constant.voidsetPreservationModeThresholdSetting(int threshold) Sets the preservation mode threshold, i.e. the molecular weight or heavy atom count (depending on the currently set preservation mode) a substructure that gets disconnected from the molecule during the removal of a sugar moiety has to reach in order to be kept and not removed along with the sugar.voidsetRemoveOnlyTerminalSugarsSetting(boolean bool) Sets the option to remove only terminal sugar moieties, i.e. those that when removed do not cause a split of the remaining molecular structure into two or more disconnected substructures.protected List<IAtomContainer> splitEtherEsterAndPeroxideBondsExtraction(List<IAtomContainer> candidateList) Splits all ether, ester, and peroxide bonds in the given linear sugar candidates and separates those that get disconnected in the process.protected voidAll linear sugar patterns represented by atom containers in the respective list are sorted, parsed into actual pattern objects, and stored in the internal list for initial linear sugar detection.
-
Field Details
-
O_GLYCOSIDIC_BOND_CIRCULAR_SUGARS_SMARTS
SMARTS pattern for detecting glycosidic bonds (ether bonds) between circular sugar moieties for postprocessing after extraction. Defines an aliphatic C in a ring with degree 3 or 4 and no charge, connected to an aliphatic O not in a ring with degree 2 and no charge, connected to an aliphatic C with no charge (this side is left more promiscuous for matching cases like linear sugars connected to circular sugars or some corner cases).- See Also:
-
ESTER_BOND_CIRCULAR_SUGARS_SMARTS
SMARTS pattern for detecting ester bonds between circular sugar moieties for postprocessing after extraction. Defines an aliphatic C in a ring with degree 3 or 4 and no charge, connected to a carbonyl oxygen (environment) and to another oxygen atom via a non-ring bond, which is connected in turn to another aliphatic carbon atom (this side is left more promiscuous for matching cases like linear sugars connected to circular sugars or some corner cases).- See Also:
-
PEROXIDE_BOND_CIRCULAR_SUGARS_SMARTS
SMARTS pattern for detecting peroxide bonds between circular sugar moieties for postprocessing after extraction. Defines an aliphatic C in a ring with degree 3 or 4 and no charge, connected to an oxygen atom via a non-ring bond, which is connected in turn to another oxygen atom and that to another aliphatic carbon atom (this side is left more promiscuous for matching cases like linear sugars connected to circular sugars or some corner cases).- See Also:
-
ESTER_BOND_LINEAR_SUGARS_SMARTS
SMARTS pattern for detecting ester bonds between linear sugar moieties for postprocessing after extraction. Defines an aliphatic C not in a ring, with no charge, connected to a carbonyl oxygen (environment) and to another oxygen atom via a non-ring bond, which is connected in turn to another aliphatic carbon atom.- See Also:
-
CROSS_LINKING_ETHER_BOND_LINEAR_SUGARS_SMARTS
SMARTS pattern for detecting cross-linking ether bonds between linear sugar moieties for postprocessing after extraction. Defines an aliphatic C not in a ring, with no charge, connected to the ether oxygen atom via a non-ring bond, which is connected in turn to another aliphatic carbon atom that also has a hydroxy group connected to it (to define the cross-linking nature).- See Also:
-
ETHER_BOND_LINEAR_SUGARS_SMARTS
SMARTS pattern for detecting ether bonds between linear sugar moieties for postprocessing after extraction. Defines an aliphatic C not in a ring, with no charge, connected to an oxygen atom via a non-ring bond, which is connected in turn to another aliphatic carbon atom.- See Also:
-
PEROXIDE_BOND_LINEAR_SUGARS_SMARTS
SMARTS pattern for detecting peroxide bonds between linear sugar moieties for postprocessing after extraction. Defines an aliphatic C not in a ring, with no charge, connected to an oxygen atom via a non-ring bond, which is connected in turn to another oxygen atom and that to another aliphatic carbon atom.- See Also:
-
EXTRACT_CIRCULAR_SUGARS_DEFAULT
public static final boolean EXTRACT_CIRCULAR_SUGARS_DEFAULTDefault for extractCircularSugars parameter in copyAndExtractAglyconeAndSugars methods.- See Also:
-
EXTRACT_LINEAR_SUGARS_DEFAULT
public static final boolean EXTRACT_LINEAR_SUGARS_DEFAULTDefault for extractLinearSugars parameter in copyAndExtractAglyconeAndSugars methods.- See Also:
-
MARK_ATTACH_POINTS_BY_R_DEFAULT
public static final boolean MARK_ATTACH_POINTS_BY_R_DEFAULTDefault for markAttachPointsByR parameter in copyAndExtractAglyconeAndSugars methods.- See Also:
-
POST_PROCESS_SUGARS_DEFAULT
public static final boolean POST_PROCESS_SUGARS_DEFAULTDefault for postProcessSugars parameter in copyAndExtractAglyconeAndSugars methods.- See Also:
-
LIMIT_POST_PROCESSING_BY_SIZE_DEFAULT
public static final boolean LIMIT_POST_PROCESSING_BY_SIZE_DEFAULTDefault for limitPostProcessingBySize parameter in copyAndExtractAglyconeAndSugars methods.- See Also:
-
-
Constructor Details
-
SugarDetectionUtility
Sole constructor of this class. All settings are set to their default values as declared in theSugarRemovalUtilityclass.- Parameters:
builder- IChemObjectBuilder for i.a. parsing SMILES strings of sugar patterns into atom containers
-
-
Method Details
-
copyAndExtractAglyconeAndSugars
Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).This method creates a deep copy of the input molecule and removes circular sugar moieties to produce an aglycone. It then creates a second copy to extract the sugar fragments that were removed. The attachment points between the aglycone and sugars are saturated with implicit hydrogen atoms. No postprocessing of the sugar fragments is performed, i.e. they are not separated from each other if they are connected in the original structure. Check the overloaded versions of this method for more options.
The method preserves stereochemistry information at connection points and handles glycosidic bonds appropriately. When bonds are broken between sugar moieties and the aglycone, connecting heteroatoms (such as glycosidic oxygen, nitrogen, or sulfur atoms) are copied to both the aglycone and sugar fragments to maintain chemical validity.
The extraction process respects all current sugar detection settings as described in
SugarRemovalUtility, including terminal vs. non-terminal sugar removal, preservation mode settings, various detection thresholds, etc.Note that atom types are not copied, they have to be re-perceived if needed.
- Parameters:
mol- The input molecule to separate into aglycone and sugar components. Must not be null but can be empty; a list containing only the empty given atom container is returned in the latter case.- Returns:
- A list of atom containers where the first element is the aglycone (copy molecule with sugars removed) and subsequent elements are the individual sugar fragments that were extracted (also copies). If no sugars were detected or removed, returns a list containing only a copy of the original molecule. Sugar fragments may be disconnected from each other if they were not directly linked in the original structure.
- Throws:
NullPointerException- if the input molecule is null- See Also:
-
copyAndExtractAglyconeAndSugars
public List<IAtomContainer> copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).This method creates a deep copy of the input molecule and removes circular and/or linear sugar moieties to produce an aglycone. It then creates a second copy to extract the sugar fragments that were removed. The attachment points between the aglycone and sugars are saturated with implicit hydrogen atoms. No postprocessing of the sugar fragments is performed, i.e. they are not separated from each other if they are connected in the original structure. Check the overloaded versions of this method for more options.
The method preserves stereochemistry information at connection points and handles glycosidic bonds appropriately. When bonds are broken between sugar moieties and the aglycone, connecting heteroatoms (such as glycosidic oxygen, nitrogen, or sulfur atoms) are copied to both the aglycone and sugar fragments to maintain chemical validity.
The extraction process respects all current sugar detection settings as described in
SugarRemovalUtility, including terminal vs. non-terminal sugar removal, preservation mode settings, various detection thresholds, etc.Note that atom types are not copied, they have to be re-perceived if needed.
- Parameters:
mol- The input molecule to separate into aglycone and sugar components. Must not be null but can be empty; a list containing only the empty given atom container is returned in the latter case.extractCircularSugars- If true, circular sugar moieties will be detected and extracted according to current settings.extractLinearSugars- If true, linear sugar moieties will be detected and extracted according to current settings.- Returns:
- A list of atom containers where the first element is the aglycone (copy molecule with sugars removed) and subsequent elements are the individual sugar fragments that were extracted (also copies). If no sugars were detected or removed, returns a list containing only a copy of the original molecule. Sugar fragments may be disconnected from each other if they were not directly linked in the original structure.
- Throws:
NullPointerException- if the input molecule is null- See Also:
-
copyAndExtractAglyconeAndSugars
public List<IAtomContainer> copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).This method creates a deep copy of the input molecule and removes circular and/or linear sugar moieties to produce an aglycone. It then creates a second copy to extract the sugar fragments that were removed. The attachment points between the aglycone and sugars are handled by either adding R-groups (pseudo atoms) or implicit hydrogen atoms to saturate the broken bonds. No postprocessing of the sugar fragments is performed, i.e. they are not separated from each other if they are connected in the original structure. Check the overloaded versions of this method for more options.
The method preserves stereochemistry information at connection points and handles glycosidic bonds appropriately. When bonds are broken between sugar moieties and the aglycone, connecting heteroatoms (such as glycosidic oxygen, nitrogen, or sulfur atoms) are copied to both the aglycone and sugar fragments to maintain chemical validity.
The extraction process respects all current sugar detection settings as described in
SugarRemovalUtility, including terminal vs. non-terminal sugar removal, preservation mode settings, various detection thresholds, etc.Note that atom types are not copied, they have to be re-perceived if needed.
- Parameters:
mol- The input molecule to separate into aglycone and sugar components. Must not be null but can be empty; a list containing only the empty given atom container is returned in the latter case.extractCircularSugars- If true, circular sugar moieties will be detected and extracted according to current settings.extractLinearSugars- If true, linear sugar moieties will be detected and extracted according to current settings.markAttachPointsByR- If true, attachment points where sugars and the aglycone were connected are marked with R-groups (pseudo atoms). If false, implicit hydrogen atoms are added to saturate the connections.- Returns:
- A list of atom containers where the first element is the aglycone (copy molecule with sugars removed) and subsequent elements are the individual sugar fragments that were extracted (also copies). If no sugars were detected or removed, returns a list containing only a copy of the original molecule. Sugar fragments may be disconnected from each other if they were not directly linked in the original structure.
- Throws:
NullPointerException- if the input molecule is null- See Also:
-
copyAndExtractAglyconeAndSugars
public List<IAtomContainer> copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR, boolean postProcessSugars) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).This method creates a deep copy of the input molecule and removes circular and/or linear sugar moieties to produce an aglycone. It then creates a second copy to extract the sugar fragments that were removed. The attachment points between the aglycone and sugars are handled by either adding R-groups (pseudo atoms) or implicit hydrogen atoms to saturate the broken bonds. Optionally, postprocessing of the sugar fragments is performed, i.e. they are separated from each other if they are connected in the original structure via O-glycosidic (ether), ester, or peroxide bonds. Check the overloaded versions of this method for more options.
The method preserves stereochemistry information at connection points and handles glycosidic bonds appropriately. When bonds are broken between sugar moieties and the aglycone, connecting heteroatoms (such as glycosidic oxygen, nitrogen, or sulfur atoms) are copied to both the aglycone and sugar fragments to maintain chemical validity.
The extraction process respects all current sugar detection settings as described in
SugarRemovalUtility, including terminal vs. non-terminal sugar removal, preservation mode settings, various detection thresholds, etc.Note that atom types are not copied, they have to be re-perceived if needed.
- Parameters:
mol- The input molecule to separate into aglycone and sugar components. Must not be null but can be empty; a list containing only the empty given atom container is returned in the latter case.extractCircularSugars- If true, circular sugar moieties will be detected and extracted according to current settings.extractLinearSugars- If true, linear sugar moieties will be detected and extracted according to current settings.markAttachPointsByR- If true, attachment points where sugars and the aglycone were connected are marked with R-groups (pseudo atoms). If false, implicit hydrogen atoms are added to saturate the connections.postProcessSugars- If true, postprocessing of sugar fragments is performed, i.e. splitting O-glycosidic (ether), ester, and peroxide bonds between sugar moieties- Returns:
- A list of atom containers where the first element is the aglycone (copy molecule with sugars removed) and subsequent elements are the individual sugar fragments that were extracted (also copies). If no sugars were detected or removed, returns a list containing only a copy of the original molecule. Sugar fragments may be disconnected from each other if they were not directly linked in the original structure or were disconnected in postprocessing.
- Throws:
NullPointerException- if the input molecule is null- See Also:
-
copyAndExtractAglyconeAndSugars
public List<IAtomContainer> copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR, boolean postProcessSugars, boolean limitPostProcessingBySize) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).This method creates a deep copy of the input molecule and removes circular and/or linear sugar moieties to produce an aglycone. It then creates a second copy to extract the sugar fragments that were removed. The attachment points between the aglycone and sugars are handled by either adding R-groups (pseudo atoms) or implicit hydrogen atoms to saturate the broken bonds. Optionally, postprocessing of the sugar fragments is performed, i.e. they are separated from each other if they are connected in the original structure via O-glycosidic (ether), ester, or peroxide bonds. Optionally, this postprocessing is limited by size, i.e. sugars and their substituents are only split if both resulting parts are larger than the set preservation mode threshold for circular sugars and the minimum size for linear sugar candidates, respectively, to prevent smaller substituents being split off of the sugars. Check the overloaded versions of this method for more options.
The method preserves stereochemistry information at connection points and handles glycosidic bonds appropriately. When bonds are broken between sugar moieties and the aglycone, connecting heteroatoms (such as glycosidic oxygen, nitrogen, or sulfur atoms) are copied to both the aglycone and sugar fragments to maintain chemical validity.
The extraction process respects all current sugar detection settings as described in
SugarRemovalUtility, including terminal vs. non-terminal sugar removal, preservation mode settings, various detection thresholds, etc.Note that atom types are not copied, they have to be re-perceived if needed.
- Parameters:
mol- The input molecule to separate into aglycone and sugar components. Must not be null but can be empty; a list containing only the empty given atom container is returned in the latter case.extractCircularSugars- If true, circular sugar moieties will be detected and extracted according to current settings.extractLinearSugars- If true, linear sugar moieties will be detected and extracted according to current settings.markAttachPointsByR- If true, attachment points where sugars and the aglycone were connected are marked with R-groups (pseudo atoms). If false, implicit hydrogen atoms are added to saturate the connections.postProcessSugars- If true, postprocessing of sugar fragments is performed, i.e. splitting O-glycosidic (ether), ester, and peroxide bonds between sugar moietieslimitPostProcessingBySize- If true, sugar moieties will only be separated/split in postprocessing if they are larger than the set preservation mode threshold (seeSugarRemovalUtility). This is to prevent smaller substituents like, e.g. methyl ethers, being separated from the sugars. For linear sugars, the minimum size for linear sugar candidates is applied as a criterion.- Returns:
- A list of atom containers where the first element is the aglycone (copy molecule with sugars removed) and subsequent elements are the individual sugar fragments that were extracted (also copies). If no sugars were detected or removed, returns a list containing only a copy of the original molecule. Sugar fragments may be disconnected from each other if they were not directly linked in the original structure or were disconnected in postprocessing.
- Throws:
NullPointerException- if the input molecule is null- See Also:
-
copyAndExtractAglyconeAndSugars
public List<IAtomContainer> copyAndExtractAglyconeAndSugars(IAtomContainer mol, boolean extractCircularSugars, boolean extractLinearSugars, boolean markAttachPointsByR, boolean postProcessSugars, boolean limitPostProcessingBySize, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IBond, IBond> inputBondToBondCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap) Extracts copies of the aglycone and sugar parts of the given molecule (if there are any).This method creates a deep copy of the input molecule and removes circular and/or linear sugar moieties to produce an aglycone. It then creates a second copy to extract the sugar fragments that were removed. The attachment points between the aglycone and sugars are handled by either adding R-groups (pseudo atoms) or implicit hydrogen atoms to saturate the broken bonds. Optionally, postprocessing of the sugar fragments is performed, i.e. they are separated from each other if they are connected in the original structure via O-glycosidic (ether), ester, or peroxide bonds. Optionally, this postprocessing is limited by size, i.e. sugars and their substituents are only split if both resulting parts are larger than the set preservation mode threshold for circular sugars and the minimum size for linear sugar candidates, respectively, to prevent smaller substituents being split off of the sugars.
The method preserves stereochemistry information at connection points and handles glycosidic bonds appropriately. When bonds are broken between sugar moieties and the aglycone, connecting heteroatoms (such as glycosidic oxygen, nitrogen, or sulfur atoms) are copied to both the aglycone and sugar fragments to maintain chemical validity.
The extraction process respects all current sugar detection settings as described in
SugarRemovalUtility, including terminal vs. non-terminal sugar removal, preservation mode settings, various detection thresholds, etc.Note that atom types are not copied, they have to be re-perceived if needed.
This method additionally gives you the option to supply four maps as parameters that will be filled with a mapping of atoms and bonds in the original molecule to the atoms and bonds in the aglycone and sugar copies. They should be of sufficient size and empty when given.
- Parameters:
mol- The input molecule to separate into aglycone and sugar components. Must not be null but can be empty; a list containing only the empty given atom container is returned in the latter case.extractCircularSugars- If true, circular sugar moieties will be detected and extracted according to current settings.extractLinearSugars- If true, linear sugar moieties will be detected and extracted according to current settings.markAttachPointsByR- If true, attachment points where sugars and the aglycone were connected are marked with R-groups (pseudo atoms). If false, implicit hydrogen atoms are added to saturate the connections.postProcessSugars- If true, postprocessing of sugar fragments is performed, i.e. splitting O-glycosidic (ether), ester, and peroxide bonds between sugar moietieslimitPostProcessingBySize- If true, sugar moieties will only be separated/split in postprocessing if they are larger than the set preservation mode threshold (seeSugarRemovalUtility). This is to prevent smaller substituents like, e.g. methyl ethers, being separated from the sugars. For linear sugars, the minimum size for linear sugar candidates is applied as a criterion.inputAtomToAtomCopyInAglyconeMap- Map to be filled with mappings from original atoms to their copies in the aglycone. Can be null (a new map will be created) but should be an empty map with sufficient capacity.inputBondToBondCopyInAglyconeMap- Map to be filled with mappings from original bonds to their copies in the aglycone. Can be null (a new map will be created) but should be an empty map with sufficient capacity.inputAtomToAtomCopyInSugarsMap- Map to be filled with mappings from original atoms to their copies in the sugar fragments. Can be null (a new map will be created) but should be an empty map with sufficient capacity.inputBondToBondCopyInSugarsMap- Map to be filled with mappings from original bonds to their copies in the sugar fragments. Can be null (a new map will be created) but should be an empty map with sufficient capacity.- Returns:
- A list of atom containers where the first element is the aglycone (copy molecule with sugars removed) and subsequent elements are the individual sugar fragments that were extracted (also copies). If no sugars were detected or removed, returns a list containing only a copy of the original molecule. Sugar fragments may be disconnected from each other if they were not directly linked in the original structure or were disconnected in postprocessing.
- Throws:
NullPointerException- if the input molecule is null- See Also:
-
getAtomIndicesOfGroup
public int[] getAtomIndicesOfGroup(IAtomContainer mol, IAtomContainer group, Map<IAtom, IAtom> inputAtomToAtomCopyMap) Returns the indices of atoms in the input molecule that correspond to atoms in the given group.This method iterates through all atoms in the input molecule and checks if the corresponding atom (via the provided mapping) exists in the group container. The indices of matching atoms are collected and returned as an array.
Note that the group may contain atoms that are not present in the input molecule mapping (e.g., R-groups added during processing), which will be ignored.
- Parameters:
mol- The input molecule containing the original atomsgroup- The group container to check for atom membership, e.g. extracted sugar or aglyconeinputAtomToAtomCopyMap- Map of original atoms to their copies in the group- Returns:
- Array of atom indices in the input molecule that have corresponding atoms in the group. Returns empty array if no matching atoms are found or if the group is empty.
- Throws:
NullPointerException- if any of the parameters is null
-
getBondIndicesOfGroup
public int[] getBondIndicesOfGroup(IAtomContainer mol, IAtomContainer group, Map<IBond, IBond> inputBondToBondCopyMap) Returns the indices of bonds in the input molecule that correspond to bonds in the given group.This method iterates through all bonds in the input molecule and checks if the corresponding bond (via the provided mapping) exists in the group container. The indices of matching bonds are collected and returned as an array.
Note that the group may contain bonds that are not present in the input molecule mapping (e.g., bonds to R-groups added during processing), which will be ignored.
- Parameters:
mol- The input molecule containing the original bondsgroup- The group container to check for bond membership, e.g. extracted sugar or aglyconeinputBondToBondCopyMap- Map from original bonds to their copies in the group- Returns:
- Array of bond indices in the input molecule that have corresponding bonds in the group. Returns empty array if no matching bonds are found or if the group is empty.
- Throws:
NullPointerException- if any of the parameters is null
-
getGroupIndicesForAllAtoms
public int[] getGroupIndicesForAllAtoms(IAtomContainer mol, List<IAtomContainer> aglyconeAndSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap) Assigns group indices to all atoms in the input molecule based on their membership in the aglycone or sugar fragments.This method iterates through the atoms of the input molecule and determines which group (aglycone or sugar fragment) each atom belongs to. The group indices are assigned as follows:
- Index 0 corresponds to the aglycone.
- Indices 1 and above correspond to individual sugar fragments.
- Atoms not belonging to any group are assigned an index of -1 (should actually not happen).
This allows you to, for example, generate SMILES strings with glycosidic moiety annotations and depictions with glycosidic moiety highlights, e.g.:
(Check out the "Color Map" option on the CDK depict web app).Map<IAtom, IAtom> inputAtomToAglyconeAtomMap = new HashMap<IAtom, IAtom>((int) ((mol.getAtomCount() / 0.75f) + 2), 0.75f); Map<IAtom, IAtom> inputAtomToSugarAtomMap = new HashMap<IAtom, IAtom>((int) ((mol.getAtomCount() / 0.75f) + 2), 0.75f); List<IAtomContainer> aglyconeAndSugarsList = sdu.copyAndExtractAglyconeAndSugars( molecule, true, false, false, true, true, inputAtomToAglyconeAtomMap, new HashMap<IBond, IBond>((int) ((mol.getAtomCount() / 0.75f) + 2), 0.75f), inputAtomToSugarAtomMap, new HashMap<IBond, IBond>((int) ((mol.getAtomCount() / 0.75f) + 2), 0.75f)); int[] groupIndices = sdu.getGroupIndicesForAllAtoms(mol, aglyconeAndSugarsList, inputAtomToAglyconeAtomMap, inputAtomToSugarAtomMap); for (IAtom atom : mol.atoms()) { atom.setMapIdx(groupIndices[atom.getIndex()] + 1); } String smi = new SmilesGenerator(SmiFlavor.Isomeric | SmiFlavor.AtomAtomMap).create(mol); //example output (for Fusacandin B (CNP0295326.4)): // [CH3:1][CH2:1][CH2:1][CH2:1][CH2:1]/[CH:1]=[CH:1]/[CH:1]=[CH:1]/[C@@H:1]([OH:1])[CH2:1]/[CH:1]=[CH:1]/[CH:1]=[CH:1]/[C:1](=[O:1])[O:1][CH:1]1[CH:1]([OH:1])[C@H:1]([C:1]2=[C:1]([OH:1])[CH:1]=[C:1]([OH:1])[CH:1]=[C:1]2[CH2:1][OH:1])[O:1][C@H:1]([CH2:1][OH:1])[C@H:1]1[O:2][C@@H:2]3[O:2][CH:2]([CH2:2][OH:2])[C@H:2]([OH:2])[C@H:2]([OH:2])[CH:2]3[O:3][C@@H:3]4[O:3][CH:3]([CH2:3][OH:3])[C@H:3]([OH:3])[C@H:3]([OH:3])[CH:3]4[OH:3]The method uses the provided atom-to-atom copy maps to identify the correspondence between atoms in the input molecule and the aglycone/sugar fragments.
Note that connecting hetero atoms between the aglycone and a sugar moiety are duplicated in the extraction process but will be assigned to only one of the two structures here.
- Parameters:
mol- The input molecule containing all atoms to be indexed. Must not be null or empty.aglyconeAndSugars- A list of atom containers representing the aglycone (index 0) and sugar fragments (indices 1+). Must not be null or empty.inputAtomToAtomCopyInAglyconeMap- A map linking atoms in the input molecule to their corresponding atoms in the aglycone. Must not be null.inputAtomToAtomCopyInSugarsMap- A map linking atoms in the input molecule to their corresponding atoms in the sugar fragments. Must not be null.- Returns:
- An array of integers where each index corresponds to an atom in the input molecule, and the value at that index represents the group index (0 for aglycone, 1+ for sugar fragments, -1 for unassigned atoms). Returns an empty array if the input molecule or aglyconeAndSugars list is empty, or if no groups are identified.
- Throws:
NullPointerException- If any of the input parameters is null.
-
deeperCopy
protected IAtomContainer deeperCopy(IAtomContainer mol, Map<IAtom, IAtom> origToCopyAtomMap, Map<IBond, IBond> origToCopyBondMap) Creates a relatively deep ("deeper" than cloning but not as extensive) copy of the given atom container mol and fills the given maps with a mapping of the original atoms and bonds to the atoms and bonds in the copy. Copies:
- Atoms (atomic number, implicit hydrogen count, aromaticity flag, valency, atom type name, formal charge, some primitive-based properties)
- Bonds (begin and end atom, order, aromaticity flag, stereo, display, in ring flag, some primitive-based properties)
- Single electrons
- Lone pairs
- Stereo elements (mapped to the copied atoms and bonds)
- Some primitive-based properties (String, Integer, Boolean)
Note: atom types of the original atoms are not copied and hence, some properties will be unset in the copies. If you need atom types and their defining properties, you need to re-perceive them after copying.- Parameters:
mol- the molecule to copyorigToCopyAtomMap- empty map to fill with a mapping of the original atoms to the copied atomsorigToCopyBondMap- empty map to fill with a mapping of the original bonds to the copied bonds- Returns:
- a relatively deep copy of the given atom container
-
deeperCopy
Creates a relatively deep ("deeper" than cloning but not as extensive) copy of the given atom and adds it to the given container. Copies:
- atomic number
- implicit hydrogen count
- aromaticity flag
- valency
- atom type name
- formal charge
- point 2D and 3D coordinates
- flags
- some primitive-based properties (String, Integer, Boolean)
Note: atom types and isotopes of the original atoms are not copied and hence, some properties will be unset in the copies. If you need atom types and their defining properties, you need to re-perceive them after copying.- Parameters:
atom- the atom to copycontainer- the container to add the copied atom to- Returns:
- the copied atom
-
deeperCopy
Creates a relatively deep ("deeper" than cloning but not as extensive) copy of the given bond between the given begin and end atoms. Copies:
- order
- aromaticity flag
- stereo
- display
- in ring flag
- flags
- electron count
- some primitive-based properties (String, Integer, Boolean)
Note: The begin and end atoms are not copied, but the given ones are used in the copy.
Note also: the created bond must be added to the copy atom container by the calling code!- Parameters:
bond- the bond to copybegin- the begin atom of the bond in the copy(!)end- the end atom of the bond in the copy(!)- Returns:
- the copied bond
-
isHeteroAtom
Checks whether the given atom is a hetero-atom (i.e. non-carbon and non-hydrogen). Pseudo (R) atoms will also return false.- Parameters:
atom- the atom to test- Returns:
- true if the given atom is neither a carbon nor a hydrogen or pseudo atom
-
isPseudoAtom
Checks whether the given atom is a pseudo atom. Very strict, any atom whose atomic number is null or 0, whose symbol equals "R" or "*", or that is an instance of an IPseudoAtom implementing class will be classified as a pseudo atom.- Parameters:
atom- the atom to test- Returns:
- true if the given atom is identified as a pseudo (R) atom
-
isCarbonAtom
Checks whether the given atom is a carbon atom.- Parameters:
atom- the atom to test- Returns:
- true if the given atom is a carbon atom
-
preprocessSugarRemovalResults
protected void preprocessSugarRemovalResults(IAtomContainer mol, IAtomContainer copyForAglycone, IAtomContainer copyForSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IBond, IBond> inputBondToBondCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap) Preprocesses the results of sugar removal to correct special cases where the separation was not chemically optimal.The preprocessing handles the following cases:
- C6 carbon separation: Corrects cases where C6 carbon atoms of sugar moieties were incorrectly assigned to the aglycone instead of remaining with the sugar fragment.
- Carboxy group separation: Moves entire carboxy groups (sugar-C(=O)-O-aglycone) from the aglycone to the sugar fragment.
The method identifies problematic cases by examining bonds that were broken during sugar removal (bonds between carbon atoms that are no longer present in either the aglycone or sugar copies). It then applies specific correction methods in this class. No checks are performed!
- Parameters:
mol- The original input molecule containing all atoms and bondscopyForAglycone- The aglycone fragment that may need correctioncopyForSugars- The sugar fragment that may receive corrected atoms/bondsinputAtomToAtomCopyInAglyconeMap- Map from original atoms to their copies in the aglycone fragmentinputBondToBondCopyInAglyconeMap- Map from original bonds to their copies in the aglycone fragmentinputAtomToAtomCopyInSugarsMap- Map from original atoms to their copies in the sugar fragmentinputBondToBondCopyInSugarsMap- Map from original bonds to their copies in the sugar fragment
-
correctC6Separation
protected void correctC6Separation(IAtomContainer mol, IAtomContainer copyForAglycone, IAtomContainer copyForSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap, IAtom aglyconeCarbon, IAtom aglyconeCarbonOriginalAtom, IBond bond) Corrects the separation of C6 carbon atoms that were incorrectly placed in the aglycone during sugar extraction.This method addresses cases where a C6 carbon atom of a sugar moiety was incorrectly assigned to the aglycone fragment instead of remaining with the sugar during extraction. This can happen when the sugar removal utility breaks bonds between sugar moieties and their substituents.
The correction process:
- Removes the misplaced carbon atom from the aglycone fragment
- Creates a copy of the original carbon atom and adds it to the sugar fragment
- Recreates the bond between the carbon and its connected sugar atom
- Updates the atom and bond mapping tables to reflect the changes
- Preserves stereochemistry information for the moved bond
This method is typically called during preprocessing when a carbon atom in the aglycone has only one connection, indicating it is likely a terminal carbon that should belong to a sugar moiety. No checks are performed!
- Parameters:
mol- The original input molecule containing all atoms and bondscopyForAglycone- The aglycone fragment from which the carbon atom will be removedcopyForSugars- The sugar fragment to which the carbon atom will be addedinputAtomToAtomCopyInSugarsMap- Map from original atoms to their copies in the sugar fragmentinputBondToBondCopyInSugarsMap- Map from original bonds to their copies in the sugar fragmentaglyconeCarbon- The carbon atom in the aglycone fragment to be movedaglyconeCarbonOriginalAtom- The original carbon atom from the input molecule corresponding to the atom to be movedbond- The bond between the carbon and the sugar fragment that needs to be recreated
-
correctCarboxyGroupSeparation
protected void correctCarboxyGroupSeparation(IAtomContainer mol, IAtomContainer copyForAglycone, IAtomContainer copyForSugars, Map<IAtom, IAtom> inputAtomToAtomCopyInAglyconeMap, Map<IBond, IBond> inputBondToBondCopyInAglyconeMap, Map<IAtom, IAtom> inputAtomToAtomCopyInSugarsMap, Map<IBond, IBond> inputBondToBondCopyInSugarsMap, IAtom aglyconeCarbon, IAtom aglyconeCarbonOriginalAtom, IAtom ketoOxygenInAglycone, IAtom etherOxygenInAglycone, IBond bond) Corrects the separation of carboxy groups that were incorrectly split between aglycone and sugar fragments during extraction.This method addresses cases where a carboxy group (sugar-C(=O)-O-aglycone) was incorrectly separated during sugar removal, with the formic acid ester remaining in the aglycone. To maintain chemical validity and keep functional groups intact, this method moves the entire carboxy group to the sugar fragment.
The correction process:
- Removes the carbonyl carbon and keto oxygen from the aglycone fragment
- Adds copies of both atoms to the sugar fragment
- Recreates the bonds within the carboxy group and to the connecting sugar atom
- Updates the atom and bond mapping tables to reflect the changes
- Preserves stereochemistry information for the moved bonds
This method is typically called during preprocessing to correct sugar removal results in special cases where functional groups are inadvertently split across fragments. No checks are performed!
- Parameters:
mol- The original input molecule containing all atoms and bondscopyForAglycone- The aglycone fragment from which the carboxy atoms will be removedcopyForSugars- The sugar fragment to which the carboxy atoms will be addedinputAtomToAtomCopyInAglyconeMap- Map from original atoms to their copies in the aglycone fragmentinputBondToBondCopyInAglyconeMap- Map from original bonds to their copies in the aglycone fragmentinputAtomToAtomCopyInSugarsMap- Map from original atoms to their copies in the sugar fragmentinputBondToBondCopyInSugarsMap- Map from original bonds to their copies in the sugar fragmentaglyconeCarbon- The carbonyl carbon atom in the aglycone fragment to be movedaglyconeCarbonOriginalAtom- The original carbonyl carbon atom from the input moleculeketoOxygenInAglycone- The keto oxygen atom in the aglycone fragment to be movedetherOxygenInAglycone- The ether oxygen atom in the aglycone fragmentbond- The bond between the carbonyl carbon and the sugar fragment that needs to be recreated
-
mapBondStereoElement
protected void mapBondStereoElement(IAtomContainer mol, IBond bond, IAtomContainer receivingContainer, Map<IAtom, IAtom> inputAtomToAtomCopyMap, Map<IBond, IBond> inputBondToBondCopyMap) Maps a stereo element from the original molecule (mol) to the receiving container (a copy of the former) if the specified bond is involved in it and all its components (focus and carriers) are part of the receiving container.This method searches for stereo elements in the original molecule that involve both atoms of the specified bond and maps them to the corresponding atoms and bonds in the receiving container. Only stereo elements where the focus atom and all carrier atoms/bonds are present in the receiving container will be mapped.
This is typically used during the sugar extraction process when atoms and bonds are moved between the aglycone and sugar fragments to ensure that stereochemistry information is preserved in the correct fragment.
The method performs the following checks before mapping a stereo element:
- The stereo element must contain both atoms of the specified bond
- The focus atom of the stereo element must be present in the receiving container
- All carrier atoms and bonds must be present in the receiving container
If all conditions are met, the stereo element is mapped using the provided atom and bond maps and added to the receiving container. No checks are performed!
- Parameters:
mol- The original molecule containing the stereo elements to be mappedbond- The bond whose associated stereo elements should be mappedreceivingContainer- The container that should receive the mapped stereo elementsinputAtomToAtomCopyMap- Map from original atoms to their copies in the receiving containerinputBondToBondCopyMap- Map from original bonds to their copies in the receiving container
-
saturate
protected void saturate(IAtom copyAtomToSaturate, IAtomContainer copyContainer, boolean markAttachPointsByR, IAtom originalAtom, IBond originalBond) Saturates a broken bond at an attachment point by either adding an R-group or increasing the implicit hydrogen count.This method is used during the sugar extraction process to handle attachment points where bonds between the aglycone and sugar moieties have been broken. No checks are performed!
- Parameters:
copyAtomToSaturate- The atom in the copy container that needs to be saturated due to a broken bondcopyContainer- The atom container containing the atom to be saturatedmarkAttachPointsByR- If true, an R-group pseudo atom is added to mark the attachment point; if false, the implicit hydrogen count is increased.originalAtom- The original atom from the input molecule corresponding to the atom to be saturated. Used for determining bond propertiesoriginalBond- The original bond that was broken during the extraction process. Used for determining the bond order of the new R-group bond
-
splitOGlycosidicEsterPeroxideBondsCircularSugarsPostProcessing
protected void splitOGlycosidicEsterPeroxideBondsCircularSugarsPostProcessing(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize) Splits O-glycosidic (ether), ester, and peroxide bonds in the given molecule (circular sugar moieties) and optionally marks the attachment points with R-groups. This method identifies specific bond types (ether, ester, and peroxide) in the molecule using SMARTS patterns and then breaks these bonds, duplicating oxygen atoms where adequate. The transformation can either mark the attachment points with R-groups or saturate the resulting open valences with implicit H atoms, depending on the `markAttachPointsByR` parameter. If bonds are split, an unconnected atom container results. If no matching bonds are found, the original molecule remains unchanged. Note: SMIRKS transformations are not used here, since they create a copy of the molecule and that would destroy the atom and bond mapping to the original molecule.- Parameters:
molecule- The molecule in which ether, ester, and peroxide bonds are to be split. Must not be null.markAttachPointsByR- If true, the attachment points are marked with R-groups; otherwise, they are saturated with implicit H.limitPostProcessingBySize- If true, the bond will only be split if both resulting fragments are large enough to be preserved according to the set preservation mode threshold- Throws:
NullPointerException- If the input molecule is null.
-
splitEtherEsterPeroxideBondsLinearSugarsPostProcessing
protected void splitEtherEsterPeroxideBondsLinearSugarsPostProcessing(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize) Splits ether, ester, and peroxide bonds in the given molecule (linear sugar moieties) and optionally marks the attachment points with R-groups. This method identifies specific bond types (ether, ester, and peroxide) in the molecule using SMARTS patterns and then breaks these bonds, duplicating oxygen atoms where adequate. The transformation can either mark the attachment points with R-groups or saturate the resulting open valences with implicit H atoms, depending on the `markAttachPointsByR` parameter. If bonds are split, an unconnected atom container results. If no matching bonds are found, the original molecule remains unchanged. Note: SMIRKS transformations are not used here, since they create a copy of the molecule and that would destroy the atom and bond mapping to the original molecule.- Parameters:
molecule- The molecule in which ether, ester, and peroxide bonds are to be split. Must not be null.markAttachPointsByR- If true, the attachment points are marked with R-groups; otherwise, they are saturated with implicit H.limitPostProcessingBySize- If true, the bond will only be split if both resulting fragments are large enough to be preserved according to the set minimum size for linear sugars- Throws:
NullPointerException- If the input molecule is null.
-
splitEsters
protected void splitEsters(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize, boolean splitCircularSugars) Splits ester bonds in the given molecule (circular or linear sugar moieties) and optionally marks the attachment points with R-groups.This method identifies ester bonds in the molecule using a SMARTS pattern and then breaks these bonds while duplicating the formerly connecting oxygen atom to produce a carboxy acid and an alcohol as educts. The transformation can either mark the attachment points with R-groups or saturate the resulting open valences with implicit hydrogen atoms, depending on the `markAttachPointsByR` parameter.
Depending on the `splitCircularSugars` parameter, the method uses either the SMARTS pattern for circular sugar ester bonds or the pattern for linear sugar ester bonds (see the public constants).
If bonds are split, the molecule may become disconnected. If no ester bonds are found, the original molecule remains unchanged. Note: SMIRKS transformations are not used here, since they create a copy of the molecule and that would destroy the atom and bond mapping to the original molecule.
- Parameters:
molecule- The molecule in which ester bonds are to be split. Must not be null.markAttachPointsByR- If true, the attachment points are marked with R-groups; otherwise, they are saturated with implicit hydrogen atoms.limitPostProcessingBySize- If true, the bond will only be split if both resulting fragments are large enough to be preserved according to the set preservation mode threshold or the set minimum size for linear sugars (depends on 'splitCircularSugars').splitCircularSugars- If true, the SMARTS pattern for circular sugar ester bonds is used; if false, the pattern for linear sugar ester bonds is used.- Throws:
NullPointerException- If the input molecule is null.
-
splitEthersCrossLinking
protected void splitEthersCrossLinking(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize) Splits cross-linking ether bonds in the given molecule (linear sugar moieties) and optionally marks the attachment points with R-groups.This method identifies cross-linking ether bonds in the molecule using a SMARTS pattern and then breaks these bonds while duplicating the formerly connecting oxygen atom. The transformation can either mark the attachment points with R-groups or saturate the resulting open valences with implicit hydrogen atoms, depending on the `markAttachPointsByR` parameter.
If bonds are split, the molecule may become disconnected. If no matching bonds are found, the original molecule remains unchanged. Note: SMIRKS transformations are not used here, since they create a copy of the molecule and that would destroy the atom and bond mapping to the original molecule.
- Parameters:
molecule- The molecule in which cross-linking ether bonds are to be split. Must not be null.markAttachPointsByR- If true, the attachment points are marked with R-groups; otherwise, they are saturated with implicit hydrogen atoms.limitPostProcessingBySize- If true, the bond will only be split if both resulting fragments are large enough to be preserved according to the set minimum size for linear sugars- Throws:
NullPointerException- If the input molecule is null.
-
splitOGlycosidicBondsAndEthers
protected void splitOGlycosidicBondsAndEthers(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize, boolean splitCircularSugars) Splits O-glycosidic (ether) groups connecting circular or linear sugars in the given molecule and optionally marks the attachment points with R-groups.This method identifies ether bonds in the molecule using a SMARTS pattern and then breaks these bonds while duplicating the formerly connecting oxygen atom. The transformation can either mark the attachment points with R-groups or saturate the resulting open valences with implicit hydrogen atoms, depending on the `markAttachPointsByR` parameter.
Depending on the `splitCircularSugars` parameter, the method uses either the SMARTS pattern for circular sugar ester bonds or the pattern for linear sugar ester bonds (see the public constants).
If bonds are split, the molecule may become disconnected. If no matching bonds are found, the original molecule remains unchanged. Note: SMIRKS transformations are not used here, since they create a copy of the molecule and that would destroy the atom and bond mapping to the original molecule.
- Parameters:
molecule- The molecule in which O-glycosidic (ether) bonds are to be split. Must not be null.markAttachPointsByR- If true, the attachment points are marked with R-groups; otherwise, they are saturated with implicit hydrogen atoms.limitPostProcessingBySize- If true, the bond will only be split if both resulting fragments are large enough to be preserved according to the set preservation mode threshold or the set minimum size for linear sugars (depends on 'splitCircularSugars').splitCircularSugars- If true, the SMARTS pattern for circular sugar ester bonds is used; if false, the pattern for linear sugar ester bonds is used.- Throws:
NullPointerException- If the input molecule is null.
-
splitPeroxides
protected void splitPeroxides(IAtomContainer molecule, boolean markAttachPointsByR, boolean limitPostProcessingBySize, boolean splitCircularSugars) Splits peroxide groups in the given molecule (circular or linear sugar moieties) and optionally marks the attachment points with R-groups.This method identifies peroxide bonds in the molecule using a SMARTS pattern and then breaks these bonds. The transformation can either mark the attachment points with R-groups or saturate the resulting open valences with implicit hydrogen atoms, depending on the `markAttachPointsByR` parameter.
Depending on the `splitCircularSugars` parameter, the method uses either the SMARTS pattern for circular sugar ester bonds or the pattern for linear sugar ester bonds (see the public constants).
If bonds are split, the molecule may become disconnected. If no matching bonds are found, the original molecule remains unchanged. Note: SMIRKS transformations are not used here, since they create a copy of the molecule and that would destroy the atom and bond mapping to the original molecule.
- Parameters:
molecule- The molecule in which peroxide bonds are to be split. Must not be null.markAttachPointsByR- If true, the attachment points are marked with R-groups; otherwise, they are saturated with implicit hydrogen atoms.limitPostProcessingBySize- If true, the bond will only be split if both resulting fragments are large enough to be preserved according to the set preservation mode threshold or the set minimum size for linear sugars (depends on 'splitCircularSugars').splitCircularSugars- If true, the SMARTS pattern for circular sugar ester bonds is used; if false, the pattern for linear sugar ester bonds is used.- Throws:
NullPointerException- If the input molecule is null.
-
isFragmentTooSmall
protected boolean isFragmentTooSmall(IAtomContainer molecule, IBond bondToBreak, boolean isCriterionForCircularSugars) Checks whether breaking the specified bond would result in a fragment that is too small by the set criterion.This method creates a temporary copy of the input molecule, removes the specified bond, and then checks if any of the resulting disconnected fragments would be smaller than the preservation threshold for circular sugars or smaller than the linear sugar candidate minimum size for linear sugars. This is used during postprocessing to prevent the splitting of bonds that would create fragments too small to be meaningful (e.g., small substituents like methyl groups).
This method is typically called before actually breaking bonds during postprocessing to ensure that only bonds connecting sufficiently large fragments are split.
No checks are performed!
- Parameters:
molecule- The molecule containing the bond to be evaluatedbondToBreak- The bond whose removal would be tested for fragment sizeisCriterionForCircularSugars- if true, the size evaluated based on the set preservation mode threshold; otherwise, the linear sugar candidate minimum size is used- Returns:
- True if breaking the bond would result in at least one fragment that is too small to preserve according to the applied criterion; false if all resulting fragments would be large enough to preserve.
-