org.sStu
Class AlignerFactory

java.lang.Object
  extended byorg.sStu.AlignerFactory

public class AlignerFactory
extends java.lang.Object

AlignerFactory creates and returns various aligners with the given parameters.>

Author:
Audrius Meskauskas
See Also:
http://www.gnu.org/licenses/gpl.txt

Field Summary
protected  CharComparator comparator
          Set the class responsible for the character comparison.
protected  boolean End_gap_penalty
          Normally the unaligned start and end of the global alignment do not contribute to the score.
protected  int Gap_weight
          The gap weigth (used only in gapped aligners).
protected  boolean Gapped
          Request aligner that aligns both sequences over the whole length.
protected  boolean Global
          Request the global aligner.
protected  int Match_weight
          Match weight.
protected  int MaxDifferences
          Maximal number of differences.
protected  int Mismatch_weigth
          Weigth of mismatch.
protected  int[][] Score_matrix
          Set the score matrix.
protected  boolean Show_Ends
          Normally the unaligned start and end of the global alignment are not included into report.
static int UNSET
          Special value indicating that the value has not been set.
 
Constructor Summary
AlignerFactory()
          Constructs the AlignerFactory.
 
Method Summary
 AlignmentRangeAligner createAlignmentRangeAligner()
          Create the most comperhensive version of aligner, able to return range of suboptimal alignments.
 ScoreOnlyAligner createScoreOnlyAligner()
          Create the fastest version of aligner, able to return the best score only.
 SingleAlingmentAligner createSingleAlingmentAligner()
          Create the intermediate version of aligner, able to return the single best alignment.
 CharComparator getComparator()
          Return the comparator.
 int getGap_weight()
          Return the gap weight.
 int getMatch_weight()
          Return the match weight.
 int getMaxDifferences()
          Return the maximal expected number of differences.
 int getMismatch_weigth()
          Return the Mismatch_weigth.
 boolean isEnd_gap_penalty()
          Normally the unaligned start and end of the global alignment do not contribute to the score.
 boolean isGapped()
          Check if the requested aligner supports the gap conception.
 boolean isGlobal()
          Get type of requested alingment (global or local).
 boolean isShow_Ends()
          Normally the unaligned ends of sequences are not included in report.
 void setComparator(CharComparator comparator)
          Replace the default char comparator, implementig user-defined strategy of the character comparison.
 void setEnd_gap_penalty(boolean penalty)
          Normally the unaligned start and end of the global alignment do not contribute to the score.
 void setGap_weight(int Gap_weight)
          Set gap weight for the gapped aligner.
 void setGapped(boolean MindGaps)
          Request the gapped aligner, counting gaps and not just spaces.
 void setGlobal(boolean Global)
          Set the type of the requested alignment.
 void setMatch_weight(int Match_weight)
          Set match weight to the new value.
 void setMaxDifferences(int MaxDifferences)
          Set mismatch weigth to the new value.
 void setMismatch_weigth(int Mismatch_weigth)
          Set mismatch weigth to the new value.
protected  void setParameters(org.sStu.Neringute.Similarity.generalSimilarityBasedAligner a)
          Create the aligner expecting the known limited number of differences between two sequences.
 void setScore_matrix(char[][] matrix)
          Set score matrix, defining comparison values for any expected pair of characters.
 void setShow_Ends(boolean show)
          Normally the unaligned start and end of the global alignment are not included into report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Global

protected boolean Global
Request the global aligner. By default, the factory returs the local aligner


Gapped

protected boolean Gapped
Request aligner that aligns both sequences over the whole length. By defaultthe insertions and deletions at the beginning and end of the sequences do not contribute gap penalties. The parameter only makes sense for global alignments.


Gap_weight

protected int Gap_weight
The gap weigth (used only in gapped aligners). The default value is usually -2.


Mismatch_weigth

protected int Mismatch_weigth
Weigth of mismatch. Used only if user comparator or score matrix are not set.


Score_matrix

protected int[][] Score_matrix
Set the score matrix. If the matrix is set, the Match amd Mismatch weigths are ignored, and the values from the matrix are used. The size of this array must be sufficient to cover the values of all expected characters. User comparator, if set, can get this matrix using protected variable Score_matrix


Match_weight

protected int Match_weight
Match weight. Used only if the score matrix or user comparator are not set. The default value is 2.


comparator

protected CharComparator comparator
Set the class responsible for the character comparison. In this way it is possible completely override the comparison strategy.


Show_Ends

protected boolean Show_Ends
Normally the unaligned start and end of the global alignment are not included into report. It is possible to force to include them by setting this flag.


End_gap_penalty

protected boolean End_gap_penalty
Normally the unaligned start and end of the global alignment do not contribute to the score. They contribute if this flag is set.


MaxDifferences

protected int MaxDifferences
Maximal number of differences. Limiting number of differences increases the computation speed.


UNSET

public static int UNSET
Special value indicating that the value has not been set. The default recommended value for the chosen aligner will be used.

Constructor Detail

AlignerFactory

