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.
protected int match_reward
The reward for a match (a substitution of equal characters).
protected int mismatch_penalty
The penalty for a mismatch (a substitution of different characters).
protected int gap_cost
The cost of a gap (an insertion or deletion of a character).
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.
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.
match_reward - reward for a substitution of equal charactersmismatch_penalty - penalty for a substitution of different charactersgap_cost - cost of an insertion or deletion of any characterpublic 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.
match_reward - reward for a substitution of equal charactersmismatch_penalty - penalty for a substitution of different charactersgap_cost - cost of an insertion or deletion of any charactercase_sensitive - true if the case of characters must be significant, false otherwisepublic 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.
a - first characterb - second charactermatch_reward if a equals b, mismatch_penalty otherwise.IncompatibleScoringSchemeException - if this substitution is not definedpublic int scoreInsertion(char a)
Always returns gap_cost for the insertion of any character.
a - the character to be insertedgap_costIncompatibleScoringSchemeException - if character is not recognised by this scoring schemepublic int scoreDeletion(char a)
Always returns gap_cost for the deletion of any character.
a - the character to be deletedgap_costIncompatibleScoringSchemeException - if character is not recognised by this scoring schemepublic 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.
match_reward, mismatch_penalty and gap_cost.public boolean isPartialMatchSupported()
Tells whether this scoring scheme supports partial matches, which it does not.
falsepublic java.lang.String toString()
Returns a String representation of this scoring scheme.