Package org.biojava.nbio.structure
Interface Structure
-
- All Superinterfaces:
java.lang.Cloneable
- All Known Implementing Classes:
StructureImpl
public interface Structure extends java.lang.CloneableInterface for a structure object. Provides access to the data of a PDB file. A structure object allows to access the PDB header information as well as to the data from the ATOM records. The header information is currently available through the following objects: The structure object provides access to the data from the ATOM records through a hierarchy of sub-object:Structure |For more documentation on how to work with the Structure API please see http://biojava.org/wiki/BioJava:CookBook#Protein_StructureChain|Group|AtomThe tutorial for the BioJava structure modules can be found at github.
Q: How can I get a Structure object from a PDB file?
A:
public
StructureloadStructure(String pathToPDBFile){PDBFileReaderpdbreader = newPDBFileReader();Structurestructure = null; try{ structure = pdbreader.getStructure(pathToPDBFile); System.out.println(structure); } catch (IOException e) { e.printStackTrace(); } return structure; }
Q: How can I calculate Phi and Psi angles of AminoAcids?
A:
public void calcPhiPsi(
Structurestructure){ // get the first chain from the structureChainchain = structure.getChain(0); // A protein chain consists of a number of groups. These can be either //AminoAcid,HetatomorNucleotidegroups. // // Note: BioJava provides access to both the ATOM and SEQRES data in a PDB file. // since we are interested in doing calculations here, we only request the groups // from the ATOM records // get the Groups of the chain that are AminoAcids. Listgroups = chain.getAtomGroups(GroupType.AMINOACID); AminoAcida;AminoAcidb;AminoAcidc ; for ( int i=0; i < groups.size(); i++){ // since we requested only groups of type AMINOACID they will always be amino acids // Nucleotide and Hetatom groups will not be present in the groups list. b = (AminoAcid)groups.get(i); double phi =360.0; double psi =360.0; if ( i > 0) { a = (AminoAcid)groups.get(i-1) ; try { // the Calc class provides utility methods for various calculations on // structures, groups and atoms phi =Calc.getPhi(a,b); } catch (StructureExceptione){ e.printStackTrace(); phi = 360.0 ; } } if ( i < groups.size()-1) { c = (AminoAcid)groups.get(i+1) ; try { psi =Calc.getPsi(b,c); }catch (StructureExceptione){ e.printStackTrace(); psi = 360.0 ; } } System.out.print(b.getPDBCode() + " " + b.getPDBName() + ":" ); System.out.println(String.format("\tphi: %+7.2f psi: %+7.2f", phi, psi)); }
- Since:
- 1.4
- Version:
- %I% %G%
- Author:
- Andreas Prlic
-
-
Method Summary
All Methods Instance Methods Abstract 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)Add a single disulfide Bond to this structureStructureclone()Return an identical copy of this Structure objectChainfindChain(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 chainId, 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 pos)Retrieve a chain by its position within the Structure .ChaingetChain(int modelnr, int pos)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()Deprecated.useAtom.getBonds()insteadPDBCrystallographicInfogetCrystallographicInfo()Get crystallographic information for this structurejava.util.List<DBRef>getDBRefs()Get the list of database referencesjava.util.List<Group>getHetGroups()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.From BioJava 4.2, usegetPDBCode()orgetStructureIdentifier().toCanonical().getPdbId()java.util.List<java.lang.String>getRanges()Deprecated.From BioJava 4.2, usegetStructureIdentifier().toCanonical().getRanges()java.util.List<? extends ResidueRange>getResidueRanges()Deprecated.From BioJava 4.2, usegetStructureIdentifier().toCanonical().getResidueRanges()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()Get flag that indicates if this structure is a biological assemblybooleanisCrystallographic()Test if this structure is a crystallographic structure, i.e.booleanisNmr()Test if this structure is an NMR structure.intnrModels()Return the number of models .voidresetModels()Resets all models of this StructurevoidsetBiologicalAssembly(boolean biologicalAssembly)Set 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>> connections)Deprecated.useAtom.addBond(Bond)insteadvoidsetCrystallographicInfo(PDBCrystallographicInfo crystallographicInfo)Set 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 name)Set biological name of Structure .voidsetNmr(boolean nmr)Deprecated.voidsetPDBCode(java.lang.String pdb_id)Set PDB code of structure .voidsetPDBHeader(PDBHeader header)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 in this Structure.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 of object.
-
-
-
Method Detail
-
clone
Structure clone()
Return an identical copy of this Structure object- Returns:
- identical copy of this Structure object
-
toString
java.lang.String toString()
String representation of object.- Overrides:
toStringin classjava.lang.Object
-
setPDBCode
void setPDBCode(java.lang.String pdb_id)
Set PDB code of structure .- Parameters:
pdb_id- a String specifying the PDBCode- See Also:
getPDBCode()
-
getPDBCode
java.lang.String getPDBCode()
Get PDB code of structure.- Returns:
- a String representing the PDBCode value
- See Also:
setPDBCode(java.lang.String)
-
setName
void setName(java.lang.String name)
Set biological name of Structure .- Parameters:
name- a String specifying the biological name of the Structure- See Also:
getName()
-
getName
java.lang.String getName()
Get biological name of Structure.- Returns:
- a String representing the biological name of the Structure
- See Also:
setName(java.lang.String)
-
getStructureIdentifier
StructureIdentifier getStructureIdentifier()
Get an identifier corresponding to this structure- Returns:
- The StructureIdentifier used to create this structure
-
setStructureIdentifier
void setStructureIdentifier(StructureIdentifier structureIdentifier)
Set the identifier corresponding to this structure- Parameters:
structureIdentifier- the structureIdentifier corresponding to this structure
-
setConnections
@Deprecated void setConnections(java.util.List<java.util.Map<java.lang.String,java.lang.Integer>> connections)
Deprecated.useAtom.addBond(Bond)insteadsets/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
- Parameters:
connections- a List object specifying the connections- See Also:
getConnections()
-
getConnections
@Deprecated java.util.List<java.util.Map<java.lang.String,java.lang.Integer>> getConnections()
Deprecated.useAtom.getBonds()insteadReturn the connections value.- Returns:
- a List object representing the connections value
- See Also:
setConnections(java.util.List<java.util.Map<java.lang.String, java.lang.Integer>>)
-
size
int size()
Return number of Chains in this Structure.- Returns:
- an int representing the number of Chains in this Structure
-
size
int size(int modelnr)
Return number of chains of model.- 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
int nrModels()
Return the number of models . In this implementation also XRAY structures have "1 model", since model is the container for the chains. to test if a Structure is an NMR structure useisNmr().- Returns:
- an int representing the number of models in this Structure
- See Also:
isNmr()
-
isNmr
boolean isNmr()
Test if this structure is an NMR structure.- Returns:
- true if this Structure has been solved by NMR
- See Also:
nrModels()
-
isCrystallographic
boolean isCrystallographic()
Test if this structure is a crystallographic structure, i.e. it is an asymmetric unit from which it is possible to reconstruct the crystal lattice given cell parameters and space group.- Returns:
- true if crystallographic, false otherwise
-
setNmr
@Deprecated void setNmr(boolean nmr)
Deprecated.set NMR flag.- Parameters:
nmr- true to declare that this Structure has been solved by NMR.
-
addModel
void addModel(java.util.List<Chain> model)
Add a new model.- Parameters:
model- a List object containing the Chains of the new Model
-
setModel
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.- Parameters:
position- starting at 0model-
-
getModel
java.util.List<Chain> getModel(int modelnr)
Retrieve all Chains belonging to a model .- Parameters:
modelnr- an int- Returns:
- a List object containing the Chains of Model nr. modelnr
- See Also:
getChains(int modelnr)
-
getChains
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);- Returns:
- a List object containing the Chains of Model nr. modelnr
- See Also:
getModel(int modelnr),getChains(int modelnr)
-
setChains
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.- Parameters:
chains- the list of chains for this structure.- See Also:
setChains(int, List)
-
getChains
java.util.List<Chain> getChains(int modelnr)
Retrieve all chains of a model.- Parameters:
modelnr- an int- Returns:
- a List object containing the Chains of Model nr. modelnr
- See Also:
getModel(int)
-
setChains
void setChains(int modelnr, java.util.List<Chain> chains)Set the chains for a model- Parameters:
chains-modelnr-
-
addChain
void addChain(Chain chain)
Add a new chain.- Parameters:
chain- a Chain object
-
addChain
void addChain(Chain chain, int modelnr)
Add a new chain, if several models are available.- Parameters:
chain- a Chain objectmodelnr- an int specifying to which model the Chain should be added
-
getChain
Chain getChain(int pos)
Retrieve a chain by its position within the Structure .- Parameters:
pos- an int for the position in the List of Chains.- Returns:
- a Chain object
-
getChain
Chain getChain(int modelnr, int pos)
Retrieve a chain by its position within the Structure and model number.- Parameters:
pos- an intmodelnr- an int- Returns:
- a Chain object
-
findChain
Chain findChain(java.lang.String chainId) throws StructureException
Request a particular chain from a structure. by default considers only the first model.- Parameters:
chainId- the ID of a chain that should be returned- Returns:
- Chain the requested chain
- Throws:
StructureException
-
hasChain
boolean hasChain(java.lang.String chainId)
Check if a chain with the id chainId is contained in this structure.- Parameters:
chainId- the name of the chain- Returns:
- true if a chain with the id (name) chainId is found
-
findChain
Chain findChain(java.lang.String chainId, int modelnr) throws StructureException
Request a particular chain from a particular model- Parameters:
modelnr- the number of the model to usechainId- the ID of a chain that should be returned- Returns:
- Chain the requested chain
- Throws:
StructureException
-
findGroup
Group findGroup(java.lang.String chainId, java.lang.String pdbResnum) throws StructureException
Request a particular group from a structure. by default considers only the first model in the structure.- Parameters:
chainId- the ID of the chain to usepdbResnum- the PDB residue number of the requested group- Returns:
- Group the requested Group
- Throws:
StructureException
-
findGroup
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.- 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
-
getChainByPDB
Chain getChainByPDB(java.lang.String chainId) throws StructureException
Request a chain by its PDB code by default takes only the first model- Parameters:
chainId- the chain identifier- Returns:
- the Chain that matches the chainID
- Throws:
StructureException
-
getChainByPDB
Chain getChainByPDB(java.lang.String chainId, int modelnr) throws StructureException
Request a chain by its PDB code by default takes only the first model- Parameters:
chainId- the chain identifiermodelnr- request a particular model;- Returns:
- the Chain that matches the chainID in the model
- Throws:
StructureException
-
toPDB
java.lang.String toPDB()
Create a String that contains this Structure's contents in PDB file format.- Returns:
- a String that looks like a PDB file
- See Also:
FileConvert
-
toMMCIF
java.lang.String toMMCIF()
Create a String that contains this Structure's contents in MMCIF file format.- Returns:
-
setCompounds
void setCompounds(java.util.List<Compound> molList)
Set the Compounds- Parameters:
molList-
-
getCompounds
java.util.List<Compound> getCompounds()
Get all the Compounds for this Structure. Compounds are called Entities in mmCIF dictionary.- Returns:
- a list of Compounds
-
addCompound
void addCompound(Compound compound)
Add a Compound to this Structure
-
setDBRefs
void setDBRefs(java.util.List<DBRef> dbrefs)
Set the list of database references for this structure- Parameters:
dbrefs- list of DBRef objects
-
getDBRefs
java.util.List<DBRef> getDBRefs()
Get the list of database references- Returns:
- list of DBRef objects
-
getCompoundById
Compound getCompoundById(int molId)
Request a particular compound by its molId (entity_id in mmCIF dictionary)- Parameters:
molId-- Returns:
- a compound
-
getPDBHeader
PDBHeader getPDBHeader()
Return the header information for this PDB file- Returns:
- the PDBHeader object
-
hasJournalArticle
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.- Returns:
- flag if a JournalArticle has been found.
-
getJournalArticle
JournalArticle getJournalArticle()
Get the associated publication as defined by the JRNL records in a PDB file.- Returns:
- a JournalArticle
-
setJournalArticle
void setJournalArticle(JournalArticle journalArticle)
Set the associated publication as defined by the JRNL records in a PDB file.- Parameters:
journalArticle-
-
getSSBonds
java.util.List<Bond> getSSBonds()
Get the list of disulfide Bonds as they have been defined in the PDB files- Returns:
- a list of Bonds
-
setSSBonds
void setSSBonds(java.util.List<Bond> ssbonds)
Set the list of SSBonds for this structure- Parameters:
ssbonds-
-
addSSBond
void addSSBond(Bond ssbond)
Add a single disulfide Bond to this structure- Parameters:
ssbond-
-
setPDBHeader
void setPDBHeader(PDBHeader header)
Set the the header information for this PDB file- Parameters:
header- the PDBHeader object
-
getId
java.lang.Long getId()
Get the ID used by Hibernate- Returns:
- the ID used by Hibernate
-
setId
void setId(java.lang.Long id)
set the ID used by Hibernate- Parameters:
id-
-
setSites
void setSites(java.util.List<Site> sites)
- Parameters:
sites- the sites to set in the structure
-
getSites
java.util.List<Site> getSites()
- Returns:
- the sites contained in this structure
-
getHetGroups
java.util.List<Group> getHetGroups()
-
setBiologicalAssembly
void setBiologicalAssembly(boolean biologicalAssembly)
Set a flag to indicate if this structure is a biological assembly- Parameters:
biologicalAssembly- true if biological assembly, otherwise false- Since:
- 3.2
-
isBiologicalAssembly
boolean isBiologicalAssembly()
Get flag that indicates if this structure is a biological assembly- Returns:
- true if biological assembly, otherwise false
- Since:
- 3.2
-
setCrystallographicInfo
void setCrystallographicInfo(PDBCrystallographicInfo crystallographicInfo)
Set crystallographic information for this structure- Parameters:
PDBCrystallographicInfo- crystallographic information- Since:
- 3.2
-
getCrystallographicInfo
PDBCrystallographicInfo getCrystallographicInfo()
Get crystallographic information for this structure- Returns:
- PDBCrystallographicInfo crystallographic information
- Since:
- 3.2
-
resetModels
void resetModels()
Resets all models of this Structure- Since:
- 4.0.1
-
getPdbId
@Deprecated java.lang.String getPdbId()
Deprecated.From BioJava 4.2, usegetPDBCode()orgetStructureIdentifier().toCanonical().getPdbId()Returns the PDB identifier associated with this StructureIdentifier.
-
getResidueRanges
@Deprecated java.util.List<? extends ResidueRange> getResidueRanges()
Deprecated.From BioJava 4.2, usegetStructureIdentifier().toCanonical().getResidueRanges()Returns the list ofResidueRangesthat this StructureIdentifier defines. This is a unique representation.
-
getRanges
@Deprecated java.util.List<java.lang.String> getRanges()
Deprecated.From BioJava 4.2, usegetStructureIdentifier().toCanonical().getRanges()Returns a list of residue ranges. For example:getRanges().get(0): 'A' getRanges().get(1): 'B_5-100'
This is a unique representation.
-
getIdentifier
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:getStructureIdentifier().getIdentifier(), which should give the string originally used to create the structuregetName()- A combination of
getPDBCode()with a heuristic description of the residue ranges, inSubstructureIdentifierformat.
- Returns:
- A
SubstructureIdentifier-format string describing the residue ranges in this structure - Since:
- The behavior of this method changed in BioJava 4.2. Previously it
returned the same value as
getPDBCode()
-
-