org.biojava.bio.structure
Class StructureImpl

java.lang.Object
  extended by org.biojava.bio.structure.StructureImpl
All Implemented Interfaces:
Structure

public class StructureImpl
extends Object
implements Structure

Implementation of a PDB Structure. This class provides the data contained in a PDB file. to get structure objects from different sources see io package.

Since:
1.4
Version:
%I% %G%
Author:
Andreas Prlic

Constructor Summary
StructureImpl()
          Constructs a StructureImpl object.
StructureImpl(Chain c)
          construct a Structure object that contains a particular chain
StructureImpl(Group g)
          construct a Structure object that only contains a single group
 
Method Summary
 void addChain(Chain chain)
          add a new chain.
 void addChain(Chain chain, int modelnr)
          add a new chain, if several models are available.
 void addModel(List model)
          add a new model.
 Object clone()
          returns an identical copy of this structure .
 Chain findChain(String chainId)
          request a particular chain from a structure.
 Chain findChain(String chainId, int modelnr)
          request a particular chain from a particular model
 Group findGroup(String chainName, String pdbResnum)
          request a particular group from a structure.
 Group findGroup(String chainId, String pdbResnum, int modelnr)
          request a particular group from a structure.
 Chain getChain(int number)
          retrieve a chain by it's position within the Structure.
 Chain getChain(int modelnr, int number)
          retrieve a chain by it's position within the Structure and model number.
 Chain getChainByPDB(String chainId)
          request a chain by it's PDB code by default takes only the first model
 Chain getChainByPDB(String chainId, int modelnr)
          request a chain by it's PDB code by default takes only the first model
 List getChains(int modelnr)
          retrieve all chains of a model.
 List getConnections()
          Returns the connections value.
 Map getHeader()
          get Header data.
 List getModel(int modelnr)
          retrieve all Chains belonging to a model .
 String getName()
          get biological name of Structure.
 String getPDBCode()
          get PDB code of structure .
 boolean hasChain(String chainId)
          check if a chain with the id chainId is contained in this structure.
 boolean isNmr()
          is this structure an nmr structure ?
 int nrModels()
          return number of models.
 void setConnections(List conns)
          sets/gets an List of Maps which corresponds to the CONECT lines in the PDB file:
 void setHeader(Map h)
          set the Header data.
 void setName(String nam)
          set biological name of Structure.
 void setNmr(boolean nmr)
          set NMR flag.
 void setPDBCode(String pdb_id_)
          set PDB code of structure .
 int size()
          return number of chains , if NMR return number of chains of first model .
 int size(int modelnr)
          return number of chains of model.
 String toPDB()
          create a String that contains the contents of a PDB file.
 String toString()
          string representation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StructureImpl

public StructureImpl()
Constructs a StructureImpl object.


StructureImpl

public StructureImpl(Group g)
construct a Structure object that only contains a single group

Parameters:
g -

StructureImpl

public StructureImpl(Chain c)
construct a Structure object that contains a particular chain

Parameters:
c -
Method Detail

clone

public Object clone()
returns an identical copy of this structure .

Specified by:
clone in interface Structure
Overrides:
clone in class Object
Returns:
an identical Structure object

findGroup

public Group findGroup(String chainId,
                       String pdbResnum,
                       int modelnr)
                throws StructureException
Description copied from interface: Structure
request a particular group from a structure. considers only model nr X. count starts with 0.

Specified by:
findGroup in interface Structure
Parameters:
chainId - the ID of the chain to use
pdbResnum - the PDB residue number of the requested group
modelnr - the number of the model to use
Returns:
Group the requested Group
Throws:
StructureException

findGroup

public Group findGroup(String chainName,
                       String pdbResnum)
                throws StructureException
Description copied from interface: Structure
request a particular group from a structure. by default considers only the first model in the structure.

Specified by:
findGroup in interface Structure
Parameters:
chainName - the ID of the chain to use
pdbResnum - the PDB residue number of the requested group
Returns:
Group the requested Group
Throws:
StructureException

findChain

public Chain findChain(String chainId,
                       int modelnr)
                throws StructureException
Description copied from interface: Structure
request a particular chain from a particular model

Specified by:
findChain in interface Structure
Parameters:
chainId - the ID of a chain that should be returned
modelnr - the number of the model to use
Returns:
Chain the requested chain
Throws:
StructureException

findChain

public Chain findChain(String chainId)
                throws StructureException
Description copied from interface: Structure
request a particular chain from a structure. by default considers only the first model.

Specified by:
findChain in interface Structure
Parameters:
chainId - the ID of a chain that should be returned
Returns:
Chain the requested chain
Throws:
StructureException

setPDBCode

public void setPDBCode(String pdb_id_)
set PDB code of structure .

Specified by:
setPDBCode in interface Structure
Parameters:
pdb_id_ - a String specifying the PDBCode
See Also:
getPDBCode()

getPDBCode

public String getPDBCode()
get PDB code of structure .

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

setName

public void setName(String nam)
set biological name of Structure.

Specified by:
setName in interface Structure
Parameters:
nam - a String specifying the biological name of the Structure
See Also:
getName()

getName

public String getName()
get biological name of Structure.

Specified by:
getName in interface Structure
Returns:
a String representing the name
See Also:
setName(java.lang.String)

setHeader

public void setHeader(Map h)
set the Header data.

Specified by:
setHeader in interface Structure
Parameters:
h - a Map object specifying the header
See Also:
getHeader()

getHeader

public Map getHeader()
get Header data.

Specified by:
getHeader in interface Structure
Returns:
a Map object representing the header of the Structure
See Also:
setHeader(java.util.Map)

