blinAlignment
Class PairwiseAlignment

java.lang.Object
  extended by blinAlignment.PairwiseAlignment

public class PairwiseAlignment
extends java.lang.Object


Constructor Summary
PairwiseAlignment(double match, double replace, double insert, double delete, double gapExtend, SubstitutionMatrix subMat)
          Constructs a new Object with the given parameters based on the Needleman-Wunsch algorithm The alphabet of sequences to be aligned will be taken from the given substitution matrix.
PairwiseAlignment(org.biojava.bio.symbol.FiniteAlphabet alpha, double match, double replace, double insert, double delete, double gapExtend)
          Constructs a new Object with the given parameters based on the Needleman-Wunsch algorithm.
 
Method Summary
 void align(org.biojava.bio.seq.Sequence source, org.biojava.bio.seq.Sequence target)
          Computes the alignment of source and target.
 org.biojava.bio.symbol.Alignment getAlignment()
          Returns the current alignment
 java.lang.String getAlignmentString()
          Gives a human readable representation of the alignment.
 double getDelete()
          Returns the current expenses of a single delete operation.
 double getEditDistance()
          Returns the score of the current alignment.
 double getGapExt()
          Returns the current expenses of any extension of a gap operation.
 double getInsert()
          Returns the current expenses of a single insert operation.
 double getMatch()
          Returns the current expenses of a single match operation.
 double getReplace()
          Returns the current expenses of a single replace operation.
 org.biojava.bio.seq.Sequence getSource()
          Returns the current source sequence of the alignment.
 org.biojava.bio.seq.Sequence getTarget()
          Returns the current target sequence of the alignment.
 java.lang.String printCostMatrix()
          Prints a String representation of the current CostMatrix.
 void setDelete(double del)
          Sets the penalty for a delete operation to the specified value.
 void setGapExt(double ge)
          Sets the penalty for an extension of any gap (insert or delete) to the specified value.
 void setInsert(double ins)
          Sets the penalty for an insert operation to the specified value.
 void setMatch(double ma)
          Sets the penalty for a match operation to the specified value.
 void setReplace(double rep)
          Sets the penalty for a replace operation to the specified value.
 void setSubstitutionMatrix(SubstitutionMatrix matrix)
          Sets the substitution matrix to be used to the specified one.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PairwiseAlignment

public PairwiseAlignment(double match,
                         double replace,
                         double insert,
                         double delete,
                         double gapExtend,
                         SubstitutionMatrix subMat)
Constructs a new Object with the given parameters based on the Needleman-Wunsch algorithm The alphabet of sequences to be aligned will be taken from the given substitution matrix.

Parameters:
match - This gives the costs for a match operation. It is only used, if there is no entry for a certain match of two symbols in the substitution matrix (default value).
replace - This is like the match parameter just the default, if there is no entry in the substitution matrix object.
insert - The costs of a single insert operation.
delete - The expenses of a single delete operation.
gapExtend - The expenses of an extension of a existing gap (that is a previous insert or delete. If the costs for insert and delete are equal and also equal to gapExtend, no affine gap penalties will be used, which saves a significant amount of memory.
subMat - The substitution matrix object which gives the costs for matches and replaces.

PairwiseAlignment

public PairwiseAlignment(org.biojava.bio.symbol.FiniteAlphabet alpha,
                         double match,
                         double replace,
                         double insert,
                         double delete,
                         double gapExtend)
Constructs a new Object with the given parameters based on the Needleman-Wunsch algorithm. An identity substitution matrix will be computed according to match and replace.

Parameters:
alpha - The alphabet of sequences
match - This gives the costs for any match operation
replace - This gives the costs for any replace operation
insert - The costs of a single insert operation.
delete - The expenses of a single delete operation
gapExtend - The expenses of an extension of a existing gap (that is a previous insert or delete. If the costs for insert and delete are equal and also equal to gapExtend, no affine gap penalties will be used, which saves a significant amount of memory
Method Detail

setSubstitutionMatrix

public void setSubstitutionMatrix(SubstitutionMatrix matrix)
Sets the substitution matrix to be used to the specified one. Afterwards it is only possible to align sequences of the alphabet of this substitution matrix.

Parameters:
matrix - an instance of a substitution matrix.

setInsert

public void setInsert(double ins)
Sets the penalty for an insert operation to the specified value.

Parameters:
ins - costs for a single insert operation

setDelete

public void setDelete(double del)
Sets the penalty for a delete operation to the specified value.

Parameters:
del - costs for a single deletion operation

setGapExt

public void setGapExt(double ge)
Sets the penalty for an extension of any gap (insert or delete) to the specified value.

Parameters:
ge - costs for any gap extension

setMatch

public void setMatch(double ma)
Sets the penalty for a match operation to the specified value.

Parameters:
ma - costs for a single match operation

setReplace

public void setReplace(double rep)
Sets the penalty for a replace operation to the specified value.

Parameters:
rep - costs for a single replace operation

getInsert

public double getInsert()
Returns the current expenses of a single insert operation.

Returns:
insert

getDelete

public double getDelete()
Returns the current expenses of a single delete operation.

Returns:
delete

getGapExt

public double getGapExt()
Returns the current expenses of any extension of a gap operation.

Returns:
gapExt

getMatch

public double getMatch()
Returns the current expenses of a single match operation.

Returns:
match

getReplace

public double getReplace()
Returns the current expenses of a single replace operation.

Returns:
replace

getSource

public org.biojava.bio.seq.Sequence getSource()
Returns the current source sequence of the alignment.

Returns:
sourceSeq

getTarget

public org.biojava.bio.seq.Sequence getTarget()
Returns the current target sequence of the alignment.

Returns:
targetSeq

printCostMatrix

public java.lang.String printCostMatrix()
Prints a String representation of the current CostMatrix.

Returns:
a String representation of the matrix.

align

public void align(org.biojava.bio.seq.Sequence source,
                  org.biojava.bio.seq.Sequence target)
Computes the alignment of source and target. One may then get the alignment or the score with getters.

Parameters:
source - The source sequence to be aligned
target - The target one

getAlignment

public org.biojava.bio.symbol.Alignment getAlignment()
Returns the current alignment

Returns:
Alignment object containing the two gapped sequences constructed from source and target.

getEditDistance

public double getEditDistance()
Returns the score of the current alignment.

Returns:
returns the current score

getAlignmentString

public java.lang.String getAlignmentString()
                                    throws org.biojava.bio.BioException
Gives a human readable representation of the alignment.

Returns:
a string representation of the alignment
Throws:
org.biojava.bio.BioException