Package org.biojava.nbio.structure
Class ChainImpl
- java.lang.Object
-
- org.biojava.nbio.structure.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 theGroupType
constants.- Since:
- 1.4
- Author:
- Andreas Prlic, Jules Jacobsen
- See Also:
- Serialized Form
-
-
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.Object
clone()
Returns an identical copy of this Chain .Group
getAtomGroup(int position)
Return the Group at given position, from within Groups with observed density in the chain, i.e.List<Group>
getAtomGroups()
Return all Groups with observed density in the chain, i.e.List<Group>
getAtomGroups(GroupType type)
Return a List of all (observed) Groups of a special type, one of:GroupType.AMINOACID
,GroupType.HETATM
orGroupType.NUCLEOTIDE
.int
getAtomLength()
Returns the number of Groups with observed density in the chain, i.e.List<Group>
getAtomLigands()
Gets all groups that are not polymer groups and that are not solvent groups.String
getAtomSequence()
Returns the sequence of amino acids as it has been provided in the ATOM records.Sequence<?>
getBJSequence()
Converts the SEQRES groups of a Chain to a Biojava Sequence object.String
getChainID()
Gets the 'private' asymId of this chain.EntityInfo
getEntityInfo()
Returns the EntityInfo for this chain.EntityType
getEntityType()
Returns the EntityType of this chain.Group
getGroupByPDB(ResidueNumber resNum)
Get a group by its PDB residue numbering.Group[]
getGroupsByPDB(ResidueNumber start, ResidueNumber end)
Get all groups that are located between two PDB residue numbers.Group[]
getGroupsByPDB(ResidueNumber start, ResidueNumber end, boolean ignoreMissing)
Get all groups that are located between two PDB residue numbers.String
getId()
Get the 'private' asymId (internal chain IDs in mmCif) for this chain.String
getInternalChainID()
If available, returns the internal chain ID that is used in mmCIF files (asym_id), otherwise nullString
getName()
Get the 'public' authId (chain ID in PDB file)Structure
getParent()
Deprecated.use getStructure instead.GroupType
getPredominantGroupType()
Get the predominantGroupType
for a given Chain, following these rules: if the ratio of number of residues of a certainGroupType
to total non-water residues is above the threshold {@value #org.biojava.nbio.structure.StructureTools.RATIO_RESIDUES_TO_TOTAL}, then thatGroupType
is returned if there is noGroupType
that is above the threshold then theGroupType
with most members is chosen, logging itList<SeqMisMatch>
getSeqMisMatches()
Gets annotated sequence mismatches for this chain.Group
getSeqResGroup(int position)
Return the Group at given position, from within groups in the SEQRES records of the chain, i.e.List<Group>
getSeqResGroups()
Returns a list of all groups in SEQRES records of the chain, i.e.List<Group>
getSeqResGroups(GroupType type)
Returns a List of all SEQRES groups of a special type, one of:GroupType.AMINOACID
,GroupType.HETATM
orGroupType.NUCLEOTIDE
.int
getSeqResLength()
Returns the number of groups in the SEQRES records of the chain, i.e.String
getSeqResOneLetterSeq()
Get the one letter sequence so that Sequence is guaranteed to be the same length as seqResGroups.String
getSeqResSequence()
Returns the PDB SEQRES sequence as a one-letter sequence string.Structure
getStructure()
Returns the parent Structure of this chain.String
getSwissprotId()
get the Swissprot id of this chains .boolean
isNucleicAcid()
Tell whether given chain is DNA or RNAboolean
isProtein()
Tell whether given chain is a protein chainboolean
isPureNonPolymer()
Returns true if the given chain is composed of non-polymeric (including water) groups only.boolean
isWaterOnly()
Tests if a chain is consisting of water molecules onlyvoid
setAtomGroups(List<Group> groups)
Set all Groups with observed density in the chain, i.e.void
setChainID(String asymId)
Sets the 'private' asymId of this chain (Chain id in PDB file ).void
setEntityInfo(EntityInfo mol)
Sets the Entity informationvoid
setId(String asymId)
Set the 'private' asymId (internal chain IDs in mmCif) for this chain.void
setInternalChainID(String internalChainID)
Sets the internal chain ID that is used in mmCif filesvoid
setName(String authId)
Set the 'public' authId (chain ID in PDB file)void
setParent(Structure parent)
Deprecated.void
setSeqMisMatches(List<SeqMisMatch> seqMisMatches)
Sets annotated sequence mismatches for this chain.void
setSeqResGroups(List<Group> groups)
Sets the list of SeqResGroups for this chain.void
setStructure(Structure parent)
Sets the back-reference to its parent Structure.void
setSwissprotId(String sp_id)
set the Swissprot id of this chains .String
toMMCIF()
Convert this Chain to a String in mmCIF formatString
toPDB()
Convert this Chain to a String in PDB formatString
toString()
String representation.
-
-
-
Constructor Detail
-
ChainImpl
public ChainImpl()
Constructs a ChainImpl object.
-
-
Method Detail
-
getId
public String getId()
Get the 'private' asymId (internal chain IDs in mmCif) for this chain.- Specified by:
getId
in interfaceChain
- Returns:
- the asymId
- See Also:
Chain.setId(String)
,Chain.getName()
-
setId
public void setId(String asymId)
Set the 'private' asymId (internal chain IDs in mmCif) for this chain.
-
getName
public String getName()
Get the 'public' authId (chain ID in PDB file)- Specified by:
getName
in interfaceChain
- Returns:
- the authId for this chain.
- See Also:
Chain.getId()
-
setName
public void setName(String authId)
Set the 'public' authId (chain ID in PDB file)- Specified by:
setName
in interfaceChain
- Parameters:
authId
- the 'public' authId (chain ID in PDB file)- See Also:
Chain.getId()
-
setParent
@Deprecated public void setParent(Structure parent)
Deprecated.Sets the back-reference to its parent Structure.- Specified by:
setParent
in interfaceChain
- Parameters:
parent
- the parent Structure object for this Chain- See Also:
Chain.getStructure()
-
setStructure
public void setStructure(Structure parent)
Sets the back-reference to its parent Structure.- Specified by:
setStructure
in interfaceChain
-
getStructure
public Structure getStructure()
Returns the parent Structure of this chain.- Specified by:
getStructure
in interfaceChain
- Returns:
- the parent Structure object
- See Also:
Chain.setStructure(Structure)
-
getParent
@Deprecated public Structure getParent()
Deprecated.use getStructure instead.Returns the parent Structure of this chain.- Specified by:
getParent
in interfaceChain
- Returns:
- the parent Structure object
- See Also:
Chain.setStructure(Structure)
-
setEntityInfo
public void setEntityInfo(EntityInfo mol)
Sets the Entity information- Specified by:
setEntityInfo
in interfaceChain
- Parameters:
mol
- the EntityInfo- See Also:
Chain.getEntityInfo()
-
getEntityInfo
public EntityInfo getEntityInfo()
Returns the EntityInfo for this chain.- Specified by:
getEntityInfo
in interfaceChain
- Returns:
- the EntityInfo object
- See Also:
Chain.setEntityInfo(EntityInfo)
-
setSwissprotId
public void setSwissprotId(String sp_id)
set the Swissprot id of this chains .- Specified by:
setSwissprotId
in interfaceChain
- Parameters:
sp_id
- a String specifying the swissprot id value- See Also:
getSwissprotId()
-
getSwissprotId
public String getSwissprotId()
get the Swissprot id of this chains .- Specified by:
getSwissprotId
in interfaceChain
- Returns:
- a String representing the swissprot id value
- See Also:
setSwissprotId(java.lang.String)
-
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.
-
getAtomGroup
public Group getAtomGroup(int position)
Return the Group at given position, from within Groups with observed density in the chain, i.e. those with coordinates in ATOM and HETATMS (including waters) records.- Specified by:
getAtomGroup
in interfaceChain
- Parameters:
position
- an int- Returns:
- a Group object
- See Also:
Chain.getAtomLength()
,Chain.getAtomGroups()
,Chain.getSeqResGroup(int)
-
getAtomGroups
public List<Group> getAtomGroups(GroupType type)
Return a List of all (observed) Groups of a special type, one of:GroupType.AMINOACID
,GroupType.HETATM
orGroupType.NUCLEOTIDE
. Note that if a standard aminoacid appears as a HETATM (because it is part of a ligand) then it is still considered asGroupType.AMINOACID
and not asGroupType.HETATM
.- Specified by:
getAtomGroups
in interfaceChain
- Parameters:
type
- GroupType- Returns:
- a List object
- See Also:
Chain.setAtomGroups(List)
-
getAtomGroups
public List<Group> getAtomGroups()
Return all Groups with observed density in the chain, i.e. those with coordinates in ATOM and HETATMS (including waters) records.- Specified by:
getAtomGroups
in interfaceChain
- Returns:
- a List object representing the Groups of this Chain.
- See Also:
Chain.setAtomGroups(List)
,Chain.getAtomLength()
,Chain.getSeqResGroups()
-
setAtomGroups
public void setAtomGroups(List<Group> groups)
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 interfaceChain
- 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 interfaceChain
- 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
Get a group by its PDB residue numbering. If the PDB residue number is not known, throws a StructureException.- Specified by:
getGroupByPDB
in interfaceChain
- 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
Get all groups that are located between two PDB residue numbers.- Specified by:
getGroupsByPDB
in interfaceChain
- 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
-
getSeqResLength
public int getSeqResLength()
Returns the number of groups in the SEQRES records of the chain, i.e. the number of aminoacids/nucleotides in the construct- Specified by:
getSeqResLength
in interfaceChain
- Returns:
- the length
- See Also:
Chain.getSeqResGroup(int)
,Chain.getSeqResGroups()
,Chain.getAtomLength()
-
setChainID
public void setChainID(String asymId)
Sets the 'private' asymId of this chain (Chain id in PDB file ).- Specified by:
setChainID
in interfaceChain
- Parameters:
asymId
- a String specifying the name value- See Also:
Chain.getChainID()
-
getChainID
public String getChainID()
Gets the 'private' asymId of this chain.- Specified by:
getChainID
in interfaceChain
- Returns:
- a String representing the name value
- See Also:
Chain.setChainID(String)
-
getBJSequence
public Sequence<?> getBJSequence()
Converts the SEQRES groups of a Chain to a Biojava Sequence object.- Specified by:
getBJSequence
in interfaceChain
- Returns:
- the SEQRES groups of the Chain as a Sequence object.
-
getAtomSequence
public String getAtomSequence()
Returns the sequence of amino acids as it has been provided in the ATOM records. Non-standard residues will be present in the string only if the property has been set.- Specified by:
getAtomSequence
in interfaceChain
- Returns:
- amino acid sequence as string
- See Also:
Chain.getSeqResSequence()
-
getSeqResSequence
public String getSeqResSequence()
Returns the PDB SEQRES sequence as a one-letter sequence string. Non-standard residues are represented by an "X".- Specified by:
getSeqResSequence
in interfaceChain
- 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.
-
getSeqResGroup
public Group getSeqResGroup(int position)
Return the Group at given position, from within groups in the SEQRES records of the chain, i.e. the aminoacids/nucleotides in the construct.- Specified by:
getSeqResGroup
in interfaceChain
- Parameters:
position
- an int- Returns:
- a Group object
- See Also:
Chain.getSeqResLength()
,Chain.getSeqResGroups()
,Chain.getAtomGroup(int)
-
getSeqResGroups
public List<Group> getSeqResGroups(GroupType type)
Returns a List of all SEQRES groups of a special type, one of:GroupType.AMINOACID
,GroupType.HETATM
orGroupType.NUCLEOTIDE
.- Specified by:
getSeqResGroups
in interfaceChain
- Parameters:
type
- a GroupType- Returns:
- an List object
- See Also:
Chain.setSeqResGroups(List)
-
getSeqResGroups
public List<Group> getSeqResGroups()
Returns a list of all groups in SEQRES records of the chain, i.e. the aminoacids/nucleotides in the construct.- Specified by:
getSeqResGroups
in interfaceChain
- Returns:
- a List of all Group objects of this chain
- See Also:
Chain.setSeqResGroups(List)
,Chain.getSeqResLength()
,Chain.getAtomGroups()
-
setSeqResGroups
public void setSeqResGroups(List<Group> groups)
Sets the list of SeqResGroups for this chain.- Specified by:
setSeqResGroups
in interfaceChain
- Parameters:
groups
- a List of Group objects that from the SEQRES groups of this chain.- See Also:
Chain.getSeqResGroups()
-
getAtomLength
public int getAtomLength()
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 interfaceChain
- Returns:
- the length
- See Also:
Chain.getAtomGroup(int)
,Chain.getAtomGroups()
-
getAtomLigands
public List<Group> getAtomLigands()
Gets all groups that are not polymer groups and that are not solvent groups. Will automatically fetch Chemical Component files from the PDB web site, even ifFileParsingParameters#setLoadChemCompInfo(boolean)
has not been set to true. Otherwise the Ligands could not correctly be identified.- Specified by:
getAtomLigands
in interfaceChain
- Returns:
- list of Groups that are ligands
-
getInternalChainID
public String getInternalChainID()
Description copied from interface:Chain
If available, returns the internal chain ID that is used in mmCIF files (asym_id), otherwise null- Specified by:
getInternalChainID
in interfaceChain
- Returns:
- String or null
-
setInternalChainID
public void setInternalChainID(String internalChainID)
Description copied from interface:Chain
Sets the internal chain ID that is used in mmCif files- Specified by:
setInternalChainID
in interfaceChain
-
toPDB
public String toPDB()
Description copied from interface:Chain
Convert this Chain to a String in PDB format
-
toMMCIF
public String toMMCIF()
Description copied from interface:Chain
Convert this Chain to a String in mmCIF format
-
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 interfaceChain
-
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 interfaceChain
-
getEntityType
public EntityType getEntityType()
Description copied from interface:Chain
Returns the EntityType of this chain. Equivalent to getEntityInfo().getType()- Specified by:
getEntityType
in interfaceChain
- 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 interfaceChain
- 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 interfaceChain
- Returns:
- true if only non-polymeric groups in this chain.
-
getPredominantGroupType
public GroupType getPredominantGroupType()
Description copied from interface:Chain
Get the predominantGroupType
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 {@value #org.biojava.nbio.structure.StructureTools.RATIO_RESIDUES_TO_TOTAL}, then thatGroupType
is returned- if there is no
GroupType
that is above the threshold then theGroupType
with most members is chosen, logging itSee also
ChemComp.getPolymerType()
andChemComp.getResidueType()
which follow the PDB chemical component dictionary and provide a much more accurate description of groups and their linking.- Specified by:
getPredominantGroupType
in interfaceChain
- Returns:
- if the ratio of number of residues of a certain
-
isProtein
public boolean isProtein()
Description copied from interface:Chain
Tell whether given chain is a protein chain- Specified by:
isProtein
in interfaceChain
- Returns:
- true if protein, false if nucleotide or ligand
- See Also:
Chain.getPredominantGroupType()
-
isNucleicAcid
public boolean isNucleicAcid()
Description copied from interface:Chain
Tell whether given chain is DNA or RNA- Specified by:
isNucleicAcid
in interfaceChain
- Returns:
- true if nucleic acid, false if protein or ligand
- See Also:
Chain.getPredominantGroupType()
-
-