setConnections

public void setConnections(List conns)
Description copied from interface: Structure
sets/gets an List of Maps which corresponds to the CONECT lines in the PDB file:
       COLUMNS         DATA TYPE        FIELD           DEFINITION
       ---------------------------------------------------------------------------------
        1 -  6         Record name      "CONECT"
        7 - 11         Integer          serial          Atom serial number
       12 - 16         Integer          serial          Serial number of bonded atom
       17 - 21         Integer          serial          Serial number of bonded atom
       22 - 26         Integer          serial          Serial number of bonded atom
       27 - 31         Integer          serial          Serial number of bonded atom
       32 - 36         Integer          serial          Serial number of hydrogen bonded
       atom
       37 - 41         Integer          serial          Serial number of hydrogen bonded
       atom
       42 - 46         Integer          serial          Serial number of salt bridged
       atom
       47 - 51         Integer          serial          Serial number of hydrogen bonded
       atom
       52 - 56         Integer          serial          Serial number of hydrogen bonded
       atom
       57 - 61         Integer          serial          Serial number of salt bridged
       atom
       
the HashMap for a single CONECT line contains the following fields:
  • atomserial (mandatory) : Atom serial number
  • bond1 .. bond4 (optional): Serial number of bonded atom
  • hydrogen1 .. hydrogen4 (optional):Serial number of hydrogen bonded atom
  • salt1 .. salt2 (optional): Serial number of salt bridged atom
  • Specified by:
    setConnections in interface Structure
    Parameters:
    conns - a List object specifying the connections
    See Also:
    interface.

    getConnections

    public List getConnections()
    Returns the connections value.

    Specified by:
    getConnections in interface Structure
    Returns:
    a List object representing the connections value
    See Also:
    interface, setConnections(java.util.List)

    addChain

    public void addChain(Chain chain)
    add a new chain.

    Specified by:
    addChain in interface Structure
    Parameters:
    chain - a Chain object

    addChain

    public void addChain(Chain chain,
                         int modelnr)
    add a new chain, if several models are available.

    Specified by:
    addChain in interface Structure
    Parameters:
    chain - a Chain object
    modelnr - an int specifying to which model the Chain should be added

    getChain

    public Chain getChain(int number)
    retrieve a chain by it's position within the Structure.

    Specified by:
    getChain in interface Structure
    Parameters:
    number - an int
    Returns:
    a Chain object

    getChain

    public Chain getChain(int modelnr,
                          int number)
    retrieve a chain by it's position within the Structure and model number.

    Specified by:
    getChain in interface Structure
    Parameters:
    modelnr - an int
    number - an int
    Returns:
    a Chain object

    addModel

    public void addModel(List model)
    add a new model.

    Specified by:
    addModel in interface Structure
    Parameters:
    model - a List object containing the Chains of the new Model

    toString

    public String toString()
    string representation.

    Specified by:
    toString in interface Structure
    Overrides:
    toString in class Object

    size

    public int size()
    return number of chains , if NMR return number of chains of first model .

    Specified by:
    size in interface Structure
    Returns:
    an int representing the number of Chains in this Structure

    size

    public int size(int modelnr)
    return number of chains of model.

    Specified by:
    size in interface Structure
    Parameters:
    modelnr - an int specifying the number of the Model that should be used
    Returns:
    an int representing the number of Chains in this Model

    nrModels

    public int nrModels()
    return number of models.

    Specified by:
    nrModels in interface Structure
    Returns:
    an int representing the number of models in this Structure

    isNmr

    public boolean isNmr()
    is this structure an nmr structure ?

    Specified by:
    isNmr in interface Structure
    Returns:
    true if this Structure has been resolved by NMR

    setNmr

    public void setNmr(boolean nmr)
    Description copied from interface: Structure
    set NMR flag.

    Specified by:
    setNmr in interface Structure
    Parameters:
    nmr - true to declare that this Structure has been solved by NMR.

    getChains

    public List getChains(int modelnr)
    retrieve all chains of a model.

    Specified by:
    getChains in interface Structure
    Parameters:
    modelnr - an int
    Returns:
    a List object
    See Also:
    Structure.getModel(int)

    getModel

    public List getModel(int modelnr)
    retrieve all Chains belonging to a model .

    Specified by:
    getModel in interface Structure
    Parameters:
    modelnr - an int
    Returns:
    a List object
    See Also:
    Structure.getChains(int)

    getChainByPDB

    public Chain getChainByPDB(String chainId,
                               int modelnr)
                        throws StructureException
    Description copied from interface: Structure
    request a chain by it's PDB code by default takes only the first model

    Specified by:
    getChainByPDB in interface Structure
    Parameters:
    chainId - the chain identifier
    modelnr - request a particular model;
    Returns:
    the Chain that matches the chainID in the model
    Throws:
    StructureException

    getChainByPDB

    public Chain getChainByPDB(String chainId)
                        throws StructureException
    Description copied from interface: Structure
    request a chain by it's PDB code by default takes only the first model

    Specified by:
    getChainByPDB in interface Structure
    Parameters:
    chainId - the chain identifier
    Returns:
    the Chain that matches the chainID
    Throws:
    StructureException

    toPDB

    public String toPDB()
    create a String that contains the contents of a PDB file.

    Specified by:
    toPDB in interface Structure
    Returns:
    a String that represents the structure as a PDB file.

    hasChain

    public boolean hasChain(String chainId)
    Description copied from interface: Structure
    check if a chain with the id chainId is contained in this structure.

    Specified by:
    hasChain in interface Structure
    Parameters:
    chainId - the name of the chain
    Returns:
    true if a chain with the id (name) chainId is found