org.biojava.bio.structure
Class HetatomImpl

java.lang.Object
  extended by org.biojava.bio.structure.HetatomImpl
All Implemented Interfaces:
Serializable, Group
Direct Known Subclasses:
AminoAcidImpl, NucleotideImpl, SecStrucGroup

public class HetatomImpl
extends Object
implements Group, 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

Field Summary
protected  List<Atom> atoms
           
protected  boolean pdb_flag
           
protected  String pdb_name
           
protected  ResidueNumber residueNumber
           
static String type
          this is a "hetatm".
 
Constructor Summary
HetatomImpl()
           
 
Method Summary
 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 atoms
 Object clone()
          returns and identical copy of this Group object .
 List<Group> getAltLocs()
          Get the list of alternate locations.
 Atom getAtom(int position)
          return an atom by its position in the internal List.
 Atom getAtom(String name)
          get an atom throws StructureException if atom not found.
 Atom getAtomByPDBname(String name)
          Get an atom by the full PDB name e.g.
 List<Atom> getAtoms()
          get all atoms of this group .
 Chain getChain()
          Returns the parent Chain of the Group.
 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 ID
 Chain getParent()
          Returns the parent Chain of the Group
 String getPDBCode()
          Deprecated. replaced by #getSeqNum
 String getPDBName()
          Returns the PDBName.
 Map<String,Object> getProperties()
          return properties.
 Object getProperty(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.
 String getType()
          Returns the type value.
 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 a groups has all atoms required for an amino acid this allows to include chemically modified amino acids that are labeled hetatoms into some computations ...
 boolean hasAtom(String fullName)
          test is an Atom with name is existing.
 Iterator<Atom> iterator()
          return an AtomIterator.
 void setAtoms(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 ID
 void setParent(Chain parent)
          Set the back-reference (to its parent Chain)
 void setPDBCode(String pdb_code)
          Deprecated. replaced by setResidueNumber(ResidueNumber)
 void setPDBFlag(boolean flag)
          flag if group has 3D data.
 void setPDBName(String s)
          set three character name of Group .
 void setProperties(Map<String,Object> props)
          properties of this amino acid.
 void setProperty(String key, Object value)
          set a single property .
 void setResidueNumber(ResidueNumber residueNumber)
          sets the ResidueNumber for this Group
 void setResidueNumber(String chainId, Integer resNum, Character iCode)
          Utility method to temporarily set a chainID for a group, if a parent chain object does not exist yet.
 int size()
          getnumber of atoms.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public static final String type
this is a "hetatm".

See Also:
Constant Field Values

pdb_flag

protected boolean pdb_flag

pdb_name

protected String pdb_name

residueNumber

protected ResidueNumber residueNumber

atoms

protected List<Atom> atoms
Constructor Detail

HetatomImpl

public HetatomImpl()
Method Detail

has3D

public boolean has3D()
returns true or false, depending if this group has 3D coordinates or not.

Specified by:
has3D in interface Group
Returns:
true if Group has 3D coordinates

setPDBFlag

public void setPDBFlag(boolean flag)
flag if group has 3D data.

Specified by:
setPDBFlag in interface Group
Parameters:
flag - true to set flag that this Group has 3D coordinates

getPDBCode

@Deprecated
public String getPDBCode()
Deprecated. replaced by #getSeqNum

Returns the PDBCode.

Specified by:
getPDBCode in interface Group
Returns:
a String representing the PDBCode value
See Also:
setPDBCode(java.lang.String)

setPDBCode

@Deprecated
public void setPDBCode(String pdb_code)
Deprecated. replaced by setResidueNumber(ResidueNumber)

set the PDB code.

Specified by:
setPDBCode in interface Group
Parameters:
pdb_code - a String specifying the PDBCode value
See Also:
getPDBCode()

setPDBName

public void setPDBName(String s)
                throws PDBParseException
set three character name of Group .

Specified by:
setPDBName in interface Group
Parameters:
s - a String specifying the PDBName value
Throws:
PDBParseException - ...
See Also:
getPDBName()

getPDBName

public String getPDBName()
Returns the PDBName.

Specified by:
getPDBName in interface Group
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.

Specified by:
addAtom in interface Group
Parameters:
atom - an Atom object

clearAtoms

public void clearAtoms()
remove all atoms

Specified by:
clearAtoms in interface Group

size

public int size()
getnumber of atoms.

Specified by:
size in interface Group
Returns:
number of atoms

getAtoms

public List<Atom> getAtoms()
get all atoms of this group . returns a List of all atoms in this Group

Specified by:
getAtoms in interface Group
Returns:
an List object representing the atoms value
See Also:
Group.setAtoms(List)

setAtoms

public void setAtoms(List<Atom> atoms)
set the atoms of this group

Specified by:
setAtoms in interface Group
Parameters:
atoms - a list of atoms
See Also:
Atom

getAtom

public Atom getAtom(String name)
             throws StructureException
get an atom throws StructureException if atom not found.

Specified by:
getAtom in interface Group
Parameters:
name - a String
Returns:
an Atom object
Throws:
StructureException - ...

getAtomByPDBname

public Atom getAtomByPDBname(String name)
                      throws StructureException
Get an atom by the full PDB name e.g. " N " for N. Throws StructureException if atom not found.

Specified by:
getAtomByPDBname in interface Group
Parameters:
name - a String
Returns:
an Atom object
Throws:
StructureException - ...

getAtom

public Atom getAtom(int position)
             throws StructureException
return an atom by its position in the internal List.

Specified by:
getAtom in interface Group
Parameters:
position - an int
Returns:
an Atom object
Throws:
StructureException - ...

hasAtom

public boolean hasAtom(String fullName)
test is an Atom with name is existing.

Specified by:
hasAtom in interface Group
Parameters:
fullName - a String ...
Returns:
true if Atom with name is existing within this group

getType

public String getType()
Returns the type value.

Specified by:
getType in interface Group
Returns:
a String representing the type value

toString

public String toString()
Overrides:
toString in class Object

hasAminoAtoms

public boolean hasAminoAtoms()
calculate if a groups has all atoms required for an amino acid 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 is getType() !

amino atoms are : N, CA, C, O, CB GLY does not have CB (unless we would calculate some artificially

Example: 1DW9 parent 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 interface Group
Returns:
true if all Atoms required for an AminoAcid are available (N, CA, C, O, CB)
See Also:
getType()

setProperties

public void setProperties(Map<String,Object> props)
properties of this amino acid. currerntly available properties. are: phi psi

Specified by:
setProperties in interface Group
Parameters:
props - a Map object specifying the properties value
See Also:
getProperties()

getProperties

public Map<String,Object> getProperties()
return properties.

Specified by:
getProperties in interface Group
Returns:
a HashMap object representing the properties value
See Also:
setProperties(java.util.Map)

setProperty

public void setProperty(String key,
                        Object value)
set a single property .

Specified by:
setProperty in interface Group
Parameters:
key - a String
value - an Object
See Also:
getProperties(), getProperty(java.lang.String)

getProperty

public Object getProperty(String key)
get a single property .

Specified by:
getProperty in interface Group
Parameters:
key - a String
Returns:
an Object
See Also:
setProperty(java.lang.String, java.lang.Object), setProperties(java.util.Map)

iterator

public Iterator<Atom> iterator()
return an AtomIterator.

Specified by:
iterator in interface Group
Returns:
an Iterator object

clone

public Object clone()
returns and identical copy of this Group object .

Specified by:
clone in interface Group
Overrides:
clone in class Object
Returns:
and identical copy of this Group object

setParent

public void setParent(Chain parent)
Set the back-reference (to its parent Chain)

Specified by:
setParent in interface Group
Parameters:
parent - the parent Chain
See Also:
Group.setChain(Chain), Group.getChain()

getParent

public Chain getParent()
Returns the parent Chain of the Group

Specified by:
getParent in interface Group
Returns:
Chain the Chain object that contains the Group
See Also:
Group.setChain(Chain)

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 interface Group
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 interface Group
Parameters:
cc - the chemical component

setChain

public void setChain(Chain chain)
Sets the back-reference to its parent Chain.

Specified by:
setChain in interface Group
Parameters:
chain - the parent Chain
See Also:
Group.getChain()

getChain

public Chain getChain()
Returns the parent Chain of the Group.

Specified by:
getChain in interface Group
Returns:
Chain the Chain object that contains the Group
See Also:
Group.setChain(Chain)

getChainId

public 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 interface Group
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 interface Group
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 interface Group
Parameters:
residueNumber - the PDB residueNumber

setResidueNumber

public void setResidueNumber(String chainId,
                             Integer resNum,
                             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 interface Group

hasAltLoc

public boolean hasAltLoc()
Description copied from interface: Group
Test if this group has alternate locations.

Specified by:
hasAltLoc in interface Group
Returns:
boolean flag if there are alternate locations.

getAltLocs

public List<Group> getAltLocs()
Description copied from interface: Group
Get the list of alternate locations.

Specified by:
getAltLocs in interface Group
Returns:
List of other groups that are on alternate locations

addAltLoc

public void addAltLoc(Group group)
Description copied from interface: Group
Add a group that is an alternate location for this group.

Specified by:
addAltLoc in interface Group