Class SuperatomSgroup

  • All Implemented Interfaces:
    chemaxon.core.structure.AbbreviationForBuilder<Integer>, chemaxon.core.structure.MoleculeForBuilder, chemaxon.core.structure.RootStructureForBuilder, chemaxon.core.structure.StructureForBuilder, Expandable, Serializable

    @PublicAPI
    public class SuperatomSgroup
    extends Sgroup
    implements Expandable, chemaxon.core.structure.AbbreviationForBuilder<Integer>
    Superatom S-group.
    Since:
    Marvin 3.0, 11/05/2002
    See Also:
    Serialized Form
    • Constructor Detail

      • SuperatomSgroup

        public SuperatomSgroup​(Molecule parent)
        Constructs a superatom S-group in expanded state. Its superatom is automatically created.
        Parameters:
        parent - the parent molecule
        Since:
        Marvin 3.5.3, 01/18/2005
        See Also:
        Sgroup.ST_SUPERATOM, MolAtom.SGROUP, getSuperAtom()
      • SuperatomSgroup

        protected SuperatomSgroup​(SuperatomSgroup 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 or null
        Since:
        Marvin 5.0.2, 03/07/2008
    • Method Detail

      • getSuperAtom

        public final SgroupAtom getSuperAtom()
        Gets the superatom.
        Returns:
        the superatom
      • getAttachAtoms

        @Deprecated
        public final MolAtom[] getAttachAtoms()
        Deprecated.
        As of Marvin 6.0, replaced by getBoundAttachAtoms().
        Gets atoms with attachment point having crossing bond. This method should only be called when the residue is in contracted state.
        Returns:
        the attachment atoms
        Since:
        Marvin 4.0.4, 01/09/2006
      • getBoundAttachAtoms

        public final MolAtom[] getBoundAttachAtoms()
        Gets atoms with attachment point having crossing bond and the related leaving group is not visible. This method should only be called when the residue is in contracted state.
        Returns:
        the attachment atoms having crossing bond and not visible leaving group
        Since:
        Marvin 6.0, Dec 11, 2012
      • getFreeLegalAttachAtoms

        @Deprecated
        public final MolAtom[] getFreeLegalAttachAtoms()
        Deprecated.
        As of Marvin 6.0, replaced by getFreeAttachAtoms().
        Gets the atoms with free attachment points. Free if the corresponding attachment point is free.
        Returns:
        array of MolAtoms having free attachment point.
        See Also:
        AttachmentPoint.isFree()
      • getFreeAttachAtoms

        public final MolAtom[] getFreeAttachAtoms()
        Gets the atoms with free attachment points. Free if the corresponding attachment point is free.
        Returns:
        array of MolAtoms having free attachment point.
        Since:
        Marvin 6.0, Dec 11, 2012
        See Also:
        AttachmentPoint.isFree()
      • isFreeLegalAttachAtom

        @Deprecated
        public final boolean isFreeLegalAttachAtom​(MolAtom a)
        Deprecated.
        As of Marvin 6.0, replaced by isFreeAttachAtom(MolAtom a).
        Tests whether the specified atom has a free attachment point.
        Parameters:
        a - the atom
        Returns:
        true if it has free attachment point, false otherwise
        Since:
        5.0, 09/23/2007
      • isFreeAttachAtom

        public final boolean isFreeAttachAtom​(MolAtom a)
        Checks whether the specified atom has free attachment point.
        Parameters:
        a - the atom
        Returns:
        true if it has free attachment point, false otherwise
        Since:
        Marvin 6.0, Dec 11, 2012
        See Also:
        AttachmentPoint.isFree(), getFreeAttachAtoms()
      • getLegalAttachAtoms

        @Deprecated
        public final MolAtom[] getLegalAttachAtoms()
        Deprecated.
        As of Marvin 6.0, replaced by getAllAttachAtoms().
        Gets all attachment atoms (from free and bound attachment points).
        Returns:
        array of attachment atoms
      • getAllAttachAtoms

        public final MolAtom[] getAllAttachAtoms()
        Gets the attachment atoms (atoms having attachment point).
        Returns:
        array of attach atoms
        Since:
        Marvin 6.0, Dec 11, 2012
      • isLegalAttachment

        @Deprecated
        public final boolean isLegalAttachment​(MolAtom atom)
        Deprecated.
        As of Marvin 6.0, replaced by isAttachmentAtom(MolAtom).
        Checks whether the given atom is an attachment atom or not.
        Parameters:
        atom - the atom
        Returns:
        true if the given atom is an attachment atom false otherwise
        Since:
        3.5, 11/04/2004
      • isAttachmentAtom

        public final boolean isAttachmentAtom​(MolAtom a)
        Checks whether the given atom is an attachment atom or not.
        Parameters:
        a - the atom
        Returns:
        true if the given atom is an attachment atom false otherwise
        Since:
        Marvin 6.0, Dec 11, 2012
        See Also:
        getAllAttachAtoms()
      • updateAttachmentPoints

        @Deprecated
        public void updateAttachmentPoints()
        Deprecated.
        as of Marvin 6.2, use calculateAttachmentPoints() instead
        Adjusts attachment point information to current bonding.
        Throws:
        chemaxon.struc.sgroup.NoFreeAttachmentPointException - if there are not enough free attachment point
      • getSgroupGraph

        public SelectionMolecule getSgroupGraph()
        Gets the molecule graph as a selection. The nodes are ordered, the first n are the attachment atoms.
        Overrides:
        getSgroupGraph in class Sgroup
        Returns:
        the molecule graph
        Since:
        Marvin 3.3, 11/04/2003
      • getParentSgroupGraph

        @Deprecated
        public SelectionMolecule getParentSgroupGraph()
        Deprecated.
        as of Marvin 6.2, intended for internal use, similar functionality can be reached by getSgroupGraph()
        Gets the parent exact sgroupgraph. Internal use only.
        Returns:
        the sgroupGraph
      • setSgroupGraph

        public void setSgroupGraph​(SelectionMolecule smol)
        Sets the molecule graph. If the S-group is in contracted state then:
        • In case of single attachment points the first n nodes are supposed to be the attachment points.
        • In case of double attachment point the graph is searched for the attachment point.
        Overrides:
        setSgroupGraph in class Sgroup
        Parameters:
        smol - the molecule graph
        Since:
        Marvin 3.3, 11/04/2003
      • 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:
        5.0.2, 03/07/2008
      • setAtom

        public final void setAtom​(int i,
                                  MolAtom a)
        Sets the specified atom in the S-group graph.
        Overrides:
        setAtom in class Sgroup
        Parameters:
        i - the index
        a - the atom
      • removeAtom

        protected final void removeAtom​(MolAtom atom,
                                        int opts)
        Removes an atom from the S-group.
        Overrides:
        removeAtom in class Sgroup
        Parameters:
        atom - the atom
        opts - unused argument
      • removeBond

        public final void removeBond​(MolBond bond)
        Removes a the given bond from the S-group.
        Overrides:
        removeBond in class Sgroup
        Parameters:
        bond - the bond
      • findCrossingBonds

        public MolBond[] findCrossingBonds()
        Finds the crossing bonds. Use only when the S-group is expanded.
        Overrides:
        findCrossingBonds in class Sgroup
        Returns:
        the attachment bonds
        Since:
        Marvin 3.3
      • getCrossingAtoms

        public MolAtom[] getCrossingAtoms​(MolBond[] xbonds)
        Gets the atoms from the S-group that have crossing bonds.
        Overrides:
        getCrossingAtoms in class Sgroup
        Parameters:
        xbonds - the crossing bonds
        Returns:
        the attachment atoms
        Since:
        Marvin 3.3
        See Also:
        findCrossingBonds()
      • findAttachAtom

        public MolAtom findAttachAtom()
        Gets the attachment atom of attachment point with the smallest order.
        Returns:
        the attachment point with the smallest order or null if there is not any attachment point
        Since:
        Marvin 4.1, 03/08/2006
      • hasBrackets

        public boolean hasBrackets()
        Checks if brackets should be painted or not.
        Overrides:
        hasBrackets in class Sgroup
        Returns:
        true if the group is in expanded state
        Since:
        Marvin 3.3
      • hasAtom

        public boolean hasAtom​(MolAtom a)
        Is the specified atom an element of this group?
        Overrides:
        hasAtom in class Sgroup
        Parameters:
        a - the atom
        Returns:
        true if it contains the atom, false otherwise
        Since:
        Marvin 3.4
      • expandOther

        @Deprecated
        public final boolean expandOther​(int opts,
                                         Molecule moltoexpand)
                                  throws IllegalArgumentException
        Deprecated.
        as of Marvin 6.2. use expand(int) instead on the s-groups desired to be expanded
        Expands other S-group the same way as it would be this. The other Sgroup is the first S-group of the other molecule (moltoexpand). Atom indices are preserved during expansion.
        Parameters:
        opts - expansion options
        moltoexpand - molecule containing an Sgroup that has to be expanded
        Returns:
        true if the operation was successful, false if already expanded
        Throws:
        IllegalArgumentException - if the group is invisible (it has a non-expanded parent)
      • isExpanded

        public final boolean isExpanded()
        Is this S-group expanded?
        Specified by:
        isExpanded in interface Expandable
        Returns:
        true if expanded, false if contracted
      • calculateCoordinates

        protected void calculateCoordinates​(Molecule parentMol,
                                            MolBond[] xbonds,
                                            MoleculeGraph g,
                                            int opts,
                                            boolean isContract,
                                            SelectionMolecule otherSgroup,
                                            List<Double> xBondLength)
        Calculates the coordinates during expand and contract.
        Parameters:
        parentMol - the parent molecule of the superatomSgroup
        xbonds - array of the crossing bonds
        g - graph of the sgroup
        opts - expand option
        isContract - true if it is called from contract, false if do so from expand
        otherSgroup - graph of the other sgroup in expandOther
        Since:
        Marvin 6.2, Aug 8, 2013
      • isContracted

        public final boolean isContracted()
        Decides whether this S-group is contracted or not.
        Returns:
        true if contracted false otherwise
      • isBracketVisible

        public boolean isBracketVisible()
        Tests whether the bracket is visible.
        Overrides:
        isBracketVisible in class Sgroup
        Returns:
        false, superatom S-group brackets are not visible
        Since:
        Marvin 3.5.1, 11/12/2004
      • isTotalSelected

        public boolean isTotalSelected​(MoleculeGraph sel)
        Decides if the whole superatom sgroup is selected or not. Overrides method in parent class.
        Overrides:
        isTotalSelected in class Sgroup
        Parameters:
        sel - molecule graph that contains the selection
        Returns:
        true if the whole superatom group is selected
      • areChildSgroupsVisible

        public boolean areChildSgroupsVisible()
        Checks whether the child S-groups are visible.
        Overrides:
        areChildSgroupsVisible in class Sgroup
        Returns:
        true if children are visible, false otherwise
        Since:
        Marvin 3.4
      • sortXBonds

        @Deprecated
        public void sortXBonds()
        Deprecated.
        As of Marvin 5.12, no replacement.
        Crossing bonds of a SuperatomSgroup do not need to be sorted any more. It is not advised to sort them anyway because then the indexes of bonds change in the parent molecule.
        Sorts the crossing bonds in the parent molecule in attachment point number order.
        Since:
        Marvin 5.0, 12/07/2007
      • getExternalConnections

        public int getExternalConnections​(MolAtom a)
        Gets the number of bonds of a specified atom where the neighbor atom doesn't belong to the S-group.
        Parameters:
        a - the atom whose connections to be checked
        Returns:
        the number of external connection or 0 if the specified atom doesn't belong to the S-group.
      • replaceAtom

        public final void replaceAtom​(MolAtom oldAtom,
                                      MolAtom newAtom,
                                      int opts)
        Replace an existing atom by a new one.
        Overrides:
        replaceAtom in class Sgroup
        Parameters:
        oldAtom - the original atom
        newAtom - the new atom
        opts - options
        Since:
        4.1, 07/25/2006
        See Also:
        Sgroup.RA_REMOVE_EXCEPT_RU
      • toString

        public String toString​(int opts)
        Returns a string representation of the group.
        Overrides:
        toString in class Sgroup
        Parameters:
        opts - options or 0
        Returns:
        the string representation
        Since:
        Marvin 4.1, 07/26/2006
        See Also:
        Sgroup.PR_ATSYMS
      • calculateAttachmentPoints

        public void calculateAttachmentPoints()
        Calculates the attachment points for the crossing atoms and crossing bonds and sets the calculated values.
        1. The properly set crossing bond are kept
        2. Those attachment points that's bond is not-crossing bond will be removed
        3. For those crossing bonds that have no attachment point connected will be calculated one from the free ones or will be given a new one
      • hasOrder

        public boolean hasOrder​(int order)
      • removeAttachmentPoints

        public void removeAttachmentPoints​(MolAtom atom)
        Removes all attachment points of the given attachment atom.
        Parameters:
        atom - the attachment atom
        Throws:
        IllegalArgumentException - if the given atom is not part of the superatom s-group
      • setAttachmentPointOrder

        public void setAttachmentPointOrder​(MolAtom atom,
                                            int oldOrder,
                                            int newOrder)
        Sets a new order for the given attachment point. The order must be a positive number.
        Parameters:
        atom - the attachment atom of the attachment point
        oldOrder - the old attachment order of the attachment point
        newOrder - the new attachment order of the attachment point
        Throws:
        IllegalArgumentException - if the given atom is not part of the superatom S-group or the given new order is negativ or zero
        Since:
        Marvin 6.0, Dec 5, 2012
      • getAttachmentPointOrders

        public List<Integer> getAttachmentPointOrders​(MolAtom atom)
        Gets the attachment orders of the given attachment atom.
        Parameters:
        atom - the attachment atom
        Returns:
        the list of the attachment orders
        Since:
        Marvin 6.0, Dec 5, 2012
      • getFreeAttachmentPointOrders

        public List<Integer> getFreeAttachmentPointOrders​(MolAtom atom)
        Gets the sorted free attachment orders of the given attachment atom.
        Parameters:
        atom - the attachment atom
        Returns:
        the sorted list of the free attachment orders
        Since:
        Marvin 6.0, Dec 5, 2012
        See Also:
        AttachmentPoint.isFree()
      • add

        public void add​(MolAtom atom)
        Adds a new atom to the S-group.
        Overrides:
        add in class Sgroup
        Parameters:
        atom - the atom
        Since:
        Marvin 6.0 Dec 5, 2012.
      • getAttachmentPointCount

        public int getAttachmentPointCount()
        Gets the number of the attachment points.
        Specified by:
        getAttachmentPointCount in interface chemaxon.core.structure.AbbreviationForBuilder<Integer>
        Returns:
        the number of the attachment points
        Since:
        Marvin 6.0, Dec 4, 2012
      • checkBonds

        protected void checkBonds​(MolAtom atom)
        Add the bonds of the given atom to the sgroup if the given atom and the other atom of the selected bond is in the sgroup. If the newly added bond was crossing bond then the attachment point connected to this bond will be removed.
        Overrides:
        checkBonds in class Sgroup
        Parameters:
        atom - the atom
      • getAttachmentPoints

        public List<chemaxon.struc.sgroup.AttachmentPoint> getAttachmentPoints()
        Gets the sorted copy of the attachment point list.
        Returns:
        the list of the attachment points
        Since:
        Marvin 6.0, Dec 5, 2012
      • setCrossingBond

        public void setCrossingBond​(int order,
                                    MolBond bond)
        Change the crossing bond of an attachment point.
        Parameters:
        order - the order of the attachment point
        bond - the crossing bond to be set
        Throws:
        IllegalArgumentException -
      • if no attachment point exists with the given order
      • if the attachment atom for the given order is not the same as the original attachment atom in expanded state
      • if the given bond is not a crossing bond for this superatom s-group
      • IllegalStateException
        chemaxon.struc.sgroup.NoFreeAttachmentPointException - if the attachment point for the given order is not free
      • addAttachmentPoint

        public int addAttachmentPoint​(MolAtom atom)
        Adds a new free attachment point for an atom. The order will be the smallest non used order.
        Parameters:
        atom - the attachment atom of the new attachment point
        Returns:
        the attachment order of the new attachment point
        Throws:
        IllegalArgumentException - if the given atom is not part of the superatom S-group
        Since:
        Marvin 6.0, Dec 5, 2012
      • addAttachmentPoint

        public int addAttachmentPoint​(MolAtom atom,
                                      int order)
        Adds a new free attachment point of the given attachment atom and order. The order must be a positive number.
        Parameters:
        atom - the attachment atom of the new attachment point
        order - the attachment order of the new attachment point
        Returns:
        the attachment order of the new attachment point
        Throws:
        IllegalArgumentException - if the order is a non positive number
        Since:
        Marvin 6.0, Dec 5, 2012
      • addAttachmentPoint

        public int addAttachmentPoint​(MolAtom atom,
                                      int order,
                                      MolBond bond)
        Adds a new free attachment point.
        Parameters:
        atom - the attachment atom of the new attachment point
        bond - the crossing bond of the new attachment point
        order - the attachment order of the new attachment point
        Returns:
        the attachment order of the new attachment point
        Throws:
        IllegalArgumentException - if the given atom is not part of the superatom S-group
        Since:
        Marvin 6.0, Dec 5, 2012
      • setLeavingGroup

        @Deprecated
        public void setLeavingGroup​(int order,
                                    int atNo)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Defines the leaving group for an attachment point.
        Parameters:
        order - the order of the attachment point to which the leaving group information is added
        atNo - the atomic number of the leaving atom
        Throws:
        IllegalArgumentException - if the given order does not exist in the superatom sgroup
        Since:
        Marvin 6.0, 2013.02.11.
      • setLeavingGroup

        @Deprecated
        public void setLeavingGroup​(int order,
                                    int atNo,
                                    String alternativeName)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Defines the leaving group for an attachment point.
        Parameters:
        order - the order of the attachment point to which the leaving group information is added
        atNo - the atomic number of the leaving atom
        alternativeName - the alternative name of the leaving group. P.e.: in case of dna it can be 3', 5', etc.
        Throws:
        IllegalArgumentException - if the given order does not exist in the superatom sgroup
        Since:
        Marvin 6.0, 2013.02.11.
      • setLeavingGroup

        @Deprecated
        public void setLeavingGroup​(int order,
                                    int atNo,
                                    String alternativeName,
                                    chemaxon.struc.BondType crossingBondType)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Defines the leaving group for an attachment point.
        Parameters:
        order - the order of the attachment point to which the leaving group information is added
        atNo - the atomic number of the leaving atom
        alternativeName - the alternative name of the leaving group. P.e.: in case of DNA it can be 3', 5', etc.
        crossingBondType - the type of the bond connecting the superatom sgroup and the leaving group
        Throws:
        IllegalArgumentException -
      • if the given order does not exist in the superatom sgroup, or the type of the given bond is not single, double or triple
      • if the given order is not free and the type of the current crossing bond is not the same as the given type of the leaving group bond
      • Since:
        Marvin 6.0, Feb 12, 2013
        See Also:
        BondType, AttachmentPoint.isFree()
      • setLeavingGroupAlternativeName

        @Deprecated
        public void setLeavingGroupAlternativeName​(int order,
                                                   String alternativeName)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Sets the alternative name of the given ordered attachment point's leaving group.
        Parameters:
        order - the order of the attachment point to which the leaving group information is added
        alternativeName - the alternative name of the leaving group. P.e.: in case of DNA it can be 3', 5', etc.
        Throws:
        IllegalArgumentException - if attachment point with the given attachment order does not exist, or the attachment point does not have leaving group
        Since:
        Marvin 6.0, 2013.02.11.
      • removeLeavingGroup

        @Deprecated
        public void removeLeavingGroup​(int order)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Removes the leaving group of an attachment point and the leaving group atom as well.
        Parameters:
        order - the attachment order
        Since:
        Marvin 6.0, Feb 13, 2013
      • removeAllAttachmentPoints

        public void removeAllAttachmentPoints()
        Removes all of the attachment points of the Superatom s-group.
        Since:
        Marvin 6.0, Dec 17, 2012
      • removeAttachmentPoint

        public void removeAttachmentPoint​(int order)
        Removes the attachment point with the given order.
        Parameters:
        order - the order which's attachment point will be removed
      • getFreeAttachmentPointOrders

        public List<Integer> getFreeAttachmentPointOrders()
        Gets the increasingly sorted orders of the free attachment points.
        Returns:
        the list of the increasingly sorted orders of the free attachment points
      • getAttachmentPoint

        public chemaxon.struc.sgroup.AttachmentPoint getAttachmentPoint​(int order)
        Gets the attachment point that's order is given as parameter
        Parameters:
        order - the required attachment point's order
        Returns:
        the attachment point that's order equals to the parameter
      • setCrossingBondType

        @Deprecated
        public void setCrossingBondType​(int order,
                                        chemaxon.struc.BondType newType)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Sets the type of the crossing bond.
        Parameters:
        order - the attachment order
        newType - new type of the crossing bond
        Throws:
        IllegalStateException -
      • if the attachment point does not have a leaving group
      • if the attachment point is not free
      • Since:
        Marvin 6.0, Feb 15, 2013
      • getFreeAttachmentPointCount

        public int getFreeAttachmentPointCount()
        Gets the number of free attachment points.
        Returns:
        the number of free attachment points.
      • clone

        public SuperatomSgroup clone()
        Clones the SuperatomSgroup (and not the Molecule).
        Overrides:
        clone in class Object
        Returns:
        the cloned superatom s-group
        Since:
        Marvin 6.0, 2013.02.21.
      • cloneLeavingGroups

        @Deprecated
        protected void cloneLeavingGroups​(SuperatomSgroup sasg)
        Deprecated.
        As of Marvin 6.2, no replacement.
        Not supported feature.
        Clones the leaving groups of the given superatom s-group.
        Parameters:
        sasg - the superatom s-group
        Since:
        Marvin 6.1, 2013.05.27.
      • getAttachmentPointOrders

        public List<Integer> getAttachmentPointOrders()
        Gets the orders with which attachment point exists
        Returns:
        the list of the orders of the attachment points
      • checkSgroupGraphConsistency

        protected boolean checkSgroupGraphConsistency​(Sgroup parent)
        Checks whether the parameter s-group contain the proper atoms of this SuperatomSgroup. That means the SgroupAtom of this s-group if it is contracted state or all of it's atoms if it is in expanded state.
        Overrides:
        checkSgroupGraphConsistency in class Sgroup
        Parameters:
        parent - parent of Sgroup
        Returns:
        true if the s-group is consistent
      • clearSavedAtomIndices

        public void clearSavedAtomIndices()