Class ChainImpl

  • All Implemented Interfaces:
    Chain

    public class ChainImpl
    extends java.lang.Object
    implements Chain
    A Chain in a PDB file. It contains several groups which can be of one of the types defined in the GroupType constants.
    Since:
    1.4
    Author:
    Andreas Prlic, Jules Jacobsen
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_CHAIN_ID
      The default chain identifier is an empty space.
    • Constructor Summary

      Constructors 
      Constructor Description
      ChainImpl()
      Constructs a ChainImpl object.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addGroup​(Group group)
      add a group to the list of ATOM record group of this chain.
      java.lang.Object clone()
      Returns an identical copy of this Chain .
      Annotation getAnnotation()
      get/set the Annotation of a Chain.
      Group getAtomGroup​(int position)
      return the group at position .
      java.util.List<Group> getAtomGroups()
      Return all groups that have been specified in the ATOM section of this chain .
      java.util.List<Group> getAtomGroups​(java.lang.String type)
      Get the Groups of a certain type, that are listed int the ATOM records of the PDB file.
      int getAtomLength()
      Return the number of Groups in the ATOM records of the chain.
      java.lang.String getAtomSequence()
      Return the sequence of amino acids as it has been provided in the ATOM records.
      Sequence getBJSequence()
      Convert the SEQRES groups of a Chain to a Biojava Sequence object.
      Group getGroup​(int position)
      Deprecated.
      use getAtomGroup or getSeqResGroup instead
      Group getGroupByPDB​(java.lang.String pdbresnum)
      get a group by its PDB residue numbering.
      java.util.List<Group> getGroups()
      Deprecated.
      use getAtomGroups instead
      java.util.List<Group> getGroups​(java.lang.String type)
      Deprecated.
      use getAtomGroups instead
      Group[] getGroupsByPDB​(java.lang.String pdbresnumStart, java.lang.String pdbresnumEnd)
      Get all groups that are located between two PDB residue numbers.
      Group[] getGroupsByPDB​(java.lang.String pdbresnumStart, java.lang.String pdbresnumEnd, boolean ignoreMissing)
      Get all groups that are located between two PDB residue numbers.
      Compound getHeader()
      Returns the Header ( a Compound object) for this chain.
      java.lang.Long getId()
      Get the ID used by Hibernate.
      int getLength()
      Deprecated.
      use getAtomLength instead
      int getLengthAminos()
      returns the length of the AminoAcids in the ATOM records of this chain.
      java.lang.String getName()
      get and set the name of this chain (Chain id in PDB file ).
      Structure getParent()
      Returns the parent Structure of this chain.
      Group getSeqResGroup​(int position)
      return the Group at position X.
      java.util.List<Group> getSeqResGroups()
      Return all groups of this chain.
      java.util.List<Group> getSeqResGroups​(java.lang.String type)
      Return a List of all groups of a special type (e.g.
      int getSeqResLength()
      Returns the number of groups in the SEQRES records of the chain.
      java.lang.String getSeqResSequence()
      Get the sequence for all amino acids as it is specified in the SEQRES residues.
      java.lang.String getSequence()
      Deprecated.
      use getAtomSequence instead
      java.lang.String getSwissprotId()
      get the Swissprot id of this chains .
      void setAnnotation​(Annotation anno)
      get/set the Annotation of a Chain.
      void setAtomGroups​(java.util.List<Group> groups)
      Set all groups that have been specified in the ATOM section of this chain .
      void setHeader​(Compound mol)
      Set the Header from the PDB file.
      void setId​(java.lang.Long id)
      Set the ID used by Hibernate.
      void setName​(java.lang.String nam)
      get and set the name of this chain (Chain id in PDB file ).
      void setParent​(Structure parent)
      Set the back-reference to its parent Structure.
      void setSeqResGroups​(java.util.List<Group> groups)
      Set the list of SeqResGroups for this chain.
      void setSwissprotId​(java.lang.String sp_id)
      set the Swissprot id of this chains .
      java.lang.String toString()
      String representation.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_CHAIN_ID

        public static java.lang.String DEFAULT_CHAIN_ID
        The default chain identifier is an empty space.
    • Constructor Detail

      • ChainImpl

        public ChainImpl()
        Constructs a ChainImpl object.
    • Method Detail

      • getId

        public java.lang.Long getId()
        Get the ID used by Hibernate.
        Specified by:
        getId in interface Chain
        Returns:
        the ID used by Hibernate
        See Also:
        Chain.setId(Long)
      • setId

        public void setId​(java.lang.Long id)
        Set the ID used by Hibernate.
        Specified by:
        setId in interface Chain
        Parameters:
        id - assigned by Hibernate
        See Also:
        Chain.getId()
      • setParent

        public void setParent​(Structure parent)
        Set the back-reference to its parent Structure.
        Specified by:
        setParent in interface Chain
        Parameters:
        parent - the parent Structure object for this Chain
        See Also:
        Chain.getParent()
      • clone

        public java.lang.Object clone()
        Returns an identical copy of this Chain .
        Specified by:
        clone in interface Chain
        Overrides:
        clone in class java.lang.Object
        Returns:
        an identical copy of this Chain
      • setAnnotation

        public void setAnnotation​(Annotation anno)
        get/set the Annotation of a Chain. allows to annotate a protein chain, e.g. molecule description "AZURIN" for pdb 1a4a.A
        Specified by:
        setAnnotation in interface Chain
        Parameters:
        anno - the Annotation to be provided.
        See Also:
        Chain.getAnnotation()
      • getAnnotation

        public Annotation getAnnotation()
        get/set the Annotation of a Chain. allows to annotate a protein chain, e.g. molecule description "AZURIN" for pdb 1a4a.A
        Specified by:
        getAnnotation in interface Chain
        Returns:
        the Annotation of this chain
        See Also:
        Chain.setAnnotation(Annotation)
      • setHeader

        public void setHeader​(Compound mol)
        Set the Header from the PDB file.
        Specified by:
        setHeader in interface Chain
        Parameters:
        mol - the Compound that contains the header information for this chain
        See Also:
        Chain.getHeader()
      • getHeader

        public Compound getHeader()
        Returns the Header ( a Compound object) for this chain.
        Specified by:
        getHeader in interface Chain
        Returns:
        the Compound object that contains the Header information
        See Also:
        Chain.setHeader(Compound)
      • setSwissprotId

        public void setSwissprotId​(java.lang.String sp_id)
        set the Swissprot id of this chains .
        Specified by:
        setSwissprotId in interface Chain
        Parameters:
        sp_id - a String specifying the swissprot id value
        See Also:
        getSwissprotId()
      • addGroup

        public void addGroup​(Group group)
        add a group to the list of ATOM record group of this chain. To add SEQRES records a more complex alignment between ATOM and SEQRES residues is required, please see SeqRes2AtomAligner for more details on that.
        Specified by:
        addGroup in interface Chain
        Parameters:
        group - a Group object
      • getAtomGroup

        public Group getAtomGroup​(int position)
        return the group at position .
        Specified by:
        getAtomGroup in interface Chain
        Parameters:
        position - an int
        Returns:
        a Group object
      • getGroups

        public java.util.List<Group> getGroups​(java.lang.String type)
        Deprecated.
        use getAtomGroups instead
        Return a list of all groups of one of the types defined in hte GroupType constants.
        Specified by:
        getGroups in interface Chain
        Parameters:
        type - a String
        Returns:
        an List object containing the groups of type...
      • getAtomGroups

        public java.util.List<Group> getAtomGroups​(java.lang.String type)
        Get the Groups of a certain type, that are listed int the ATOM records of the PDB file.
        Specified by:
        getAtomGroups in interface Chain
        Parameters:
        type - the type of the groups to return. Can be one of the 3 types defined in the GroupType constants
        Returns:
        a list of group objects
        See Also:
        Chain.setAtomGroups(List)
      • getGroups

        public java.util.List<Group> getGroups()
        Deprecated.
        use getAtomGroups instead
        return all groups of this chain .
        Specified by:
        getGroups in interface Chain
        Returns:
        a List object representing the Groups of this Chain.
      • getAtomGroups

        public java.util.List<Group> getAtomGroups()
        Return all groups that have been specified in the ATOM section of this chain .
        Specified by:
        getAtomGroups in interface Chain
        Returns:
        a List object representing the Groups of this Chain.
        See Also:
        Chain.setAtomGroups(List)
      • setAtomGroups

        public void setAtomGroups​(java.util.List<Group> groups)
        Set all groups that have been specified in the ATOM section of this chain .
        Specified by:
        setAtomGroups in interface Chain
        Parameters:
        groups - a List object representing the Groups of this Chain.
        See Also:
        Chain.getAtomGroups()
      • getGroupsByPDB

        public Group[] getGroupsByPDB​(java.lang.String pdbresnumStart,
                                      java.lang.String pdbresnumEnd,
                                      boolean ignoreMissing)
                               throws StructureException
        Get all groups that are located between two PDB residue numbers. In contrast to getGroupsByPDB this method call ignores if the exact outer groups are not found. This is useful e.g. when requesting the range of groups as specified by the DBREF records - these frequently are rather inaccurate.
        Specified by:
        getGroupsByPDB in interface Chain
        Parameters:
        pdbresnumStart - PDB residue number of start
        pdbresnumEnd - PDB residue number of end
        ignoreMissing - ignore missing groups in this range.
        Returns:
        Groups in between. or throws a StructureException if either start or end can not be found,
        Throws:
        StructureException
      • getGroupByPDB

        public Group getGroupByPDB​(java.lang.String pdbresnum)
                            throws StructureException
        Description copied from interface: Chain
        get a group by its PDB residue numbering. if the PDB residue number is not know, throws a StructureException.
        Specified by:
        getGroupByPDB in interface Chain
        Parameters:
        pdbresnum - the PDB residue number of the group
        Returns:
        the matching group
        Throws:
        StructureException
      • getGroupsByPDB

        public Group[] getGroupsByPDB​(java.lang.String pdbresnumStart,
                                      java.lang.String pdbresnumEnd)
                               throws StructureException
        Get all groups that are located between two PDB residue numbers.
        Specified by:
        getGroupsByPDB in interface Chain
        Parameters:
        pdbresnumStart - PDB residue number of start
        pdbresnumEnd - PDB residue number of end
        Returns:
        Groups in between. or throws a StructureException if either start or end can not be found,
        Throws:
        StructureException
      • getLength

        public int getLength()
        Deprecated.
        use getAtomLength instead
        Description copied from interface: Chain
        get total length of chain, including HETATMs..
        Specified by:
        getLength in interface Chain
        Returns:
        an int representing the length of the whole chain including HETATMs
        See Also:
        Chain.getAtomLength(), Chain.getSeqResLength()
      • getLengthAminos

        public int getLengthAminos()
        returns the length of the AminoAcids in the ATOM records of this chain. note: not all amino acids need to have 3D coords, in fact in could be that none has!
        Specified by:
        getLengthAminos in interface Chain
        Returns:
        an int representing the length of the AminoAcids in the ATOM records of the chain.
      • getSeqResLength

        public int getSeqResLength()
        Description copied from interface: Chain
        Returns the number of groups in the SEQRES records of the chain.
        Specified by:
        getSeqResLength in interface Chain
        Returns:
        the length
      • setName

        public void setName​(java.lang.String nam)
        get and set the name of this chain (Chain id in PDB file ).
        Specified by:
        setName in interface Chain
        Parameters:
        nam - a String specifying the name value
        See Also:
        getName()
      • getName

        public java.lang.String getName()
        get and set the name of this chain (Chain id in PDB file ).
        Specified by:
        getName in interface Chain
        Returns:
        a String representing the name value
        See Also:
        setName(java.lang.String)
      • toString

        public java.lang.String toString()
        String representation.
        Specified by:
        toString in interface Chain
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of the Chain
      • getSequence

        public java.lang.String getSequence()
        Deprecated.
        use getAtomSequence instead
        get amino acid sequence of the chain. for backwards compatibility this returns the Atom sequence of the chain.
        Specified by:
        getSequence in interface Chain
        Returns:
        a String representing the sequence.
        See Also:
        getAtomSequence(), getSeqResSequence()
      • getAtomSequence

        public java.lang.String getAtomSequence()
        Return the sequence of amino acids as it has been provided in the ATOM records.
        Specified by:
        getAtomSequence in interface Chain
        Returns:
        amino acid sequence as string
        See Also:
        Chain.getSeqResSequence()
      • getSeqResSequence

        public java.lang.String getSeqResSequence()
        Get the sequence for all amino acids as it is specified in the SEQRES residues.
        Specified by:
        getSeqResSequence in interface Chain
        Returns:
        the amino acid sequence of the SEQRES sequence as a string
        See Also:
        Chain.getAtomSequence()
      • getSeqResGroup

        public Group getSeqResGroup​(int position)
        return the Group at position X.
        Specified by:
        getSeqResGroup in interface Chain
        Parameters:
        position - an int
        Returns:
        a Group object
      • getSeqResGroups

        public java.util.List<Group> getSeqResGroups​(java.lang.String type)
        Return a List of all groups of a special type (e.g. amino, hetatm, nucleotide).
        Specified by:
        getSeqResGroups in interface Chain
        Parameters:
        type - a String
        Returns:
        an List object
        See Also:
        Chain.setSeqResGroups(List)
      • setSeqResGroups

        public void setSeqResGroups​(java.util.List<Group> groups)
        Set the list of SeqResGroups for this chain.
        Specified by:
        setSeqResGroups in interface Chain
        Parameters:
        groups - a List of Group objects that from the SEQRES groups of this chain.
        See Also:
        Chain.getSeqResGroups()
      • getAtomLength

        public int getAtomLength()
        Return the number of Groups in the ATOM records of the chain.
        Specified by:
        getAtomLength in interface Chain
        Returns:
        the length