Class HetatomImpl

  • All Implemented Interfaces:
    java.io.Serializable, Group
    Direct Known Subclasses:
    AminoAcidImpl, NucleotideImpl

    public class HetatomImpl
    extends java.lang.Object
    implements Group
    Generic Implementation of a Group interface. AminoAcidImpl and NucleotideImpl are closely related classes.
    Since:
    1.4
    Version:
    %I% %G%
    Author:
    Andreas Prlic, Horvath Tamas
    See Also:
    AminoAcidImpl, NucleotideImpl, Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  HetatomImpl.PerformanceBehavior
      Behaviors for how to balance memory vs.
    • Constructor Summary

      Constructors 
      Constructor Description
      HetatomImpl()
      Construct a Hetatom instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAltLoc​(Group group)
      Add a group that is an alternate location for this group.
      void addAtom​(Atom atom)
      Add an atom to this group.
      void clearAtoms()
      Remove all atoms from this group.
      java.lang.Object clone()
      returns and identical copy of this Group object .
      protected void cloneAtomsAndBonds​(Group newGroup)  
      Group getAltLocGroup​(java.lang.Character altLoc)
      Gets the alternate location group to this group that has the alt-loc character code passed.
      java.util.List<Group> getAltLocs()
      Get the list of other alternate location groups.
      Atom getAtom​(int position)
      Get at atom by position.
      Atom getAtom​(java.lang.String name)
      Get an atom given its PDB name.
      java.util.List<Atom> getAtoms()
      Get list of atoms.
      Chain getChain()
      Returns the parent Chain of the Group.
      java.lang.String getChainId()
      Utility method for returning the chainId of the Group or null if no Chain has been set.
      ChemComp getChemComp()
      Get the chemical component that closer describes this group.
      long getId()
      the Hibernate database ID
      java.lang.String getPDBName()
      Get the PDB 3-letter name for this group.
      java.util.Map<java.lang.String,​java.lang.Object> getProperties()
      Return properties.
      java.lang.Object getProperty​(java.lang.String key)
      Get a single property .
      ResidueNumber getResidueNumber()
      Returns a dynamically created ResidueNumber for the group - this contains the chainId, resNum and insCode of the group.
      GroupType getType()
      boolean has3D()
      Return true or false, depending if this group has 3D coordinates or not.
      boolean hasAltLoc()
      Check if this group has alternate location groups.
      boolean hasAminoAtoms()
      Calculate if this group has all atoms required for an amino acid backbone.
      boolean hasAtom​(java.lang.String fullName)
      Tell whether a particular atom exists within this group.
      boolean isAminoAcid()
      Check if this group is an aminoacid group, from the definition in Chemical Component Dictionary
      boolean isHetAtomInFile()
      Tells whether the group is annotated as HETATM in the file.
      boolean isNucleotide()
      Check if this group is a nucleotide group, from the definition in Chemical Component Dictionary
      boolean isPolymeric()
      Check if this group is a polymeric group, from the definition in Chemical Component Dictionary
      boolean isWater()
      Determines if this group is water.
      java.util.Iterator<Atom> iterator()
      Get an Atom Iterator.
      void setAtoms​(java.util.List<Atom> atoms)
      Set the atoms of this group.
      void setChain​(Chain chain)
      Sets the back-reference to its parent Chain.
      void setChemComp​(ChemComp cc)
      Set the Chemical Component that closer describes this group.
      void setHetAtomInFile​(boolean isHetAtomInFile)
      Sets the field isHetAtomInFile which is intented only for helping in infering if a polymeric group is in a ligand chain or in a polymeric chain.
      void setId​(long id)
      the Hibernate database ID
      void setPDBFlag​(boolean flag)
      Flag if group has 3D data .
      void setPDBName​(java.lang.String s)
      Set the PDB 3-letter name for this group.
      void setProperties​(java.util.Map<java.lang.String,​java.lang.Object> props)
      Properties of this amino acid.
      void setProperty​(java.lang.String key, java.lang.Object value)
      Set a single property .
      void setResidueNumber​(java.lang.String chainId, java.lang.Integer resNum, java.lang.Character iCode)
      Utility method to temporarily set a chainID for a group, if a parent chain object does not exist yet.
      void setResidueNumber​(ResidueNumber residueNumber)
      Sets the ResidueNumber for this Group
      int size()
      Get number of atoms.
      java.lang.String toSDF()
      Function to get the Group as an MDL molblock
      java.lang.String toString()  
      void trimToSize()
      Attempts to reduce the memory imprint of this group by trimming all internal Collection objects to the required size.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • type

        public static final GroupType type
        The GroupType is HETATM
      • pdb_flag

        protected boolean pdb_flag
        stores if 3d coordinates are available.
      • pdb_name

        protected java.lang.String pdb_name
        3 letter name of amino acid in pdb file.
      • atoms

        protected java.util.List<Atom> atoms
    • Constructor Detail

      • HetatomImpl

        public HetatomImpl()
        Construct a Hetatom instance.
    • Method Detail

      • has3D

        public boolean has3D()
        Description copied from interface: Group
        Return true or false, depending if this group has 3D coordinates or not.
        Specified by:
        has3D in interface Group
        Returns:
        true if Group has 3D coordinates
      • setPDBFlag

        public void setPDBFlag​(boolean flag)
        Description copied from interface: Group
        Flag if group has 3D data .
        Specified by:
        setPDBFlag in interface Group
        Parameters:
        flag - true to set flag that this Group has 3D coordinates
      • setPDBName

        public void setPDBName​(java.lang.String s)
        Description copied from interface: Group
        Set the PDB 3-letter name for this group. (e.g. ALA)
        Specified by:
        setPDBName in interface Group
        Parameters:
        s - a String specifying the PDBName value
        See Also:
        Group.getPDBName()
      • getPDBName

        public java.lang.String getPDBName()
        Description copied from interface: Group
        Get the PDB 3-letter name for this group. (e.g. ALA)
        Specified by:
        getPDBName in interface Group
        Returns:
        a String representing the PDBName value
        See Also:
        Group.setPDBName(java.lang.String)
      • addAtom

        public void addAtom​(Atom atom)
        Add an atom to this group.
        Specified by:
        addAtom in interface Group
        Parameters:
        atom - an Atom object
      • clearAtoms

        public void clearAtoms()
        Description copied from interface: Group
        Remove all atoms from this group.
        Specified by:
        clearAtoms in interface Group
      • size

        public int size()
        Get number of atoms.
        Specified by:
        size in interface Group
        Returns:
        number of atoms of this Group
      • getAtoms

        public java.util.List<Atom> getAtoms()
        Get list of atoms.
        Specified by:
        getAtoms in interface Group
        Returns:
        a List object representing the atoms
        See Also:
        Group.setAtoms(List)
      • setAtoms

        public void setAtoms​(java.util.List<Atom> atoms)
        Set the atoms of this group.
        Specified by:
        setAtoms in interface Group
        Parameters:
        atoms - a list of atoms
        See Also:
        Atom
      • getAtom

        public Atom getAtom​(java.lang.String name)
        Get an atom given its PDB name. Beware that some PDB atom names are ambiguous (e.g. CA, which means C-alpha or Calcium), ambiguities should not occur within the same group though. To solve these ambiguities one would need to check the atom returned for the required element with Atom.getElement()

        Note this method will return only the atom in the default alternative location (be it '.' or a letter).

        Specified by:
        getAtom in interface Group
        Parameters:
        name - a trimmed String representing the atom's PDB name, e.g. "CA"
        Returns:
        an Atom object or null if no such atom exists within this group
      • getAtom

        public Atom getAtom​(int position)
        Get at atom by position.
        Specified by:
        getAtom in interface Group
        Parameters:
        position - an int
        Returns:
        an Atom object or null if no Atom exists for given position
      • hasAtom

        public boolean hasAtom​(java.lang.String fullName)
        Tell whether a particular atom exists within this group. Beware that some PDB atom names are ambiguous (e.g. CA, which means C-alpha or Calcium), ambiguities should not occur within the same group though.
        Specified by:
        hasAtom in interface Group
        Parameters:
        fullName - a trimmed String representing the atom's PDB name, e.g. "CA"
        Returns:
        true if Atom with name exists within this group
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasAminoAtoms

        public boolean hasAminoAtoms()
        Calculate if this group has all atoms required for an amino acid backbone. This allows to include chemically modified amino acids that are labeled hetatoms into some computations, the usual way to identify if a group is an amino acid is Group.getType()

        amino atoms are : N, CA, C, O

        Example: 1DW9 chain A first group is a Selenomethionine, provided as HETATM, but here returns true.
         HETATM    1  N   MSE A   1      11.720  20.973   1.584  0.00  0.00           N
         HETATM    2  CA  MSE A   1      10.381  20.548   1.139  0.00  0.00           C
         HETATM    3  C   MSE A   1       9.637  20.037   2.398  0.00  0.00           C
         HETATM    4  O   MSE A   1      10.198  19.156   2.985  0.00  0.00           O
         HETATM    5  CB  MSE A   1      10.407  19.441   0.088  0.00  0.00           C
         
        Specified by:
        hasAminoAtoms in interface Group
        Returns:
        true if all Atoms required for an AminoAcid are available (N, CA, C, O)
        See Also:
        Group.getType()
      • isPolymeric

        public boolean isPolymeric()
        Description copied from interface: Group
        Check if this group is a polymeric group, from the definition in Chemical Component Dictionary
        Specified by:
        isPolymeric in interface Group
        Returns:
        true if a polymeric group
      • isAminoAcid

        public boolean isAminoAcid()
        Description copied from interface: Group
        Check if this group is an aminoacid group, from the definition in Chemical Component Dictionary
        Specified by:
        isAminoAcid in interface Group
        Returns:
        true if an amino acid
      • isNucleotide

        public boolean isNucleotide()
        Description copied from interface: Group
        Check if this group is a nucleotide group, from the definition in Chemical Component Dictionary
        Specified by:
        isNucleotide in interface Group
        Returns:
        true if a nucleotide
      • setProperties

        public void setProperties​(java.util.Map<java.lang.String,​java.lang.Object> props)
        Properties of this amino acid. Currently available properties are: phi psi secstruc
        Specified by:
        setProperties in interface Group
        Parameters:
        props - a Map object specifying the properties value
        See Also:
        Group.getProperties()
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.Object value)
        Description copied from interface: Group
        Set a single property .
        Specified by:
        setProperty in interface Group
        Parameters:
        key - a String
        value - an Object
        See Also:
        Group.getProperty(java.lang.String)
      • iterator

        public java.util.Iterator<Atom> iterator()
        Description copied from interface: Group
        Get an Atom Iterator.
        Specified by:
        iterator in interface Group
        Returns:
        an Iterator object
      • clone

        public java.lang.Object clone()
        returns and identical copy of this Group object .
        Specified by:
        clone in interface Group
        Overrides:
        clone in class java.lang.Object
        Returns:
        and identical copy of this Group object
      • cloneAtomsAndBonds

        protected void cloneAtomsAndBonds​(Group newGroup)
      • getId

        public long getId()
        the Hibernate database ID
        Returns:
        the id
      • setId

        public void setId​(long id)
        the Hibernate database ID
        Parameters:
        id - the hibernate id
      • getChemComp

        public ChemComp getChemComp()
        Description copied from interface: Group
        Get the chemical component that closer describes this group. If the information does not exist yet, fetches the information from PDB web site.
        Specified by:
        getChemComp in interface Group
        Returns:
        the Chemical Component definition for this Group.
      • setChemComp

        public void setChemComp​(ChemComp cc)
        Description copied from interface: Group
        Set the Chemical Component that closer describes this group.
        Specified by:
        setChemComp in interface Group
        Parameters:
        cc - the chemical component
      • setChain

        public void setChain​(Chain chain)
        Sets the back-reference to its parent Chain.
        Specified by:
        setChain in interface Group
        Parameters:
        chain - the parent Chain
        See Also:
        Group.getChain()
      • getChain

        public Chain getChain()
        Returns the parent Chain of the Group.
        Specified by:
        getChain in interface Group
        Returns:
        Chain the Chain object that contains the Group
        See Also:
        Group.setChain(Chain)
      • getChainId

        public java.lang.String getChainId()
        Utility method for returning the chainId of the Group or null if no Chain has been set. This is equivalent to calling getChain().getId() Prior to version 5.0 this method returned the chain name.
        Specified by:
        getChainId in interface Group
        Returns:
        the ID of the chain
      • getResidueNumber

        public ResidueNumber getResidueNumber()
        Returns a dynamically created ResidueNumber for the group - this contains the chainId, resNum and insCode of the group.
        Specified by:
        getResidueNumber in interface Group
        Returns:
        ResidueNumber for the group.
        See Also:
        ResidueNumber
      • setResidueNumber

        public void setResidueNumber​(ResidueNumber residueNumber)
        Description copied from interface: Group
        Sets the ResidueNumber for this Group
        Specified by:
        setResidueNumber in interface Group
        Parameters:
        residueNumber - the PDB residueNumber
      • setResidueNumber

        public void setResidueNumber​(java.lang.String chainId,
                                     java.lang.Integer resNum,
                                     java.lang.Character iCode)
        Description copied from interface: Group
        Utility method to temporarily set a chainID for a group, if a parent chain object does not exist yet. Not recommended for general use other than parsing.
        Specified by:
        setResidueNumber in interface Group
      • hasAltLoc

        public boolean hasAltLoc()
        Description copied from interface: Group
        Check if this group has alternate location groups.
        Specified by:
        hasAltLoc in interface Group
        Returns:
        boolean flag if there are alternate locations.
        See Also:
        Group.getAltLocs()
      • getAltLocs

        public java.util.List<Group> getAltLocs()
        Description copied from interface: Group
        Get the list of other alternate location groups.

        The main group (this group) will contain the first altloc (be it the default '.' or 'A' or a mix of '.' and 'A').

        This method will return the altloc groups that are not the main group, e.g.:

      • if '.' (default), 'A' and 'B' altlocs are present in file, the main group will contain the default '.' and this method will return 2 altloc groups
      • if 'A' and 'B' are present in file without a default '.' group, then the main group will contain the 'A' location whilst this method will return only 1 altloc group with the 'B' location
      • Note that atoms with the default altloc (.) are included in all groups. Atoms with other altlocs (typically A, B, etc) will be sorted into groups by altloc.

        Thus it can happen that an altloc group duplicate the contents of the main group.

Specified by:
getAltLocs in interface Group
Returns:
List of other groups that are on alternate locations