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.align
Class StructurePairAligner

    java.lang.Object
      org.biojava.bio.structure.align.StructurePairAligner

    public class StructurePairAligner

extends Object

Perform a pairwise protein structure superimposition.

The algorithm is a distance matrix based, rigid body protein structure superimposition. It is based on a variation of the PSC++ algorithm provided by Peter Lackner (Peter.Lackner@sbg.ac.at, personal communication) .

## Example

      public void run(){

                    // first load two example structures
                    InputStream inStream1 = this.getClass().getResourceAsStream("/files/5pti.pdb");
                    InputStream inStream2 = this.getClass().getResourceAsStream("/files/1tap.pdb");

                    Structure structure1 = null;
                    Structure structure2 = null;

                    PDBFileParser pdbpars = new PDBFileParser();
                    try {
                            structure1 = pdbpars.parsePDBFile(inStream1) ;
                            structure2 = pdbpars.parsePDBFile(inStream2);

                    } catch (IOException e) {
                            e.printStackTrace();
                            return;
                    }

                    // calculate structure superimposition for two complete structures
                    StructurePairAligner aligner = new StructurePairAligner();

                    try {
                            // align the full 2 structures with default parameters.
                            // see StructurePairAligner for more options and how to align
                            // any set of Atoms
                            aligner.align(structure1,structure2);

                            AlternativeAlignment[] aligs = aligner.getAlignments();
                            AlternativeAlignment a = aligs[0];
                            System.out.println(a);

                            //display the alignment in Jmol

                            // first get an artificial structure for the alignment
                            Structure artificial = a.getAlignedStructure(structure1, structure2);

                            // and then send it to Jmol (only will work if Jmol is in the Classpath)

                            BiojavaJmol jmol = new BiojavaJmol();
                            jmol.setTitle(artificial.getName());
                            jmol.setStructure(artificial);

                            // color the two structures

                            jmol.evalString("select *; backbone 0.4; wireframe off; spacefill off; " +
                                            "select not protein and not solvent; spacefill on;");
                            jmol.evalString("select *"+"/1 ; color red; model 1; ");

                            // now color the equivalent residues ...

                            String[] pdb1 = a.getPDBresnum1();
                            for (String res : pdb1 ){
                                    jmol.evalString("select " + res + "/1 ; backbone 0.6; color white;");
                            }

                            jmol.evalString("select *"+"/2; color blue; model 2;");
                            String[] pdb2 = a.getPDBresnum2();
                            for (String res :pdb2 ){
                                    jmol.evalString("select " + res + "/2 ; backbone 0.6; color yellow;");
                            }

                            // now show both models again.
                            jmol.evalString("model 0;");

                    } catch (StructureException e){
                            e.printStackTrace();
                    }
            }

Since:
  1.4
Version:
  %I% %G%
Author:
  Andreas Prlic, Peter Lackner

Constructor Summary
`StructurePairAligner()`

Method Summary
`void` | `align(Atom[] ca1, Atom[] ca2, StrucAligParameters params)` calculate the protein structure superimposition, between two sets of atoms.
`void` | `align(Structure s1, Structure s2)` calculate the alignment between the two full structures with default parameters
`void` | `align(Structure s1, Structure s2, StrucAligParameters params)` calculate the alignment between the two full structures with user provided parameters
`Atom[]` | `getAlignmentAtoms(Structure s)`
`AlternativeAlignment[]` | `getAlignments()` return the alternative alignments that can be found for the two structures
`Matrix` | `getDistMat()` return the difference of distance matrix between the two structures
`FragmentPair[]` | `getFragmentPairs()` get the results of step 1 - the FragmentPairs used for seeding the alignment
`StrucAligParameters` | `getParams()` get the parameters.
`boolean` | `isDebug()` check if debug mode is set on
`static void` | `main(String[] args)` example usage of this class
`void` | `setDebug(boolean debug)` set the debug flag
`void` | `setFragmentPairs(FragmentPair[] fragPairs)`
`void` | `setParams(StrucAligParameters params)` set the parameters to be used for the algorithm

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StructurePairAligner

    public StructurePairAligner()

Method Detail

### main

    public static void main(String[] args)

  example usage of this class

  Parameters:
    `args` -

### getFragmentPairs

    public FragmentPair[] getFragmentPairs()

  get the results of step 1 - the FragmentPairs used for seeding the alignment

  Returns:
    a FragmentPair[] array

### setFragmentPairs

    public void setFragmentPairs(FragmentPair[] fragPairs)

### getAlignments

    public AlternativeAlignment[] getAlignments()

  return the alternative alignments that can be found for the two structures

  Returns:
    AlternativeAlignment[] array

### getDistMat

    public Matrix getDistMat()

  return the difference of distance matrix between the two structures

  Returns:
    a Matrix

### getParams

    public StrucAligParameters getParams()

  get the parameters.

  Returns:
    the Parameters.

### setParams

    public void setParams(StrucAligParameters params)

  set the parameters to be used for the algorithm

  Parameters:
    `params` - the Parameter object

### isDebug

    public boolean isDebug()

  check if debug mode is set on

  Returns:
    debug flag

### setDebug

    public void setDebug(boolean debug)

  set the debug flag

  Parameters:
    `debug` - flag

### align

    public void align(Structure s1,
                      Structure s2)
               throws StructureException

  calculate the alignment between the two full structures with default parameters

  Parameters:
    `s1` -
    `s2` -
  Throws:
    `StructureException`

### align

    public void align(Structure s1,
                      Structure s2,
                      StrucAligParameters params)
               throws StructureException

  calculate the alignment between the two full structures with user provided parameters

  Parameters:
    `s1` -
    `s2` -
    `params` -
  Throws:
    `StructureException`

### getAlignmentAtoms

    public Atom[] getAlignmentAtoms(Structure s)

### align

    public void align(Atom[] ca1,
                      Atom[] ca2,
                      StrucAligParameters params)
               throws StructureException

  calculate the protein structure superimposition, between two sets of atoms.

  Parameters:
    `ca1` - set of Atoms of structure 1
    `ca2` - set of Atoms of structure 2
    `params` - the parameters to use for the alignment
  Throws:
    `StructureException`

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