/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
* Created on 26.04.2004
* @author Andreas Prlic
*
*/
package org.biojava.bio.structure;
import java.util.List;
import java.util.Map;
import org.biojava.bio.structure.io.FileConvert;
import org.biojava.bio.structure.io.PDBFileReader;
import org.biojava.bio.structure.HetatomImpl;
import org.biojava.bio.structure.NucleotideImpl;
/**
*
* Interface 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:
*
* - {@link PDBHeader}
* - {@link DBRef}
* - {@link Compound}
*
*
* The structure object provides access to the data from the ATOM records through
* a hierarchy of sub-object:
*
* Structure
* |
* {@link Chain}
* |
* {@link Group}
* |
* {@link Atom}
*
*
* For more documentation on how to work with the Structure API please
* see
* http://biojava.org/wiki/BioJava:CookBook#Protein_Structure
*
*
*
*
*
* Q: How can I get a Structure object from a PDB file?
*
*
* A:
*
public {@link Structure} loadStructure(String pathToPDBFile){
{@link PDBFileReader} pdbreader = new {@link PDBFileReader}();
{@link Structure} structure = 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({@link Structure} structure){
// get the first chain from the structure
{@link Chain} chain = structure.getChain(0);
// A protein chain consists of a number of groups. These can be either
// {@link AminoAcid}, {@link HetatomImpl Hetatom} or {@link NucleotideImpl Nucleotide} groups.
//
// 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.
List groups = chain.getAtomGroups("amino");
{@link AminoAcid} a;
{@link AminoAcid} b;
{@link AminoAcid} c ;
for ( int i=0; i < groups.size(); i++){
// since we requested only groups of type "amino" they will always be amino acids
// Nucleotide and Hetatom groups will not be present in the groups list.
b = ({@link AminoAcid})groups.get(i);
double phi =360.0;
double psi =360.0;
if ( i > 0) {
a = ({@link AminoAcid})groups.get(i-1) ;
try {
// the Calc class provides utility methods for various calculations on
// structures, groups and atoms
phi = {@link Calc}.getPhi(a,b);
} catch ({@link StructureException} e){
e.printStackTrace();
phi = 360.0 ;
}
}
if ( i < groups.size()-1) {
c = ({@link AminoAcid})groups.get(i+1) ;
try {
psi = {@link Calc}.getPsi(b,c);
}catch ({@link StructureException} e){
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));
}
*
*
*
* @author Andreas Prlic
* @since 1.4
* @version %I% %G%
*/
public interface Structure extends Cloneable{
/** returns an identical copy of this Structure object
*
* @return identical copy of this Structure object
*/
public Structure clone();
/**
* String representation of object.
*/
public String toString();
/**
*
* set PDB code of structure .
*
* @param pdb_id a String specifying the PDBCode
* @see #getPDBCode
*
*/
public void setPDBCode (String pdb_id) ;
/**
*
* get PDB code of structure.
*
* @return a String representing the PDBCode value
* @see #setPDBCode
*/
public String getPDBCode () ;
/** set biological name of Structure .
*
* @param name a String specifying the biological name of the Structure
* @see #getName
*/
public void setName(String name);
/** get biological name of Structure.
*
* @return a String representing the biological name of the Structure
* @see #setName
*/
public String getName();
/** set the Header data .
*
* @param h a Map object specifying the header
* @see #getHeader
*/
public void setHeader(Map h) ;
/** get Header data .
*
* @return a Map object representing the header value
* @see #setHeader
* @deprecated use getPDBHeader instead
* @see #getPDBHeader
*/
public Map getHeader() ;
/**
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
*
* @param connections a List object specifying the connections
* @see #getConnections
*/
public void setConnections(List