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.
  • SimilarityRules->Automatic 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


Basic Examples  (3)

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:

Introduced in 2008