org.biojava.bio.structure
Class ChainImpl

java.lang.Object
  extended by org.biojava.bio.structure.ChainImpl
All Implemented Interfaces:
Serializable, Chain

public class ChainImpl
extends Object
implements Chain, Serializable

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

Field Summary
static String DEFAULT_CHAIN_ID
          The default chain identifier is an empty space.
 
Constructor Summary
ChainImpl()
          Constructs a ChainImpl object.
 
Method Summary
 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 position .
 List<Group> getAtomGroups()
          Return all groups that have been specified in the ATOM section of this chain .
 List<Group> getAtomGroups(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.
 List<Group> getAtomLigands()
          Get all groups that are not polymer groups and that are not solvent groups.
 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.
 String getChainID()
          get and set the name of this chain (Chain id in PDB file ).
 Group getGroup(int position)
          Deprecated. use getAtomGroup or getSeqResGroup instead
 Group getGroupByPDB(ResidueNumber resNum)
          Get a group by its PDB residue numbering.
 Group getGroupByPDB(String pdbresnum)
          get a group by its PDB residue numbering.
 List<Group> getGroups()
          Deprecated. use getAtomGroups instead
 List<Group> getGroups(String type)
          Deprecated. use getAtomGroups instead
 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.
 Group[] getGroupsByPDB(String pdbresnumStart, String pdbresnumEnd)
          Get all groups that are located between two PDB residue numbers.
 Group[] getGroupsByPDB(String pdbresnumStart, 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.
 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.
 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.
 List<Group> getSeqResGroups()
          Return all groups of this chain.
 List<Group> getSeqResGroups(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.
 String getSeqResSequence()
          Get the sequence for all amino acids as it is specified in the SEQRES residues.
 String getSequence()
          Deprecated. use getAtomSequence instead
 String getSwissprotId()
          get the Swissprot id of this chains .
 void setAtomGroups(List<Group> groups)
          Set all groups that have been specified in the ATOM section of this chain .
 void setChainID(String nam)
          get and set the name of this chain (Chain id in PDB file ).
 void setHeader(Compound mol)
          Set the Header from the PDB file.
 void setId(Long id)
          Set the ID used by Hibernate.
 void setName(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(List<Group> groups)
          Set the list of SeqResGroups for this chain.
 void setSwissprotId(String sp_id)
          set the Swissprot id of this chains .
 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 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 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(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()

getParent

public Structure getParent()
Returns the parent Structure of this chain.

Specified by:
getParent in interface Chain
Returns:
the parent Structure object
See Also:
Chain.setParent(Structure)

clone

public Object clone()
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

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(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()

getSwissprotId

public String getSwissprotId()
get the Swissprot id of this chains .

Specified by:
getSwissprotId in interface Chain
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.

Specified by:
addGroup in interface Chain
Parameters:
group - a Group object

getGroup

public Group getGroup(int position)
Deprecated. use getAtomGroup or getSeqResGroup instead

return the group at position .

Specified by:
getGroup in interface Chain
Parameters:
position - an int
Returns:
a Group object
See Also:
Chain.getAtomGroup(int), Chain.getSeqResGroup(int)

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 List<Group> getGroups(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 List<Group> getAtomGroups(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 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 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(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(String pdbresnumStart,
                              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

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
end - 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(String pdbresnum)
                    throws StructureException
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

getGroupByPDB

public Group getGroupByPDB(ResidueNumber resNum)
                    throws StructureException
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:
resNum - the PDB residue number of the group
Returns:
the matching group
Throws:
StructureException

getGroupsByPDB

public Group[] getGroupsByPDB(String pdbresnumStart,
                              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

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 interface Chain
Parameters:
start - PDB residue number of start
end - 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(String nam)
Description copied from interface: Chain
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:
Chain.getName()

getName

public String getName()
Description copied from interface: Chain
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:
Chain.setName(java.lang.String)

setChainID

public void setChainID(String nam)
get and set the name of this chain (Chain id in PDB file ).

Specified by:
setChainID in interface Chain
Parameters:
nam - a String specifying the name value
See Also:
getChainID()

getChainID

public String getChainID()
get and set the name of this chain (Chain id in PDB file ).

Specified by:
getChainID in interface Chain
Returns:
a String representing the name value
See Also:
setName(java.lang.String)

toString

public String toString()
String representation.

Specified by:
toString in interface Chain
Overrides:
toString in class Object
Returns:
String representation of the Chain

getBJSequence

public Sequence<?> getBJSequence()
Convert 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.
Throws:
IllegalSymbolException

getSequence

public 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 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 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 List<Group> getSeqResGroups(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)

getSeqResGroups

public List<Group> getSeqResGroups()
Return all groups of this chain.

Specified by:
getSeqResGroups in interface Chain
Returns:
a List of all Group objects of this chain
See Also:
Chain.setSeqResGroups(List)

setSeqResGroups

public void setSeqResGroups(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

getAtomLigands

public List<Group> getAtomLigands()
Get 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 if PDBFileReader.setLoadChemCompInfo(flag) has not been set to true. Otherwise the Ligands could not correctly be identified.

Specified by:
getAtomLigands in interface Chain
Returns:
list of Groups that are ligands