Package org.biojava.nbio.structure
Class HetatomImpl
- java.lang.Object
-
- org.biojava.nbio.structure.HetatomImpl
-
- All Implemented Interfaces:
java.io.Serializable
,Group
- Direct Known Subclasses:
AminoAcidImpl
,NucleotideImpl
public class HetatomImpl extends java.lang.Object implements Group, java.io.Serializable
Generic Implementation of a Group interface. AminoAcidImpl and NucleotideImpl are closely related classes.- Since:
- 1.4
- Version:
- %I% %G%
- Author:
- Andreas Prlic, Horvath Tamas
- See Also:
AminoAcidImpl
,NucleotideImpl
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HetatomImpl.PerformanceBehavior
Behaviors for how to balance memory vs.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Atom>
atoms
protected ChemComp
chemComp
protected boolean
pdb_flag
stores if 3d coordinates are available.protected java.lang.String
pdb_name
3 letter name of amino acid in pdb file.static HetatomImpl.PerformanceBehavior
performanceBehavior
protected ResidueNumber
residueNumber
static GroupType
type
The GroupType is HETATM
-
Constructor Summary
Constructors Constructor Description HetatomImpl()
Construct a Hetatom instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAltLoc(Group group)
Add a group that is an alternate location for this group.void
addAtom(Atom atom)
Add an atom to this group.void
clearAtoms()
remove all atomsjava.lang.Object
clone()
returns and identical copy of this Group object .Group
getAltLocGroup(java.lang.Character altLoc)
Gets the alternate location group to this group that has the alt-loc character code passed.java.util.List<Group>
getAltLocs()
Get the list of alternate locations.Atom
getAtom(int position)
Get at atom by position.Atom
getAtom(java.lang.String name)
Get an atom given its PDB name.java.util.List<Atom>
getAtoms()
Get list of atoms.Chain
getChain()
Returns the parent Chain of the Group.java.lang.String
getChainId()
Utility method for returning the chainId of the Group or null if no Chain has been set.ChemComp
getChemComp()
Get the chemical component that closer describes this group.long
getId()
the Hibernate database IDjava.lang.String
getPDBName()
Returns the PDBName.java.util.Map<java.lang.String,java.lang.Object>
getProperties()
return properties.java.lang.Object
getProperty(java.lang.String key)
get a single property .ResidueNumber
getResidueNumber()
returns a dynamically created ResidueNumber for the group - this contains the chainId, resNum and insCode of the group.GroupType
getType()
boolean
has3D()
returns true or false, depending if this group has 3D coordinates or not.boolean
hasAltLoc()
Test if this group has alternate locations.boolean
hasAminoAtoms()
Calculate if this group has all atoms required for an amino acid backbone.boolean
hasAtom(java.lang.String fullName)
Tell whether a particular atom exists within this group.boolean
isWater()
Determines if this group is water.java.util.Iterator<Atom>
iterator()
return an AtomIterator.void
setAtoms(java.util.List<Atom> atoms)
Set the atoms of this group.void
setChain(Chain chain)
Sets the back-reference to its parent Chain.void
setChemComp(ChemComp cc)
Set the Chemical Component that closer describes this group.void
setId(long id)
the Hibernate database IDvoid
setPDBFlag(boolean flag)
flag if group has 3D data.void
setPDBName(java.lang.String s)
Set three character name of Group .void
setProperties(java.util.Map<java.lang.String,java.lang.Object> props)
Properties of this amino acid.void
setProperty(java.lang.String key, java.lang.Object value)
set a single property .void
setResidueNumber(java.lang.String chainId, java.lang.Integer resNum, java.lang.Character iCode)
Utility method to temporarily set a chainID for a group, if a parent chain object does not exist yet.void
setResidueNumber(ResidueNumber residueNumber)
sets the ResidueNumber for this Groupint
size()
Get number of atoms.java.lang.String
toSDF()
Function to get the Group as an MDL molblockjava.lang.String
toString()
void
trimToSize()
attempts to reduce the memory imprint of this group by trimming all internal Collection objects to the required size.
-
-
-
Field Detail
-
type
public static final GroupType type
The GroupType is HETATM
-
pdb_flag
protected boolean pdb_flag
stores if 3d coordinates are available.
-
pdb_name
protected java.lang.String pdb_name
3 letter name of amino acid in pdb file.
-
residueNumber
protected ResidueNumber residueNumber
-
atoms
protected java.util.List<Atom> atoms
-
performanceBehavior
public static HetatomImpl.PerformanceBehavior performanceBehavior
-
chemComp
protected ChemComp chemComp
-
-
Method Detail
-
has3D
public boolean has3D()
returns true or false, depending if this group has 3D coordinates or not.
-
setPDBFlag
public void setPDBFlag(boolean flag)
flag if group has 3D data.- Specified by:
setPDBFlag
in interfaceGroup
- Parameters:
flag
- true to set flag that this Group has 3D coordinates
-
setPDBName
public void setPDBName(java.lang.String s)
Set three character name of Group .- Specified by:
setPDBName
in interfaceGroup
- Parameters:
s
- a String specifying the PDBName value- See Also:
getPDBName()
-
getPDBName
public java.lang.String getPDBName()
Returns the PDBName.- Specified by:
getPDBName
in interfaceGroup
- Returns:
- a String representing the PDBName value
- See Also:
setPDBName(java.lang.String)
-
addAtom
public void addAtom(Atom atom)
Add an atom to this group.
-
clearAtoms
public void clearAtoms()
remove all atoms- Specified by:
clearAtoms
in interfaceGroup
-
size
public int size()
Get number of atoms.
-
getAtoms
public java.util.List<Atom> getAtoms()
Get list of atoms.- Specified by:
getAtoms
in interfaceGroup
- Returns:
- a List object representing the atoms
- See Also:
Group.setAtoms(List)
-
setAtoms
public void setAtoms(java.util.List<Atom> atoms)
Set the atoms of this group.
-
getAtom
public Atom getAtom(java.lang.String name)
Get an atom given its PDB name. Beware that some PDB atom names are ambiguous (e.g. CA, which means C-alpha or Calcium), ambiguities should not occur within the same group though. To solve these ambiguities one would need to check the atom returned for the required element withAtom.getElement()
-
getAtom
public Atom getAtom(int position)
Get at atom by position.
-
hasAtom
public boolean hasAtom(java.lang.String fullName)
Tell whether a particular atom exists within this group. Beware that some PDB atom names are ambiguous (e.g. CA, which means C-alpha or Calcium), ambiguities should not occur within the same group though.
-
getType
public GroupType getType()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hasAminoAtoms
public boolean hasAminoAtoms()
Calculate if this group has all atoms required for an amino acid backbone. This allows to include chemically modified amino acids that are labeled hetatoms into some computations, the usual way to identify if a group is an amino acid isGroup.getType()
amino atoms are : N, CA, C, O
Example: 1DW9 chain A first group is a Selenomethionine, provided as HETATM, but here returns true.HETATM 1 N MSE A 1 11.720 20.973 1.584 0.00 0.00 N HETATM 2 CA MSE A 1 10.381 20.548 1.139 0.00 0.00 C HETATM 3 C MSE A 1 9.637 20.037 2.398 0.00 0.00 C HETATM 4 O MSE A 1 10.198 19.156 2.985 0.00 0.00 O HETATM 5 CB MSE A 1 10.407 19.441 0.088 0.00 0.00 C
- Specified by:
hasAminoAtoms
in interfaceGroup
- Returns:
- true if all Atoms required for an AminoAcid are available (N, CA, C, O)
- See Also:
Group.getType()
-
setProperties
public void setProperties(java.util.Map<java.lang.String,java.lang.Object> props)
Properties of this amino acid. Currently available properties are: phi psi secstruc- Specified by:
setProperties
in interfaceGroup
- Parameters:
props
- a Map object specifying the properties value- See Also:
Group.getProperties()
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
return properties.- Specified by:
getProperties
in interfaceGroup
- Returns:
- a HashMap object representing the properties value
- See Also:
setProperties(java.util.Map<java.lang.String, java.lang.Object>)
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)
set a single property .- Specified by:
setProperty
in interfaceGroup
- Parameters:
key
- a Stringvalue
- an Object- See Also:
getProperties()
,getProperty(java.lang.String)
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
get a single property .- Specified by:
getProperty
in interfaceGroup
- Parameters:
key
- a String- Returns:
- an Object
- See Also:
setProperty(java.lang.String, java.lang.Object)
,setProperties(java.util.Map<java.lang.String, java.lang.Object>)
-
iterator
public java.util.Iterator<Atom> iterator()
return an AtomIterator.
-
clone
public java.lang.Object clone()
returns and identical copy of this Group object .
-
getId
public long getId()
the Hibernate database ID- Returns:
- the id
-
setId
public void setId(long id)
the Hibernate database ID- Parameters:
id
- the hibernate id
-
getChemComp
public ChemComp getChemComp()
Description copied from interface:Group
Get the chemical component that closer describes this group. If the information does not exist yet, fetches the information from PDB web site.- Specified by:
getChemComp
in interfaceGroup
- Returns:
- the Chemical Component definition for this Group.
-
setChemComp
public void setChemComp(ChemComp cc)
Description copied from interface:Group
Set the Chemical Component that closer describes this group.- Specified by:
setChemComp
in interfaceGroup
- Parameters:
cc
- the chemical component
-
setChain
public void setChain(Chain chain)
Sets the back-reference to its parent Chain.- Specified by:
setChain
in interfaceGroup
- Parameters:
chain
- the parent Chain- See Also:
Group.getChain()
-
getChain
public Chain getChain()
Returns the parent Chain of the Group.- Specified by:
getChain
in interfaceGroup
- Returns:
- Chain the Chain object that contains the Group
- See Also:
Group.setChain(Chain)
-
getChainId
public java.lang.String getChainId()
Utility method for returning the chainId of the Group or null if no Chain has been set. This replaces the need to use the expression group.getChain().getId()- Specified by:
getChainId
in interfaceGroup
- Returns:
- the ID of the chain
-
getResidueNumber
public ResidueNumber getResidueNumber()
returns a dynamically created ResidueNumber for the group - this contains the chainId, resNum and insCode of the group.- Specified by:
getResidueNumber
in interfaceGroup
- Returns:
- ResidueNumber for the group.
- See Also:
ResidueNumber
-
setResidueNumber
public void setResidueNumber(ResidueNumber residueNumber)
Description copied from interface:Group
sets the ResidueNumber for this Group- Specified by:
setResidueNumber
in interfaceGroup
- Parameters:
residueNumber
- the PDB residueNumber
-
setResidueNumber
public void setResidueNumber(java.lang.String chainId, java.lang.Integer resNum, java.lang.Character iCode)
Description copied from interface:Group
Utility method to temporarily set a chainID for a group, if a parent chain object does not exist yet. Not recommended for general use other than parsing.- Specified by:
setResidueNumber
in interfaceGroup
-
hasAltLoc
public boolean hasAltLoc()
Description copied from interface:Group
Test if this group has alternate locations.
-
getAltLocs
public java.util.List<Group> getAltLocs()
Description copied from interface:Group
Get the list of alternate locations.- Specified by:
getAltLocs
in interfaceGroup
- Returns:
- List of other groups that are on alternate locations
-
getAltLocGroup
public Group getAltLocGroup(java.lang.Character altLoc)
Description copied from interface:Group
Gets the alternate location group to this group that has the alt-loc character code passed.- Specified by:
getAltLocGroup
in interfaceGroup
- Parameters:
altLoc
- the alternate location code of the group desired- Returns:
- the alternate location group if found, or null otherwise
-
addAltLoc
public void addAltLoc(Group group)
Description copied from interface:Group
Add a group that is an alternate location for this group.
-
isWater
public boolean isWater()
Description copied from interface:Group
Determines if this group is water.
-
trimToSize
public void trimToSize()
attempts to reduce the memory imprint of this group by trimming all internal Collection objects to the required size.- Specified by:
trimToSize
in interfaceGroup
-
-