Package org.biojava.bio.structure
Class StructureImpl
- java.lang.Object
-
- org.biojava.bio.structure.StructureImpl
-
- All Implemented Interfaces:
java.lang.Cloneable
,Structure
public class StructureImpl extends java.lang.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, Jules Jacobsen
-
-
Constructor Summary
Constructors Constructor Description StructureImpl()
Constructs a StructureImpl object.StructureImpl(Chain c)
construct a Structure object that contains a particular chainStructureImpl(Group g)
construct a Structure object that only contains a single group
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(java.util.List<Chain> model)
add a new model.void
addSSBond(SSBond ssbond)
add a single SSBond to this structureStructure
clone()
returns an identical copy of this structure .Chain
findChain(java.lang.String chainId)
request a particular chain from a structure.Chain
findChain(java.lang.String chainId, int modelnr)
request a particular chain from a particular modelGroup
findGroup(java.lang.String chainName, java.lang.String pdbResnum)
request a particular group from a structure.Group
findGroup(java.lang.String chainId, java.lang.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(java.lang.String chainId)
request a chain by it's PDB code by default takes only the first modelChain
getChainByPDB(java.lang.String chainId, int modelnr)
request a chain by it's PDB code by default takes only the first modeljava.util.List<Chain>
getChains()
retrieve all chains - if it is a NMR structure will return the chains of the first model.java.util.List<Chain>
getChains(int modelnr)
retrieve all chains of a model.Compound
getCompoundById(java.lang.String molId)
request a particular compound by its idjava.util.List<Compound>
getCompounds()
get all the Compounds that are defined in the PDB Headerjava.util.List<java.util.Map<java.lang.String,java.lang.Integer>>
getConnections()
Returns the connections value.java.util.List<DBRef>
getDBRefs()
get the list of database referencesjava.util.Map<java.lang.String,java.lang.Object>
getHeader()
get Header data.java.lang.Long
getId()
get the ID used by HibernateJournalArticle
getJournalArticle()
get the associated publication as defined by the JRNL records in a PDB file.java.util.List<Chain>
getModel(int modelnr)
retrieve all Chains belonging to a model .java.lang.String
getName()
get biological name of Structure.java.lang.String
getPDBCode()
get PDB code of structure .PDBHeader
getPDBHeader()
return the header information for this PDB filejava.util.List<SSBond>
getSSBonds()
get the list of SSBonds as they have been defined in the PDB filesboolean
hasChain(java.lang.String chainId)
check if a chain with the id chainId is contained in this structure.boolean
hasJournalArticle()
Return whether or not the entry has an associated journal article or publication.boolean
isNmr()
is this structure an nmr structure ?int
nrModels()
return number of models.void
setChains(int modelnr, java.util.List<Chain> chains)
set the chains for a modelvoid
setChains(java.util.List<Chain> chains)
set the chains of a structure, if this is a NMR structure, this will only set model 0.void
setCompounds(java.util.List<Compound> molList)
set the compountsvoid
setConnections(java.util.List<java.util.Map<java.lang.String,java.lang.Integer>> conns)
sets/gets an List of Maps which corresponds to the CONECT lines in the PDB file:void
setDBRefs(java.util.List<DBRef> dbrefs)
set the list of database references for this structurevoid
setHeader(java.util.Map<java.lang.String,java.lang.Object> h)
set the Header data.void
setId(java.lang.Long id)
set the ID used by Hibernatevoid
setJournalArticle(JournalArticle journalArticle)
set the associated publication as defined by the JRNL records in a PDB file.void
setModel(int position, java.util.List<Chain> model)
a convenience function if one wants to edit and replace the models in a structure.void
setName(java.lang.String nam)
set biological name of Structure.void
setNmr(boolean nmr)
set NMR flag.void
setPDBCode(java.lang.String pdb_id_)
set PDB code of structure .void
setPDBHeader(PDBHeader pdbHeader)
the the header information for this PDB filevoid
setSSBonds(java.util.List<SSBond> ssbonds)
set the list of SSBonds for this structureint
size()
return number of chains , if NMR return number of chains of first model .int
size(int modelnr)
return number of chains of model.java.lang.String
toPDB()
create a String that contains the contents of a PDB file.java.lang.String
toString()
string representation.
-
-
-
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
-
getId
public java.lang.Long getId()
get the ID used by Hibernate
-
setId
public void setId(java.lang.Long id)
set the ID used by Hibernate
-
clone
public Structure clone()
returns an identical copy of this structure .
-
findGroup
public Group findGroup(java.lang.String chainId, java.lang.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 interfaceStructure
- Parameters:
chainId
- the ID of the chain to usepdbResnum
- the PDB residue number of the requested groupmodelnr
- the number of the model to use- Returns:
- Group the requested Group
- Throws:
StructureException
-
findGroup
public Group findGroup(java.lang.String chainName, java.lang.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 interfaceStructure
- Parameters:
chainName
- the ID of the chain to usepdbResnum
- the PDB residue number of the requested group- Returns:
- Group the requested Group
- Throws:
StructureException
-
findChain
public Chain findChain(java.lang.String chainId, int modelnr) throws StructureException
Description copied from interface:Structure
request a particular chain from a particular model- Specified by:
findChain
in interfaceStructure
- Parameters:
chainId
- the ID of a chain that should be returnedmodelnr
- the number of the model to use- Returns:
- Chain the requested chain
- Throws:
StructureException
-
findChain
public Chain findChain(java.lang.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 interfaceStructure
- Parameters:
chainId
- the ID of a chain that should be returned- Returns:
- Chain the requested chain
- Throws:
StructureException
-
setPDBCode
public void setPDBCode(java.lang.String pdb_id_)
set PDB code of structure .- Specified by:
setPDBCode
in interfaceStructure
- Parameters:
pdb_id_
- a String specifying the PDBCode- See Also:
getPDBCode()
-
getPDBCode
public java.lang.String getPDBCode()
get PDB code of structure .- Specified by:
getPDBCode
in interfaceStructure
- Returns:
- a String representing the PDBCode value
- See Also:
setPDBCode(java.lang.String)
-
setName
public void setName(java.lang.String nam)
set biological name of Structure.
-
getName
public java.lang.String getName()
get biological name of Structure.- Specified by:
getName
in interfaceStructure
- Returns:
- a String representing the name
- See Also:
setName(java.lang.String)
-
setHeader
public void setHeader(java.util.Map<java.lang.String,java.lang.Object> h)
set the Header data.- Specified by:
setHeader
in interfaceStructure
- Parameters:
h
- a Map object specifying the header- See Also:
getHeader()
-
getHeader
public java.util.Map<java.lang.String,java.lang.Object> getHeader()
get Header data.- Specified by:
getHeader
in interfaceStructure
- Returns:
- a Map object representing the header of the Structure
- See Also:
setHeader(java.util.Map<java.lang.String, java.lang.Object>)
-
setConnections
public void setConnections(java.util.List<java.util.Map<java.lang.String,java.lang.Integer>> 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 interfaceStructure
- Parameters:
conns
- a List object specifying the connections- See Also:
interface.
-
getConnections
public java.util.List<java.util.Map<java.lang.String,java.lang.Integer>> getConnections()
Returns the connections value.- Specified by:
getConnections
in interfaceStructure
- Returns:
- a List object representing the connections value
- See Also:
interface
,setConnections(java.util.List<java.util.Map<java.lang.String, java.lang.Integer>>)
-
addChain
public void addChain(Chain chain)
add a new chain.
-
addChain
public void addChain(Chain chain, int modelnr)
add a new chain, if several models are available.
-
getChain
public Chain getChain(int number)
retrieve a chain by it's position within the Structure.
-
getChain
public Chain getChain(int modelnr, int number)
retrieve a chain by it's position within the Structure and model number.
-
addModel
public void addModel(java.util.List<Chain> model)
add a new model.
-
setChains
public void setChains(java.util.List<Chain> chains)
Description copied from interface:Structure
set the chains of a structure, if this is a NMR structure, this will only set model 0.- Specified by:
setChains
in interfaceStructure
- Parameters:
chains
- the list of chains for this structure.- See Also:
Structure.setChains(int, List)
-
setModel
public void setModel(int position, java.util.List<Chain> model)
Description copied from interface:Structure
a convenience function if one wants to edit and replace the models in a structure. allows to set (replace) the model at position with the new List of Chains.
-
toString
public java.lang.String toString()
string representation.
-
size
public int size()
return number of chains , if NMR return number of chains of first model .
-
size
public int size(int modelnr)
return number of chains of model.
-
nrModels
public int nrModels()
return number of models.
-
isNmr
public boolean isNmr()
is this structure an nmr structure ?
-
setNmr
public void setNmr(boolean nmr)
Description copied from interface:Structure
set NMR flag.
-
getChains
public java.util.List<Chain> getChains(int modelnr)
retrieve all chains of a model.- Specified by:
getChains
in interfaceStructure
- Parameters:
modelnr
- an int- Returns:
- a List object
- See Also:
Structure.getModel(int)
-
getChains
public java.util.List<Chain> getChains()
Description copied from interface:Structure
retrieve all chains - if it is a NMR structure will return the chains of the first model. This is the same as getChains(0);- Specified by:
getChains
in interfaceStructure
- Returns:
- a List object containing the Chains of Model nr. modelnr
- See Also:
Structure.getModel(int modelnr)
,Structure.getChains(int modelnr)
-
setChains
public void setChains(int modelnr, java.util.List<Chain> chains)
Description copied from interface:Structure
set the chains for a model
-
getModel
public java.util.List<Chain> getModel(int modelnr)
retrieve all Chains belonging to a model .- Specified by:
getModel
in interfaceStructure
- Parameters:
modelnr
- an int- Returns:
- a List object
- See Also:
Structure.getChains(int modelnr)
-
getChainByPDB
public Chain getChainByPDB(java.lang.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 interfaceStructure
- Parameters:
chainId
- the chain identifiermodelnr
- request a particular model;- Returns:
- the Chain that matches the chainID in the model
- Throws:
StructureException
-
getChainByPDB
public Chain getChainByPDB(java.lang.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 interfaceStructure
- Parameters:
chainId
- the chain identifier- Returns:
- the Chain that matches the chainID
- Throws:
StructureException
-
toPDB
public java.lang.String toPDB()
create a String that contains the contents of a PDB file.- Specified by:
toPDB
in interfaceStructure
- Returns:
- a String that represents the structure as a PDB file.
- See Also:
FileConvert
-
hasChain
public boolean hasChain(java.lang.String chainId)
Description copied from interface:Structure
check if a chain with the id chainId is contained in this structure.
-
setCompounds
public void setCompounds(java.util.List<Compound> molList)
Description copied from interface:Structure
set the compounts- Specified by:
setCompounds
in interfaceStructure
-
getCompounds
public java.util.List<Compound> getCompounds()
Description copied from interface:Structure
get all the Compounds that are defined in the PDB Header- Specified by:
getCompounds
in interfaceStructure
- Returns:
- a list of compound
-
getCompoundById
public Compound getCompoundById(java.lang.String molId)
Description copied from interface:Structure
request a particular compound by its id- Specified by:
getCompoundById
in interfaceStructure
- Returns:
- a compound
-
getDBRefs
public java.util.List<DBRef> getDBRefs()
Description copied from interface:Structure
get the list of database references
-
setDBRefs
public void setDBRefs(java.util.List<DBRef> dbrefs)
Description copied from interface:Structure
set the list of database references for this structure
-
getPDBHeader
public PDBHeader getPDBHeader()
Description copied from interface:Structure
return the header information for this PDB file- Specified by:
getPDBHeader
in interfaceStructure
- Returns:
- the PDBHeader object
-
setPDBHeader
public void setPDBHeader(PDBHeader pdbHeader)
Description copied from interface:Structure
the the header information for this PDB file- Specified by:
setPDBHeader
in interfaceStructure
- Parameters:
pdbHeader
- the PDBHeader object
-
getSSBonds
public java.util.List<SSBond> getSSBonds()
get the list of SSBonds as they have been defined in the PDB files- Specified by:
getSSBonds
in interfaceStructure
- Returns:
- a list of SSBonds
-
setSSBonds
public void setSSBonds(java.util.List<SSBond> ssbonds)
set the list of SSBonds for this structure- Specified by:
setSSBonds
in interfaceStructure
- Parameters:
ssbonds
-
-
addSSBond
public void addSSBond(SSBond ssbond)
add a single SSBond to this structure
-
hasJournalArticle
public boolean hasJournalArticle()
Return whether or not the entry has an associated journal article or publication. The JRNL section is not mandatory and thus may not be present.- Specified by:
hasJournalArticle
in interfaceStructure
- Returns:
- flag if a JournalArticle could be found.
-
getJournalArticle
public JournalArticle getJournalArticle()
get the associated publication as defined by the JRNL records in a PDB file.- Specified by:
getJournalArticle
in interfaceStructure
- Returns:
- a JournalArticle
-
setJournalArticle
public void setJournalArticle(JournalArticle journalArticle)
set the associated publication as defined by the JRNL records in a PDB file.- Specified by:
setJournalArticle
in interfaceStructure
- Parameters:
journalArticle
- the article
-
-