This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.

# SimilarityRules

 SimilarityRules is an option for functions such as SequenceAlignment that gives a list of rules for similarity scores to assume between pairs of elements.
• The setting for SimilarityRules must consist of a list of rules of the form {e1, e2}->v, where the ei give elements to compare, and v gives their similarity.
• The ei can be either explicit characters or other elements, or patterns.
• A rule for {e, ""} gives the score for a deletion; a rule for {"", e} gives the score for an insertion.
• is effectively equivalent to SimilarityRules -> {{a_, a_} -> 1, {a_, b_} -> -1}, giving a score of +1 for any pair of identical elements, and a score of -1 for any mismatch, deletion or insertion.
• The following named settings for SimilarityRules implement various similarity matrices typically used for particular bioinformatics purposes:
 "BLAST" alignment of nucleotide sequences "BLOSUM62" local alignment of related amino acid sequences "BLOSUM80" local alignment of similar sequences "PAM30" global alignment of very similar amino acid sequences "PAM70" global alignment of related sequences "PAM250" global alignment of dissimilar sequences
Align two strings on the first "X":
Align instead on the second "X" by making the {"b", "a"} replacement favorable:
Get the global similarity of two strings using default similarity scores:
Change the scores so "b" and "X" are considered a match:
Use the "PAM70" similarity matrix to globally align related protein sequences:
Align two strings on the first "X":
 Out[1]=
Align instead on the second "X" by making the {"b", "a"} replacement favorable:
 Out[2]=

Get the global similarity of two strings using default similarity scores:
 Out[1]=
Change the scores so "b" and "X" are considered a match:
 Out[2]=

Use the "PAM70" similarity matrix to globally align related protein sequences:
 Out[1]=
New in 7