Package org.biojava.nbio.structure
Class ChainImpl
- java.lang.Object
-
- org.biojava.nbio.structure.ChainImpl
-
- All Implemented Interfaces:
java.io.Serializable,Chain
public class ChainImpl extends java.lang.Object implements Chain, java.io.Serializable
A Chain in a PDB file. It contains several groups which can be of one of the types defined in theGroupTypeconstants.- Since:
- 1.4
- Author:
- Andreas Prlic, Jules Jacobsen
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_CHAIN_IDThe default chain identifier used to be 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 voidaddGroup(Group group)add a group to the list of ATOM record group of this chain.protected voidaddSeqResGroup(Group g)java.lang.Objectclone()Returns an identical copy of this Chain .GroupgetAtomGroup(int position)Return the Group at given position, from within Groups with observed density in the chain, i.e.java.util.List<Group>getAtomGroups()Return all Groups with observed density in the chain, i.e.java.util.List<Group>getAtomGroups(GroupType type)Return a List of all (observed) Groups of a special type, one of:GroupType.AMINOACID,GroupType.HETATMorGroupType.NUCLEOTIDE.intgetAtomLength()Returns the number of Groups with observed density in the chain, i.e.java.util.List<Group>getAtomLigands()Gets all groups that are not polymer groups and that are not solvent groups.java.lang.StringgetAtomSequence()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.java.lang.StringgetChainID()Gets the name of this chain (Chain id in PDB file ).CompoundgetCompound()Returns the Compound for this chain.GroupgetGroupByPDB(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)Deprecated.java.lang.LonggetId()Get the ID used by Hibernate.java.lang.StringgetInternalChainID()If available, returns the internal chain ID that is used in mmCIF files (asym_id), otherwise nullStructuregetParent()Deprecated.use getStructure instead.java.util.List<SeqMisMatch>getSeqMisMatches()Get annotated sequence mismatches for this chain.GroupgetSeqResGroup(int position)Return the Group at given position, from within groups in the SEQRES records of the chain, i.e.java.util.List<Group>getSeqResGroups()Returns a list of all groups in SEQRES records of the chain, i.e.java.util.List<Group>getSeqResGroups(GroupType type)Returns a List of all SEQRES groups of a special type, one of:GroupType.AMINOACID,GroupType.HETATMorGroupType.NUCLEOTIDE.intgetSeqResLength()Returns the number of groups in the SEQRES records of the chain, i.e.java.lang.StringgetSeqResSequence()Returns the PDB SEQRES sequence as a one-letter sequence string.StructuregetStructure()Returns the parent Structure of this chain.java.lang.StringgetSwissprotId()get the Swissprot id of this chains .voidsetAtomGroups(java.util.List<Group> groups)Set all Groups with observed density in the chain, i.e.voidsetChainID(java.lang.String nam)Sets the name of this chain (Chain id in PDB file ).voidsetCompound(Compound mol)Sets the CompoundvoidsetId(java.lang.Long id)Set the ID used by Hibernate.voidsetInternalChainID(java.lang.String internalChainID)Sets the internal chain ID that is used in mmCif filesvoidsetParent(Structure parent)Deprecated.voidsetSeqMisMatches(java.util.List<SeqMisMatch> seqMisMatches)Set annotated sequence mismatches for this chain.voidsetSeqResGroups(java.util.List<Group> groups)Sets the list of SeqResGroups for this chain.voidsetStructure(Structure parent)Sets the back-reference to its parent Structure.voidsetSwissprotId(java.lang.String sp_id)set the Swissprot id of this chains .java.lang.StringtoMMCIF()Convert this Chain to a String in mmCIF formatjava.lang.StringtoPDB()Convert this Chain to a String in PDB formatjava.lang.StringtoString()String representation.
-
-
-
Method Detail
-
getId
public java.lang.Long getId()
Get the ID used by Hibernate.- Specified by:
getIdin interfaceChain- 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:
setIdin interfaceChain- Parameters:
id- assigned by Hibernate- See Also:
Chain.getId()
-
setParent
@Deprecated public void setParent(Structure parent)
Deprecated.Sets the back-reference to its parent Structure.- Specified by:
setParentin 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:
setStructurein interfaceChain
-
getStructure
public Structure getStructure()
Returns the parent Structure of this chain.- Specified by:
getStructurein 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:
getParentin interfaceChain- Returns:
- the parent Structure object
- See Also:
Chain.setStructure(Structure)
-
clone
public java.lang.Object clone()
Returns an identical copy of this Chain .
-
setCompound
public void setCompound(Compound mol)
Sets the Compound- Specified by:
setCompoundin interfaceChain- Parameters:
mol- the Compound- See Also:
Chain.getCompound()
-
getCompound
public Compound getCompound()
Returns the Compound for this chain.- Specified by:
getCompoundin interfaceChain- Returns:
- the Compound object
- See Also:
Chain.setCompound(Compound)
-
setSwissprotId
public void setSwissprotId(java.lang.String sp_id)
set the Swissprot id of this chains .- Specified by:
setSwissprotIdin interfaceChain- Parameters:
sp_id- a String specifying the swissprot id value- See Also:
getSwissprotId()
-
getSwissprotId
public java.lang.String getSwissprotId()
get the Swissprot id of this chains .- Specified by:
getSwissprotIdin 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:
getAtomGroupin interfaceChain- Parameters:
position- an int- Returns:
- a Group object
- See Also:
Chain.getAtomLength(),Chain.getAtomGroups(),Chain.getSeqResGroup(int)
-
getAtomGroups
public java.util.List<Group> getAtomGroups(GroupType type)
Return a List of all (observed) Groups of a special type, one of:GroupType.AMINOACID,GroupType.HETATMorGroupType.NUCLEOTIDE. Note that if a standard aminoacid appears as a HETATM (because it is part of a ligand) then it is still considered asGroupType.AMINOACIDand not asGroupType.HETATM.- Specified by:
getAtomGroupsin interfaceChain- Parameters:
type- GroupType- Returns:
- a List object
- See Also:
Chain.setAtomGroups(List)
-
getAtomGroups
public java.util.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:
getAtomGroupsin interfaceChain- Returns:
- a List object representing the Groups of this Chain.
- See Also:
Chain.setAtomGroups(List),Chain.getAtomLength(),Chain.getSeqResGroups()
-
setAtomGroups
public void setAtomGroups(java.util.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:
setAtomGroupsin interfaceChain- Parameters:
groups- a List object representing the Groups of this Chain.- See Also:
Chain.getAtomGroups()
-
getGroupsByPDB
@Deprecated public Group[] getGroupsByPDB(ResidueNumber start, ResidueNumber end, boolean ignoreMissing) throws StructureException
Deprecated.Description copied from interface:ChainGet 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:
getGroupsByPDBin interfaceChain- Parameters:
start- PDB residue number of startend- PDB residue number of endignoreMissing- 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:
getGroupByPDBin 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:
getGroupsByPDBin interfaceChain- Parameters:
start- PDB residue number of startend- PDB residue number of 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:
getSeqResLengthin interfaceChain- Returns:
- the length
- See Also:
Chain.getSeqResGroup(int),Chain.getSeqResGroups(),Chain.getAtomLength()
-
setChainID
public void setChainID(java.lang.String nam)
Sets the name of this chain (Chain id in PDB file ).- Specified by:
setChainIDin interfaceChain- Parameters:
nam- a String specifying the name value- See Also:
Chain.getChainID()
-
getChainID
public java.lang.String getChainID()
Gets the name of this chain (Chain id in PDB file ).- Specified by:
getChainIDin interfaceChain- Returns:
- a String representing the name value
- See Also:
Chain.setChainID(String)
-
toString
public java.lang.String toString()
String representation.
-
getBJSequence
public Sequence<?> getBJSequence()
Converts the SEQRES groups of a Chain to a Biojava Sequence object.- Specified by:
getBJSequencein interfaceChain- Returns:
- the SEQRES groups of the Chain as a Sequence object.
-
getAtomSequence
public java.lang.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:
getAtomSequencein interfaceChain- Returns:
- amino acid sequence as string
- See Also:
Chain.getSeqResSequence()
-
getSeqResSequence
public java.lang.String getSeqResSequence()
Returns the PDB SEQRES sequence as a one-letter sequence string. Non-standard residues are represented by an "X".- Specified by:
getSeqResSequencein interfaceChain- Returns:
- one-letter PDB SEQRES sequence as string
- See Also:
Chain.getAtomSequence()
-
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:
getSeqResGroupin interfaceChain- Parameters:
position- an int- Returns:
- a Group object
- See Also:
Chain.getSeqResLength(),Chain.getSeqResGroups(),Chain.getAtomGroup(int)
-
getSeqResGroups
public java.util.List<Group> getSeqResGroups(GroupType type)
Returns a List of all SEQRES groups of a special type, one of:GroupType.AMINOACID,GroupType.HETATMorGroupType.NUCLEOTIDE.- Specified by:
getSeqResGroupsin interfaceChain- Parameters:
type- a GroupType- Returns:
- an List object
- See Also:
Chain.setSeqResGroups(List)
-
getSeqResGroups
public java.util.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:
getSeqResGroupsin interfaceChain- Returns:
- a List of all Group objects of this chain
- See Also:
Chain.setSeqResGroups(List),Chain.getSeqResLength(),Chain.getAtomGroups()
-
setSeqResGroups
public void setSeqResGroups(java.util.List<Group> groups)
Sets the list of SeqResGroups for this chain.- Specified by:
setSeqResGroupsin interfaceChain- Parameters:
groups- a List of Group objects that from the SEQRES groups of this chain.- See Also:
Chain.getSeqResGroups()
-
addSeqResGroup
protected void addSeqResGroup(Group g)
-
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:
getAtomLengthin interfaceChain- Returns:
- the length
- See Also:
Chain.getAtomGroup(int),Chain.getAtomGroups()
-
getAtomLigands
public java.util.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:
getAtomLigandsin interfaceChain- Returns:
- list of Groups that are ligands
-
getInternalChainID
public java.lang.String getInternalChainID()
Description copied from interface:ChainIf available, returns the internal chain ID that is used in mmCIF files (asym_id), otherwise null- Specified by:
getInternalChainIDin interfaceChain- Returns:
- String or null
-
setInternalChainID
public void setInternalChainID(java.lang.String internalChainID)
Description copied from interface:ChainSets the internal chain ID that is used in mmCif files- Specified by:
setInternalChainIDin interfaceChain
-
toPDB
public java.lang.String toPDB()
Description copied from interface:ChainConvert this Chain to a String in PDB format
-
toMMCIF
public java.lang.String toMMCIF()
Description copied from interface:ChainConvert this Chain to a String in mmCIF format
-
setSeqMisMatches
public void setSeqMisMatches(java.util.List<SeqMisMatch> seqMisMatches)
Description copied from interface:ChainSet annotated sequence mismatches for this chain. This is based on the STRUCT_REF_SEQ_DIF mmCif category- Specified by:
setSeqMisMatchesin interfaceChain
-
getSeqMisMatches
public java.util.List<SeqMisMatch> getSeqMisMatches()
Description copied from interface:ChainGet annotated sequence mismatches for this chain. This is based on the STRUCT_REF_SEQ_DIF mmCif category- Specified by:
getSeqMisMatchesin interfaceChain
-
-