edu.rit.compbio.seq
Class ProteinLocalAlignment

java.lang.Object
  extended by edu.rit.compbio.seq.ProteinLocalAlignment
Direct Known Subclasses:
ProteinLocalAlignmentSeq, ProteinLocalAlignmentSmp

public abstract class ProteinLocalAlignment
extends Object

Class ProteinLocalAlignment is the abstract base class for an object that does local alignments of ProteinSequences. Class ProteinLocalAlignment uses the Smith-Waterman algorithm with a substitution matrix (such as BLOSUM-62) and affine gap penalties. To do a local alignment:

  1. Create an instance of class ProteinLocalAlignment.

  2. If desired, call setSubstitutionMatrix() to set the substitution matrix. If not set, the default is the BLOSUM-62 substitution matrix.

  3. If desired, call setGapExistencePenalty() to set the gap existence penalty. If not set, the default is −11.

  4. If desired, call setGapExtensionPenalty() to set the gap extension penalty. If not set, the default is −1.

  5. Call setQuerySequence() to set the query sequence.

  6. Call setSubjectSequence() to set the subject sequence.

  7. Call align() to do the alignment between the query sequence and the subject sequence in a single thread. The align() method returns an Alignment object.

To do another local alignment with the same query sequence and a different subject sequence, repeat steps 6-7. To do another local alignment with a different query sequence, repeat steps 5-7.

Subclasses of class ProteinLocalAlignment implement the Smith-Waterman algorithm differently.


Constructor Summary
ProteinLocalAlignment()
          Construct a new protein sequence local alignment object.
 
Method Summary
abstract  Alignment align()
          Align the query sequence and the subject sequence.
 void setGapExistencePenalty(int g)
          Set the gap existence penalty.
 void setGapExtensionPenalty(int h)
          Set the gap extension penalty.
 void setQuerySequence(ProteinSequence theSequence, long theId)
          Set the query sequence.
 void setSubjectSequence(ProteinSequence theSequence, long theId)
          Set the subject sequence.
 void setSubstitutionMatrix(int[][] matrix)
          Set the protein substitution matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProteinLocalAlignment

public ProteinLocalAlignment()
Construct a new protein sequence local alignment object.

Method Detail

setSubstitutionMatrix

public void setSubstitutionMatrix(int[][] matrix)
Set the protein substitution matrix. If not set, the default is the BLOSUM-62 substitution matrix.

The matrix must be a 27×27-element matrix of integers. The expression matrix[x][y] is the score when amino acid x is aligned with amino acid y, where x and y are amino acids in the range 0..27 from a ProteinSequence.

Parameters:
matrix - Protein substition matrix.

setGapExistencePenalty

public void setGapExistencePenalty(int g)
Set the gap existence penalty. If not set, the default is −11.

The gap existence penalty is added to the alignment score for the first position of a gap.

Parameters:
g - Gap existence penalty. Assumed to be a negative integer.

setGapExtensionPenalty

public void setGapExtensionPenalty(int h)
Set the gap extension penalty. If not set, the default is −1.

The gap extension penalty is added to the alignment score for the second and subsequent positions of a gap.

Parameters:
h - Gap extension penalty. Assumed to be a negative integer.

setQuerySequence

public void setQuerySequence(ProteinSequence theSequence,
                             long theId)
Set the query sequence. The query sequence ID is an arbitrary integer; for example, it could be the index of a sequence in a ProteinDatabase.

Parameters:
theSequence - Query sequence.
theId - Query sequence ID.

setSubjectSequence

public void setSubjectSequence(ProteinSequence theSequence,
                               long theId)
Set the subject sequence. The subject sequence ID is an arbitrary integer; for example, it could be the index of a sequence in a ProteinDatabase.

Parameters:
theSequence - Subject sequence.
theId - Subject sequence ID.

align

public abstract Alignment align()
                         throws Exception
Align the query sequence and the subject sequence.

Calling the returned Alignment object's getQueryId() method will return the query sequence ID supplied to the setQuerySequence() method. Calling the returned Alignment object's getSubjectId() method will return the subject sequence ID supplied to the setSubjectSequence() method.

Returns:
Alignment.
Throws:
Exception - Thrown if an error occurred.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.