Class ChainImpl

  • All Implemented Interfaces:
    Serializable, Chain

    public class ChainImpl
    extends 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
    See Also:
    Serialized Form
    • Constructor Detail

      • ChainImpl

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

      • setId

        public void setId​(String asymId)
        Description copied from interface: Chain
        Set the 'private' asymId (internal chain IDs in mmCif) for this chain.
        Specified by:
        setId in interface Chain
        Parameters:
        asymId - the internal chain Id
      • getName

        public String getName()
        Description copied from interface: Chain
        Get the 'public' authId (chain ID in PDB file)
        Specified by:
        getName in interface Chain
        Returns:
        the authId for this chain.
        See Also:
        Chain.getId()
      • setName

        public void setName​(String authId)
        Description copied from interface: Chain
        Set the 'public' authId (chain ID in PDB file)
        Specified by:
        setName in interface Chain
        Parameters:
        authId - the 'public' authId (chain ID in PDB file)
        See Also:
        Chain.getId()
      • setStructure

        public void setStructure​(Structure parent)
        Description copied from interface: Chain
        Sets the back-reference to its parent Structure.
        Specified by:
        setStructure in interface Chain
      • clone

        public Object clone()
        Description copied from interface: Chain
        Returns an identical copy of this Chain.
        Specified by:
        clone in interface Chain
        Overrides:
        clone in class Object
        Returns:
        an identical copy of this Chain
      • addGroup

        public void addGroup​(Group group)
        Description copied from interface: Chain
        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
      • setAtomGroups

        public void setAtomGroups​(List<Group> groups)
        Description copied from interface: Chain
        Set all Groups with observed density in the chain, i.e. those with coordinates in ATOM and HETATMs (including waters) records.
        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​(ResidueNumber start,
                                      ResidueNumber end,
                                      boolean ignoreMissing)
                               throws StructureException
        Description copied from interface: Chain
        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:
        start - PDB residue number of start. If null, defaults to the chain start.
        end - PDB residue number of end. If null, defaults to the chain 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​(ResidueNumber resNum)
                            throws StructureException
        Description copied from interface: Chain
        Get a group by its PDB residue numbering. If the PDB residue number is not known, throws a StructureException.
        Specified by:
        getGroupByPDB in interface Chain
        Parameters:
        resNum - the PDB residue number of the group
        Returns:
        the matching group
        Throws:
        StructureException
      • getGroupsByPDB

        public Group[] getGroupsByPDB​(ResidueNumber start,
                                      ResidueNumber end)
                               throws StructureException
        Description copied from interface: Chain
        Get all groups that are located between two PDB residue numbers.
        Specified by:
        getGroupsByPDB in interface Chain
        Parameters:
        start - PDB residue number of start. If null, defaults to the chain start.
        end - PDB residue number of end. If null, defaults to the chain end.
        Returns:
        Groups in between. or throws a StructureException if either start or end can not be found,
        Throws:
        StructureException
      • getBJSequence

        public Sequence<?> getBJSequence()
        Description copied from interface: Chain
        Converts the SEQRES groups of a Chain to a Biojava Sequence object.
        Specified by:
        getBJSequence in interface Chain
        Returns:
        the SEQRES groups of the Chain as a Sequence object.
      • getAtomSequence

        public String getAtomSequence()
        Description copied from interface: Chain
        Returns 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 String getSeqResSequence()
        Description copied from interface: Chain
        Returns the PDB SEQRES sequence as a one-letter sequence string. Non-standard residues are represented by an "X".
        Specified by:
        getSeqResSequence in interface Chain
        Returns:
        one-letter PDB SEQRES sequence as string
        See Also:
        Chain.getAtomSequence()
      • getSeqResOneLetterSeq

        public String getSeqResOneLetterSeq()
        Get the one letter sequence so that Sequence is guaranteed to be the same length as seqResGroups. Method related to https://github.com/biojava/biojava/issues/457
        Returns:
        a string of the sequence guaranteed to be the same length as seqResGroups.
      • setSeqResGroups

        public void setSeqResGroups​(List<Group> groups)
        Description copied from interface: Chain
        Sets 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()
        Description copied from interface: Chain
        Returns the number of Groups with observed density in the chain, i.e. those with coordinates in ATOM and HETATMs (including waters) records
        Specified by:
        getAtomLength in interface Chain
        Returns:
        the length
        See Also:
        Chain.getAtomGroup(int), Chain.getAtomGroups()
      • toPDB

        public String toPDB()
        Description copied from interface: Chain
        Convert this Chain to a String in PDB format
        Specified by:
        toPDB in interface Chain
        Returns:
      • toMMCIF

        public String toMMCIF()
        Description copied from interface: Chain
        Convert this Chain to a String in mmCIF format
        Specified by:
        toMMCIF in interface Chain
        Returns:
      • setSeqMisMatches

        public void setSeqMisMatches​(List<SeqMisMatch> seqMisMatches)
        Description copied from interface: Chain
        Sets annotated sequence mismatches for this chain. This is based on the STRUCT_REF_SEQ_DIF mmCif category
        Specified by:
        setSeqMisMatches in interface Chain
      • getSeqMisMatches

        public List<SeqMisMatch> getSeqMisMatches()
        Description copied from interface: Chain
        Gets annotated sequence mismatches for this chain. This is based on the STRUCT_REF_SEQ_DIF mmCif category
        Specified by:
        getSeqMisMatches in interface Chain
        Returns:
        a list of sequence mismatches (or null if none found)
      • getEntityType

        public EntityType getEntityType()
        Description copied from interface: Chain
        Returns the EntityType of this chain. Equivalent to getEntityInfo().getType()
        Specified by:
        getEntityType in interface Chain
        Returns:
        See Also:
        EntityType
      • isWaterOnly

        public boolean isWaterOnly()
        Description copied from interface: Chain
        Tests if a chain is consisting of water molecules only
        Specified by:
        isWaterOnly in interface Chain
        Returns:
        true if there are only solvent molecules in this chain.
      • isPureNonPolymer

        public boolean isPureNonPolymer()
        Description copied from interface: Chain
        Returns true if the given chain is composed of non-polymeric (including water) groups only.
        Specified by:
        isPureNonPolymer in interface Chain
        Returns:
        true if only non-polymeric groups in this chain.
      • getPredominantGroupType

        public GroupType getPredominantGroupType()
        Description copied from interface: Chain
        Get the predominant GroupType for a given Chain, following these rules:
      • if the ratio of number of residues of a certain GroupType to total non-water residues is above the threshold 0.95, then that GroupType is returned
      • if there is no GroupType that is above the threshold then the GroupType with most members is chosen, logging it
      • See also ChemComp.getPolymerType() and ChemComp.getResidueType() which follow the PDB chemical component dictionary and provide a much more accurate description of groups and their linking.

Specified by:
getPredominantGroupType in interface Chain
Returns:
the predominant group type