Package org.biojava.nbio.structure
Class StructureImpl
- java.lang.Object
-
- org.biojava.nbio.structure.StructureImpl
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,Structure
public class StructureImpl extends java.lang.Object implements Structure, java.io.Serializable
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
- See Also:
- Serialized Form
-
-
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 Deprecated Methods Modifier and Type Method Description voidaddChain(Chain chain)Add a new chain.voidaddChain(Chain chain, int modelnr)Add a new chain, if several models are available.voidaddCompound(Compound compound)Add a Compound to this StructurevoidaddModel(java.util.List<Chain> model)Add a new model.voidaddSSBond(Bond ssbond)Adds a single disulfide Bond to this structureStructureclone()returns an identical copy of this structure .ChainfindChain(java.lang.String chainId)Request a particular chain from a structure.ChainfindChain(java.lang.String chainId, int modelnr)Request a particular chain from a particular modelGroupfindGroup(java.lang.String chainName, java.lang.String pdbResnum)Request a particular group from a structure.GroupfindGroup(java.lang.String chainId, java.lang.String pdbResnum, int modelnr)Request a particular group from a structure.ChaingetChain(int number)Retrieve a chain by its position within the Structure .ChaingetChain(int modelnr, int number)Retrieve a chain by its position within the Structure and model number.ChaingetChainByPDB(java.lang.String chainId)Request a chain by its PDB code by default takes only the first modelChaingetChainByPDB(java.lang.String chainId, int modelnr)Request a chain by its 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.CompoundgetCompoundById(int molId)Request a particular compound by its molId (entity_id in mmCIF dictionary)java.util.List<Compound>getCompounds()Get all the Compounds for this Structure.java.util.List<java.util.Map<java.lang.String,java.lang.Integer>>getConnections()Return the connections value.PDBCrystallographicInfogetCrystallographicInfo()Gets crystallographic information for this structurejava.util.List<DBRef>getDBRefs()Get the list of database referencesjava.util.List<Group>getHetGroups()Caution: we should probably remove this to avoid confusion.java.lang.LonggetId()get the ID used by Hibernatejava.lang.StringgetIdentifier()Get a string representing this structure's contents.JournalArticlegetJournalArticle()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.StringgetName()Get biological name of Structure.java.lang.StringgetPDBCode()Get PDB code of structure.PDBHeadergetPDBHeader()Return the header information for this PDB filejava.lang.StringgetPdbId()Deprecated.java.util.List<java.lang.String>getRanges()Deprecated.java.util.List<ResidueRange>getResidueRanges()Deprecated.java.util.List<Site>getSites()java.util.List<Bond>getSSBonds()Get the list of disulfide Bonds as they have been defined in the PDB filesStructureIdentifiergetStructureIdentifier()Get an identifier corresponding to this structurebooleanhasChain(java.lang.String chainId)Check if a chain with the id chainId is contained in this structure.booleanhasJournalArticle()Return whether or not the entry has an associated journal article or publication.booleanisBiologicalAssembly()Gets flag that indicates if this structure is a biological assemblybooleanisCrystallographic()Whether this Structure is a crystallographic structure or not.booleanisNmr()Whether this Structure is a NMR structure or not.intnrModels()return number of models.voidresetModels()Resets all models of this StructurevoidsetBiologicalAssembly(boolean biologicalAssembly)Sets a flag to indicate if this structure is a biological assemblyvoidsetChains(int modelnr, java.util.List<Chain> chains)Set the chains for a modelvoidsetChains(java.util.List<Chain> chains)Set the chains of a structure, if this is a NMR structure, this will only set model 0.voidsetCompounds(java.util.List<Compound> molList)Set the CompoundsvoidsetConnections(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:voidsetCrystallographicInfo(PDBCrystallographicInfo crystallographicInfo)Sets crystallographic information for this structurevoidsetDBRefs(java.util.List<DBRef> dbrefs)Set the list of database references for this structurevoidsetId(java.lang.Long id)set the ID used by HibernatevoidsetJournalArticle(JournalArticle journalArticle)set the associated publication as defined by the JRNL records in a PDB file.voidsetModel(int position, java.util.List<Chain> model)A convenience function if one wants to edit and replace the models in a structure.voidsetName(java.lang.String nam)Set biological name of Structure .voidsetNmr(boolean nmr)Deprecated.voidsetPDBCode(java.lang.String pdb_id_)Set PDB code of structure .voidsetPDBHeader(PDBHeader pdbHeader)Set the the header information for this PDB filevoidsetSites(java.util.List<Site> sites)voidsetSSBonds(java.util.List<Bond> ssbonds)Set the list of SSBonds for this structurevoidsetStructureIdentifier(StructureIdentifier structureIdentifier)Set the identifier corresponding to this structureintsize()return number of chains , if NMR return number of chains of first model .intsize(int modelnr)return number of chains of model.java.lang.StringtoMMCIF()Create a String that contains this Structure's contents in MMCIF file format.java.lang.StringtoPDB()Create a String that contains this Structure's contents in PDB file format.java.lang.StringtoString()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
Request a particular group from a structure. considers only model nr X. count starts with 0.- Specified by:
findGroupin 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
Request a particular group from a structure. by default considers only the first model in the structure.- Specified by:
findGroupin 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
Request a particular chain from a particular model- Specified by:
findChainin 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
Request a particular chain from a structure. by default considers only the first model.- Specified by:
findChainin 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:
setPDBCodein interfaceStructure- Parameters:
pdb_id_- a String specifying the PDBCode- See Also:
Structure.getPDBCode()
-
getPDBCode
public java.lang.String getPDBCode()
Get PDB code of structure.- Specified by:
getPDBCodein interfaceStructure- Returns:
- a String representing the PDBCode value
- See Also:
Structure.setPDBCode(java.lang.String)
-
setName
public void setName(java.lang.String nam)
Set biological name of Structure .- Specified by:
setNamein interfaceStructure- Parameters:
nam- a String specifying the biological name of the Structure- See Also:
Structure.getName()
-
getName
public java.lang.String getName()
Get biological name of Structure.- Specified by:
getNamein interfaceStructure- Returns:
- a String representing the biological name of the Structure
- See Also:
Structure.setName(java.lang.String)
-
getStructureIdentifier
public StructureIdentifier getStructureIdentifier()
Description copied from interface:StructureGet an identifier corresponding to this structure- Specified by:
getStructureIdentifierin interfaceStructure- Returns:
- The StructureIdentifier used to create this structure
-
setStructureIdentifier
public void setStructureIdentifier(StructureIdentifier structureIdentifier)
Description copied from interface:StructureSet the identifier corresponding to this structure- Specified by:
setStructureIdentifierin interfaceStructure- Parameters:
structureIdentifier- the structureIdentifier corresponding to this structure
-
setConnections
public void 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: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 atomthe 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:
setConnectionsin interfaceStructure- Parameters:
conns- a List object specifying the connections- See Also:
Structure.getConnections()
-
getConnections
public java.util.List<java.util.Map<java.lang.String,java.lang.Integer>> getConnections()
Return the connections value.- Specified by:
getConnectionsin interfaceStructure- Returns:
- a List object representing the connections value
- See Also:
Structure.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 its position within the Structure .
-
getChain
public Chain getChain(int modelnr, int number)
Retrieve a chain by its 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)
Set the chains of a structure, if this is a NMR structure, this will only set model 0.- Specified by:
setChainsin 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)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.- Specified by:
nrModelsin interfaceStructure- Returns:
- an int representing the number of models in this Structure
- See Also:
Structure.isNmr()
-
isCrystallographic
public boolean isCrystallographic()
Whether this Structure is a crystallographic structure or not. It will first check the experimental technique and if not present it will try to guess from the presence of a space group and sensible cell parameters- Specified by:
isCrystallographicin interfaceStructure- Returns:
- true if crystallographic, false otherwise
-
isNmr
public boolean isNmr()
Whether this Structure is a NMR structure or not. It will first check the experimental technique and if not present it will try to guess from the presence of more than 1 model and from b-factors being 0 in first chain of first model- Specified by:
isNmrin interfaceStructure- Returns:
- true if NMR, false otherwise
- See Also:
Structure.nrModels()
-
setNmr
@Deprecated public void setNmr(boolean nmr)
Deprecated.set NMR flag.
-
getChains
public java.util.List<Chain> getChains(int modelnr)
retrieve all chains of a model.- Specified by:
getChainsin interfaceStructure- Parameters:
modelnr- an int- Returns:
- a List object
- See Also:
Structure.getModel(int)
-
getChains
public java.util.List<Chain> getChains()
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:
getChainsin 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)Set the chains for a model
-
getModel
public java.util.List<Chain> getModel(int modelnr)
retrieve all Chains belonging to a model .- Specified by:
getModelin 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
Request a chain by its PDB code by default takes only the first model- Specified by:
getChainByPDBin 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
Request a chain by its PDB code by default takes only the first model- Specified by:
getChainByPDBin 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 this Structure's contents in PDB file format.- Specified by:
toPDBin interfaceStructure- Returns:
- a String that looks like a PDB file
- See Also:
FileConvert
-
toMMCIF
public java.lang.String toMMCIF()
Create a String that contains this Structure's contents in MMCIF file format.
-
hasChain
public boolean hasChain(java.lang.String chainId)
Check if a chain with the id chainId is contained in this structure.
-
setCompounds
public void setCompounds(java.util.List<Compound> molList)
Set the Compounds- Specified by:
setCompoundsin interfaceStructure
-
addCompound
public void addCompound(Compound compound)
Add a Compound to this Structure- Specified by:
addCompoundin interfaceStructure
-
getCompounds
public java.util.List<Compound> getCompounds()
Get all the Compounds for this Structure. Compounds are called Entities in mmCIF dictionary.- Specified by:
getCompoundsin interfaceStructure- Returns:
- a list of Compounds
-
getCompoundById
public Compound getCompoundById(int molId)
Request a particular compound by its molId (entity_id in mmCIF dictionary)- Specified by:
getCompoundByIdin interfaceStructure- Returns:
- a compound
-
getDBRefs
public java.util.List<DBRef> getDBRefs()
Get the list of database references
-
setDBRefs
public void setDBRefs(java.util.List<DBRef> dbrefs)
Set the list of database references for this structure
-
getPDBHeader
public PDBHeader getPDBHeader()
Return the header information for this PDB file- Specified by:
getPDBHeaderin interfaceStructure- Returns:
- the PDBHeader object
-
setPDBHeader
public void setPDBHeader(PDBHeader pdbHeader)
Set the the header information for this PDB file- Specified by:
setPDBHeaderin interfaceStructure- Parameters:
pdbHeader- the PDBHeader object
-
getSSBonds
public java.util.List<Bond> getSSBonds()
Get the list of disulfide Bonds as they have been defined in the PDB files- Specified by:
getSSBondsin interfaceStructure- Returns:
- a list of Bonds
-
setSSBonds
public void setSSBonds(java.util.List<Bond> ssbonds)
Set the list of SSBonds for this structure- Specified by:
setSSBondsin interfaceStructure
-
addSSBond
public void addSSBond(Bond ssbond)
Adds a single disulfide Bond 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:
hasJournalArticlein 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:
getJournalArticlein 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:
setJournalArticlein interfaceStructure- Parameters:
journalArticle- the article
-
getSites
public java.util.List<Site> getSites()
-
setSites
public void setSites(java.util.List<Site> sites)
-
getHetGroups
public java.util.List<Group> getHetGroups()
Caution: we should probably remove this to avoid confusion. Currently this is always an empty list!- Specified by:
getHetGroupsin interfaceStructure- Returns:
- a list of Groups listed in the HET records - this will not include any waters.
-
setBiologicalAssembly
public void setBiologicalAssembly(boolean biologicalAssembly)
Sets a flag to indicate if this structure is a biological assembly- Specified by:
setBiologicalAssemblyin interfaceStructure- Parameters:
biologicalAssembly- true if biological assembly, otherwise false- Since:
- 3.2
-
isBiologicalAssembly
public boolean isBiologicalAssembly()
Gets flag that indicates if this structure is a biological assembly- Specified by:
isBiologicalAssemblyin interfaceStructure- Returns:
- the sites contained in this structure
- Since:
- 3.2
-
setCrystallographicInfo
public void setCrystallographicInfo(PDBCrystallographicInfo crystallographicInfo)
Sets crystallographic information for this structure- Specified by:
setCrystallographicInfoin interfaceStructure- Parameters:
crystallographicInfo- crystallographic information- Since:
- 3.2
-
getCrystallographicInfo
public PDBCrystallographicInfo getCrystallographicInfo()
Gets crystallographic information for this structure- Specified by:
getCrystallographicInfoin interfaceStructure- Returns:
- PDBCrystallographicInfo crystallographic information
- Since:
- 3.2
-
getIdentifier
public java.lang.String getIdentifier()
Get a string representing this structure's contents. The following places are searched for a non-null value, with the first being returned:Structure.getStructureIdentifier().getIdentifier(), which should give the string originally used to create the structureStructure.getName()- A combination of
Structure.getPDBCode()with a heuristic description of the residue ranges, inSubstructureIdentifierformat.
- Specified by:
getIdentifierin interfaceStructure- Returns:
- A
SubstructureIdentifier-format string describing the residue ranges in this structure
-
getPdbId
@Deprecated public java.lang.String getPdbId()
Deprecated.Returns the PDB identifier associated with this StructureIdentifier.
-
resetModels
public void resetModels()
Resets all models of this Structure- Specified by:
resetModelsin interfaceStructure
-
getResidueRanges
@Deprecated public java.util.List<ResidueRange> getResidueRanges()
Deprecated.Returns the list ofResidueRangesthat this StructureIdentifier defines. This is a unique representation.- Specified by:
getResidueRangesin interfaceStructure
-
-