public AlignerFactory()
Constructs the AlignerFactory. The same instance of AlignerFactory can later produce any desired number of aligners.

Method Detail

isGlobal

public boolean isGlobal()
Get type of requested alingment (global or local). Global aligners compare the sequences over the whole length. Local aligners are looking for specific regions of high similarity.

Returns:
the type of the requested alignment (true for global, false for local)

setGlobal

public void setGlobal(boolean Global)
Set the type of the requested alignment. The default is local.

Parameters:
Global - the type of the requested alignment (true for global, false for local.

isGapped

public boolean isGapped()
Check if the requested aligner supports the gap conception. Gap is any number of spaces and has a single score.

Returns:
the type of the requested alignment (true for global, false for local)
See Also:
setGap_weight

setGapped

public void setGapped(boolean MindGaps)
Request the gapped aligner, counting gaps and not just spaces. These aligners are typically much slower. Gap is any number of spaces and has a single score.

Parameters:
MindGaps - true for gapper aligner, false (default) for the simple aligner.

isShow_Ends

public boolean isShow_Ends()
Normally the unaligned ends of sequences are not included in report. It is possible to force to include them by setting this flag. Unaligned ends may contibute or not contribute to the alignment score, depending from the flag setEnd_gap_penalty.

Returns:
True if the ends of the global alignment must be included into report.
See Also:
setEnd_gap_penalty

setShow_Ends

public void setShow_Ends(boolean show)
Normally the unaligned start and end of the global alignment are not included into report. It is possible to force to include them by setting this flag.

Parameters:
show - true if ends must be included

isEnd_gap_penalty

public boolean isEnd_gap_penalty()
Normally the unaligned start and end of the global alignment do not contribute to the score. They contribute if this flag is set.

Returns:
true if the unaligned start and end of the global alignment contribute to the score.

setEnd_gap_penalty

public void setEnd_gap_penalty(boolean penalty)
Normally the unaligned start and end of the global alignment do not contribute to the score. They contribute if this flag is set.

Parameters:
penalty - true if the unaligned start and end of the global alignment contribute to the score.

getGap_weight

public int getGap_weight()
Return the gap weight. Gap weight is used in gapped aligners only.

Returns:
Gap weight.

setGap_weight

public void setGap_weight(int Gap_weight)
Set gap weight for the gapped aligner. This has effect only if the gapped aligner is requested.

Parameters:
Gap_weight - gap weight

getMismatch_weigth

public int getMismatch_weigth()
Return the Mismatch_weigth.

Returns:
the mismatch weigth.

setMismatch_weigth

public void setMismatch_weigth(int Mismatch_weigth)
Set mismatch weigth to the new value. This value is ignored if the score matrix or the whole character comparator are replaced. The default value is -1.

Parameters:
Mismatch_weigth - Mismatch weigth

getMaxDifferences

public int getMaxDifferences()
Return the maximal expected number of differences.

Returns:
Maximal expected number of differences in alignment. This is not supported in the current version.

setMaxDifferences

public void setMaxDifferences(int MaxDifferences)
Set mismatch weigth to the new value. This value is ignored if the score matrix or the whole character comparator are replaced. The default value is -1.

Parameters:
MaxDifferences - Maximal expected number of differences in alignment. This is not supported in the current version.

setScore_matrix

public void setScore_matrix(char[][] matrix)
Set score matrix, defining comparison values for any expected pair of characters. For characters outside the score matrix, the default match and mismatch values are used.

Parameters:
matrix - Two dimensional of weights, default match and mismatch values.;

getMatch_weight

public int getMatch_weight()
Return the match weight.

Returns:
the match weight.

setMatch_weight

public void setMatch_weight(int Match_weight)
Set match weight to the new value. The default value is 1. It is used only score matrix or user char comparator are set.

Parameters:
Match_weight - Match weigth

getComparator

public CharComparator getComparator()
Return the comparator.

Returns:
the comparator.

setComparator

public void setComparator(CharComparator comparator)
Replace the default char comparator, implementig user-defined strategy of the character comparison.

Parameters:
comparator - New comparator that must implement CharComparator interface.

createScoreOnlyAligner

public ScoreOnlyAligner createScoreOnlyAligner()
Create the fastest version of aligner, able to return the best score only.

Returns:
Time-effective aligner that returns the best score only.

createSingleAlingmentAligner

public SingleAlingmentAligner createSingleAlingmentAligner()
Create the intermediate version of aligner, able to return the single best alignment.

Returns:
Aligner able to return the best alignment.

createAlignmentRangeAligner

public AlignmentRangeAligner createAlignmentRangeAligner()
Create the most comperhensive version of aligner, able to return range of suboptimal alignments.

Returns:
Aligner, able to return a range of suboptimal alignments.

setParameters

protected void setParameters(org.sStu.Neringute.Similarity.generalSimilarityBasedAligner a)
Create the aligner expecting the known limited number of differences between two sequences. Only global ungapped aligners are supported in this mode.

Parameters:
a - Implementation specific aligner class for that the parameters must be set.