Class RepeatingUnitSgroup

  • All Implemented Interfaces:
    Serializable

    @PublicAPI
    public class RepeatingUnitSgroup
    extends Sgroup
    Source-based and structure-based representation of repeating unit groups (polymers and repeating units with repetition ranges).

    Source and structure structure-based representation of polymers.
    The polymer structure consists of structural fragments. These fragments are enclosed by polymer brackets. The meaning of an SRU bracket is that the fragment within the brackets can repeat with itself. The fragment within the bracket is called repeating unit. Each SRU S-group has two or more dedicated bonds, called crossing bonds, that cross the brackets. The crossing bonds of an SRU show how the repeating units may connect in several ways to each other within the polymer. Depending on the number of crossing bonds and brackets we differentiate the following polymers and connectivities within the polymer:

    • Polymers with two crossing bonds.

      If the polymer has one crossing bond on each bracket of the SRU there are three possibilities for the repeating pattern:

      • head-to-tail
      • head-to-head
      • either/unknown
    • Ladder-Type Polymers

      Polymers with paired brackets and with two crossing bonds on each bracket are called ladder-type polymers. Here it must be specified how the two crossing bonds on each bracket connect to the corresponding bonds of the adjoining repeating units. Additionally to the head-to-tail, head-to-head connectivity information there is a flip information to specify whether the repeating unit flips around the polymer backbone when it connects to the adjoining SRU. This information is handled only in case of brackets with exactly two crossing bonds on both side (head and tail side). We differentiate the following polymer connectivities:

      • head-to-tail with no flip
      • head-to-tail with flip
      • head-to-head with no flip
      • head-to-head with flip
      • either/unknown
    • Polymers with three or more brackets.

      If the polymer has three or more bonds with a separated bracket on each bond, the polymer always has the either/unknown repeating pattern.

    The end groups of polymers are often unknown or unspecified which are represented by star atoms (*).

    Repeating units with repetition ranges.

    Implemented S-group types:

    • Sgroup.ST_ANY
    • Sgroup.ST_SRU
    • Sgroup.ST_COPOLYMER
    • Sgroup.ST_CROSSLINK
    • Sgroup.ST_GRAFT
    • Sgroup.ST_MODIFICATION
    Since:
    Marvin 5.0, 10/13/2006
    See Also:
    Serialized Form
    • Constructor Detail

      • RepeatingUnitSgroup

        public RepeatingUnitSgroup​(Molecule parent,
                                   int type)
        Constructs an SRU S-group. Please note the S-group is not added automatically to the parent molecule.
        Parameters:
        parent - the parent molecule
        type - type of the repeating unit sgroup. Possible values:
        • Sgroup.ST_ANY
        • Sgroup.ST_SRU
        • Sgroup.ST_COPOLYMER
        • Sgroup.ST_CROSSLINK
        • Sgroup.ST_GRAFT
        • Sgroup.ST_MODIFICATION
        See Also:
        Molecule.addSgroup(Sgroup, boolean)
      • RepeatingUnitSgroup

        protected RepeatingUnitSgroup​(RepeatingUnitSgroup sg,
                                      Molecule m,
                                      Sgroup psg,
                                      int[] atomIndexMap)
        Copy constructor.
        Parameters:
        sg - the S-group to copy
        m - the new parent molecule
        psg - the new parent S-group or null
        atomIndexMap - indices of cloned atoms in the original molecule in the case of partial cloning, or null otherwise
        Since:
        Marvin 4.1
      • RepeatingUnitSgroup

        protected RepeatingUnitSgroup​(RepeatingUnitSgroup sg,
                                      Molecule m,
                                      Sgroup psg)
        Copy constructor.
        Parameters:
        sg - the S-group to copy
        m - the new parent molecule
        psg - the new parent S-group or null
        Since:
        Marvin 4.1
    • Method Detail

      • cloneSgroup

        protected Sgroup cloneSgroup​(Molecule m,
                                     Sgroup psg,
                                     int[] atomIndexMap)
        Gets a new Sgroup instance.
        Overrides:
        cloneSgroup in class Sgroup
        Parameters:
        m - the new parent molecule
        psg - the new parent S-group
        atomIndexMap - indices of cloned atoms in the original molecule or null
        Returns:
        the new object
        Since:
        Marvin 5.0.2, 03/07/2008
      • getSuperscript

        public String getSuperscript()
        Gets the superscript for Sru S-groups. This contains the connectivity data.
        Overrides:
        getSuperscript in class Sgroup
        Returns:
        the superscript:
        • "ht" - head to tail & no flip,
        • "ht,f" - head to tail & flip,
        • "hh" - head to head & no flip,
        • "hh,f" - head to head & flip,
        • "eu" - either/unknown.
      • isAcceptableSru

        public static boolean isAcceptableSru​(String s)
      • isAcceptablePolymerGraph

        public static boolean isAcceptablePolymerGraph​(MoleculeGraph molGraph)
        Checks if the given molecular graph can be the graph of a polymer SRU
        Parameters:
        molGraph - the molecular graph to check
        Returns:
        true if the molecular graph is acceptable for a polymer SRU
      • isAcceptableRSRUGraph

        public static boolean isAcceptableRSRUGraph​(MoleculeGraph molGraph)
        Checks if the given molecular graph can be the graph of an RSRU
        Parameters:
        molGraph - the molecular graph to check
        Returns:
        true if the molecular graph is acceptable for an RSRU
      • addStarAtoms

        public void addStarAtoms()
        Changes terminal carbon atoms to star atoms (*).
      • removeStarAtoms

        public void removeStarAtoms()
        Changes terminal star atoms (*) to carbon atoms (C).
      • isStarAtom

        public boolean isStarAtom​(MolAtom atom)
        Decides whether an atom is a star atom in this S-group.
        Parameters:
        atom - the atom
        Returns:
        true if the atom is star atom false otherwise
      • findCrossingBonds

        public MolBond[] findCrossingBonds()
        Finds the crossing bonds.
        Overrides:
        findCrossingBonds in class Sgroup
        Returns:
        the attachment bonds
        Since:
        Marvin 5.0
      • isOuterAtom

        public final boolean isOuterAtom​(MolAtom candidate)
        Decides whether an atom is part of this repeating unit.
        Parameters:
        candidate - The atom possibly outside of repeating unit
        Returns:
        true if the atom is not part of the repeating unit
      • mergeBrackets

        public void mergeBrackets​(MolBond b1,
                                  MolBond b2)
        Sets the crossing bonds of this sgroup so that they will share a common bracket.
        Parameters:
        b1 - first bond
        b2 - second bond
      • isCrossingBond

        public boolean isCrossingBond​(MolBond b)
        Decides whether the bond is a crossing bond in a ladder-type polymer bracket.
        Parameters:
        b - the bond
        Returns:
        true if the bond is a crossing bond in a ladder-type polymer bracket, false otherwise
      • getOtherCrossingBond

        public MolBond getOtherCrossingBond​(MolBond b)
        Gets the other bond if a bond is a crossing bond in a ladder-type polimer bracket.
        Parameters:
        b - the bond which crosses a ladder-type bracket
        Returns:
        the other bond if the given bond is in a ladder-type polimer bracket, null otherwise.
      • isFlipped

        public boolean isFlipped()
        Decides whether this sgroup is flipped.
        Returns:
        true if the sgroup is flipped, false otherwise
        See Also:
        flipped
      • setFlipped

        public void setFlipped​(boolean flipped)
        Sets the flip property of this sgroup.
        Parameters:
        flipped - the value of flip property
        See Also:
        flipped
      • getBondConnectionInfo

        public MolBond[] getBondConnectionInfo()
        Gets a bond triplet which stores the crossing bond and flip information.
        Returns:
        array of bonds In case of ladder-type sru sgroups: 0. and 1. bond in the array are the crossing bond-pair that share a common bracket, 2. bond in the array is a crossing bond in repeating unit that attaches to the 0. item of this array. Null if the this sgroup contains a non ladder-type polymer.
      • getBondCorrespondence

        public MolBond[] getBondCorrespondence()
        Gets four bonds that store the crossing bond and flip information.
        Returns:
        array of bonds In case of ladder-type sru sgroups: 0. and 2. bond in the array are the crossing bond-pair that share a common bracket, 1. bond in the array is a crossing bond in repeating unit that attaches to the 0. item of this array, 3. bond in the array is a crossing bond in repeating unit that attaches to the 2. item of this array. Null if the this sgroup contains a non ladder-type polymer.
      • setBondCorrespondence

        public void setBondCorrespondence​(MolBond[] b)
        Sets the crossing bonds (head and tail) of a ladder-type polymer. If head and tail crossing bonds are not yet set then adds the bonds from the bond array. If only head is already set, sets the tail bonds. Here the head bonds should be in the array, otherwise does nothing. Calculates the flip property according the connection given in the array.
        Parameters:
        b - array of four bonds. The order of bonds should be the following: 0. and 2. bond belong to the same bracket, 1. and 3. as well. When the sru connects to the adjoining sru, it does via 0. and 1. bond, 2. and 3. bond.
      • equalsTail

        public boolean equalsTail​(MolBond[] bonds)
        Decides whether the tail bonds equal the given bonds.
        Parameters:
        bonds - the bonds to compare with
        Returns:
        true if the bonds equal with the tail bonds (order is not important)
      • equalsHead

        public boolean equalsHead​(MolBond[] bonds)
        Decides whether the head bonds equal the given bonds.
        Parameters:
        bonds - the bonds to compare with
        Returns:
        true if the bonds equal with the head bonds (order is not important)
      • addCrossingBonds

        public void addCrossingBonds​(List<MolBond> crsList,
                                     List<MolBond> list)
        Sets the crossing bonds (head and tail) of a ladder-type polymer.
        Parameters:
        crsList - list that contains a pair of crossing bonds that share a common bracket (0. and 1. item of this list) and a crossing bond that connects to the 0. item of this list.
        list - list of all crossing bonds that share a common bracket
        See Also:
        headCrossingBonds, tailCrossingBonds
      • getHeadCrossingBonds

        public MolBond[] getHeadCrossingBonds()
        Gets the head crossing bonds.
        Returns:
        exactly two head crossing bonds if this sgroup contains a ladder-type polymer, null otherwise
      • setHeadCrossingBonds

        public void setHeadCrossingBonds​(MolBond[] b)
        Sets the head crossing bonds. Exactly two or null head crossing bonds should be specified.
        Parameters:
        b - the head crossing bonds.
      • getTailCrossingBonds

        public MolBond[] getTailCrossingBonds()
        Gets the tail crossing bonds.
        Returns:
        the tail crossing bonds if this sgroup contains a ladder-type polymer, null otherwise
      • setTailCrossingBonds

        public void setTailCrossingBonds​(MolBond[] tailCrossingBonds)
        Sets the tail crossing bonds. Exactly two or null head crossing bonds should be given.
        Parameters:
        tailCrossingBonds - the tail crossing bonds.
      • swapHeadTail

        public void swapHeadTail()
        Swaps the head and tail bonds of this sru if both are set.
      • containsLadderTypePolymer

        public boolean containsLadderTypePolymer()
        Decides whether the structure of this sgroup contains a ladder-type repeating unit.
        Returns:
        true if this sgroup contains a ladder-type repeating unit.
      • internalsToString

        public String internalsToString()
        Print state to a String. This method is intended for internal use only!
        Returns:
        Internal state as a multi line String