org.jscience.biology.alignment
Class BasicScoringScheme

java.lang.Object
  extended by org.jscience.biology.alignment.ScoringScheme
      extended by org.jscience.biology.alignment.BasicScoringScheme

public class BasicScoringScheme
extends ScoringScheme

This class implements a basic scoring scheme. At least three parameters must be provided to the constructor: the reward for a match (a substitution of equal characters), the penalty for a mismatch (a substitution of different characters) and the cost of a gap (an insertion or deletion of a character). Note that it only supports an additive gap cost function.

Although the match reward is expected to be a positive value, and the mismatch penalty and the gap cost are expected to be negative, no attempt is made to enforce these behaviour.


Field Summary
protected  int gap_cost
          The cost of a gap (an insertion or deletion of a character).
protected  int match_reward
          The reward for a match (a substitution of equal characters).
protected  int max_absolute_score
          The maximum absolute score that this scoring scheme can return, which is the maximum absolute value among match_reward, mismatch_penalty and gap_cost.
protected  int mismatch_penalty
          The penalty for a mismatch (a substitution of different characters).
 
Fields inherited from class org.jscience.biology.alignment.ScoringScheme
case_sensitive
 
Constructor Summary
BasicScoringScheme(int match_reward, int mismatch_penalty, int gap_cost)
          Creates a new instance of a basic scoring scheme with the specified values of match reward, mismatch penalty and gap cost.
BasicScoringScheme(int match_reward, int mismatch_penalty, int gap_cost, boolean case_sensitive)
          Creates a new instance of basic scoring scheme with the specified values of match reward, mismatch penalty and gap cost.
 
Method Summary
 boolean isPartialMatchSupported()
          Tells whether this scoring scheme supports partial matches, which it does not.
 int maxAbsoluteScore()
          Returns the maximum absolute score that this scoring scheme can return for any substitution, deletion or insertion, which is the maximum absolute value among match_reward, mismatch_penalty and gap_cost.
 int scoreDeletion(char a)
          Always returns gap_cost for the deletion of any character.
 int scoreInsertion(char a)
          Always returns gap_cost for the insertion of any character.
 int scoreSubstitution(char a, char b)
          Returns the score of a substitution of character a for character b according to this scoring scheme.
 java.lang.String toString()
          Returns a String representation of this scoring scheme.
 
Methods inherited from class org.jscience.biology.alignment.ScoringScheme
isCaseSensitive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

match_reward

protected int match_reward
The reward for a match (a substitution of equal characters).


mismatch_penalty

protected int mismatch_penalty
The penalty for a mismatch (a substitution of different characters).


gap_cost

protected int gap_cost
The cost of a gap (an insertion or deletion of a character).


max_absolute_score

protected int max_absolute_score
The maximum absolute score that this scoring scheme can return, which is the maximum absolute value among match_reward, mismatch_penalty and gap_cost.

Constructor Detail

BasicScoringScheme

public BasicScoringScheme(int match_reward,
                          int mismatch_penalty,
                          int gap_cost)
Creates a new instance of a basic scoring scheme with the specified values of match reward, mismatch penalty and gap cost. The case of characters is significant when subsequently computing their score.

Parameters:
match_reward - reward for a substitution of equal characters
mismatch_penalty - penalty for a substitution of different characters
gap_cost - cost of an insertion or deletion of any character

BasicScoringScheme

public BasicScoringScheme(int match_reward,
                          int mismatch_penalty,
                          int gap_cost,
                          boolean case_sensitive)
Creates a new instance of basic scoring scheme with the specified values of match reward, mismatch penalty and gap cost. If case_sensitive is true, the case of characters is significant when subsequently computing their score; otherwise the case is ignored.

Parameters:
match_reward - reward for a substitution of equal characters
mismatch_penalty - penalty for a substitution of different characters
gap_cost - cost of an insertion or deletion of any character
case_sensitive - true if the case of characters must be significant, false otherwise
Method Detail

scoreSubstitution

public int scoreSubstitution(char a,
                             char b)
Returns the score of a substitution of character a for character b according to this scoring scheme. It is match_reward if a equals b, mismatch_penalty otherwise.

Specified by:
scoreSubstitution in class ScoringScheme
Parameters:
a - first character
b - second character
Returns:
match_reward if a equals b, mismatch_penalty otherwise.

scoreInsertion

public int scoreInsertion(char a)
Always returns gap_cost for the insertion of any character.

Specified by:
scoreInsertion in class ScoringScheme
Parameters:
a - the character to be inserted
Returns:
gap_cost

scoreDeletion

public int scoreDeletion(char a)
Always returns gap_cost for the deletion of any character.

Specified by:
scoreDeletion in class ScoringScheme
Parameters:
a - the character to be deleted
Returns:
gap_cost

maxAbsoluteScore

public int maxAbsoluteScore()
Returns the maximum absolute score that this scoring scheme can return for any substitution, deletion or insertion, which is the maximum absolute value among match_reward, mismatch_penalty and gap_cost.

Specified by:
maxAbsoluteScore in class ScoringScheme
Returns:
the maximum absolute value among match_reward, mismatch_penalty and gap_cost.

isPartialMatchSupported

public boolean isPartialMatchSupported()
Tells whether this scoring scheme supports partial matches, which it does not.

Specified by:
isPartialMatchSupported in class ScoringScheme
Returns:
always return false

toString

public java.lang.String toString()
Returns a String representation of this scoring scheme.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this scoring scheme