Structure (BioJava-1.5-beta API)
Keywords: org.biojava.bio.structure.Structure interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.structure
Interface Structure

All Known Implementing Classes:
  StructureImpl

    public interface Structure

Interface for a structure object. Provides access to the data of a PDB file.

Q: How can I get a Structure object from a PDB file?

A:

     String filename =  "path/to/pdbfile.ent" ;

     PDBFileReader pdbreader = new PDBFileReader();

     try{
            Structure struc = pdbreader.getStructure(filename);
            System.out.println(struc);
     } catch (Exception e) {
            e.printStackTrace();
     }

Q: How can I calculate Phi and Psi angles of the AminoAcids?

A:

            ArrayList chains = (ArrayList)struc.getModel(0);
            Chain tmpchn  = (Chain)chains.get(0) ;
            ArrayList aminos = tmpchn.getGroups("amino");

            AminoAcid a;
            AminoAcid b;
            AminoAcid c ;

            for ( int i=0; i < aminos.size(); i++){

                b = (AminoAcid)aminos.get(i);
                double phi =360.0;
                double psi =360.0;

                if ( i > 0) {
                    a = (AminoAcid)aminos.get(i-1) ;
                    try {
                        phi = Calc.getPhi(a,b);
                    } catch (StructureException e){
                        e.printStackTrace();
                        phi = 360.0 ;
                    }
                }
                if ( i < aminos.size()-1) {
                    c = (AminoAcid)aminos.get(i+1) ;
                    try {
                        psi = Calc.getPsi(b,c);
                    }catch (StructureException e){
                        e.printStackTrace();
                        psi = 360.0 ;
                    }
                }

                String str = b.getPDBCode() + " " + b.getPDBName() + ":"  ;
                str += "\tphi: " + phi + "\tpsi: " + psi;
                System.out.println(str);

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

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 chainId, 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 pos)` retrieve a chain by it's position within the Structure .
`Chain` | `getChain(int pos, int modelnr)` 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()` test if this structure is an nmr structure.
`int` | `nrModels()` return number of models .
`void` | `setConnections(List connections)` 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 name)` 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 in this Structure.
`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 of object.

Method Detail

### clone

    Object clone()

  returns an identical copy of this structure .

  Returns:
    an identical Structure object

### toString

    String toString()

  String representation of object.

  Overrides:
    `toString` in class `Object`

### setPDBCode

    void setPDBCode(String pdb_id)

  set PDB code of structure .

  Parameters:
    `pdb_id` - a String specifying the PDBCode
  See Also:
    `getPDBCode()`

### getPDBCode

    String getPDBCode()

  get PDB code of structure.

  Returns:
    a String representing the PDBCode value
  See Also:
    `setPDBCode(java.lang.String)`

### setName

    void setName(String name)

  set biological name of Structure .

  Parameters:
    `name` - a String specifying the biological name of the Structure
  See Also:
    `getName()`

### getName

    String getName()

  get biological name of Structure.

  Returns:
    a String representing the biological name of the Structure
  See Also:
    `setName(java.lang.String)`

### setHeader

    void setHeader(Map h)

  set the Header data .

  Parameters:
    `h` - a Map object specifying the header
  See Also:
    `getHeader()`

### getHeader

    Map getHeader()

  get Header data .

  Returns:
    a Map object representing the header value
  See Also:
    `setHeader(java.util.Map)`

### setConnections

    void setConnections(List connections)

  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

  Parameters:
    `connections` - a List object specifying the connections
  See Also:
    `getConnections()`

### getConnections

    List getConnections()

  Returns the connections value.

  Returns:
    a List object representing the connections value
  See Also:
    `setConnections(java.util.List)`

### 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 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 use @see isNMR , since this is based on the info in the PDB file header.

  Returns:
    an int representing the number of models in this Structure

### isNmr

    boolean isNmr()

  test if this structure is an nmr structure.

  Returns:
    true if this Structure has been resolved by NMR

### setNmr

    void setNmr(boolean nmr)

  set NMR flag.

  Parameters:
    `nmr` - true to declare that this Structure has been solved by NMR.

### addModel

    void addModel(List model)

  add a new model.

  Parameters:
    `model` - a List object containing the Chains of the new Model

### getModel

    List 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)`

### getChains

    List 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)`

### 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 object
    `modelnr` - an int specifying to which model the Chain should be added

### getChain

    Chain getChain(int pos)

  retrieve a chain by it's position within the Structure .

  Parameters:
    `pos` - an int for the position in the List of Chains.
  Returns:
    a Chain object

### getChain

    Chain getChain(int pos,
                   int modelnr)

  retrieve a chain by it's position within the Structure and model number.

  Parameters:
    `pos` - an int
    `modelnr` - an int
  Returns:
    a Chain object

### findChain

    Chain findChain(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(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(String chainId,
                    int modelnr)
                    throws StructureException

  request a particular chain from a particular model

  Parameters:
    `modelnr` - the number of the model to use
    `chainId` - the ID of a chain that should be returned
  Returns:
    Chain the requested chain
  Throws:
    `StructureException`

### findGroup

    Group findGroup(String chainId,
                    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 use
    `pdbResnum` - the PDB residue number of the requested group
  Returns:
    Group the requested Group
  Throws:
    `StructureException`

### findGroup

    Group findGroup(String chainId,
                    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 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`

### getChainByPDB

    Chain getChainByPDB(String chainId)
                        throws StructureException

  request a chain by it's 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(String chainId,
                        int modelnr)
                        throws StructureException

  request a chain by it's PDB code by default takes only the first model

  Parameters:
    `chainId` - the chain identifier
    `modelnr` - request a particular model;
  Returns:
    the Chain that matches the chainID in the model
  Throws:
    `StructureException`

### toPDB

    String toPDB()

  create a String that contains the contents of a PDB file .

  Returns:
    a String that looks like a PDB file

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD