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.

Details

  • 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
  • When working on BioSequence arguments, the "SimilarDegenerateBases" setting will allow for any letters that potentially share any underlying chemical to match.

Examples

Basic Examples  (4)

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:

See the difference in local alignment when using the "SimilarDegenerateBases" setting:

Wolfram Research (2008), SimilarityRules, Wolfram Language function, https://reference.wolfram.com/language/ref/SimilarityRules.html (updated 2020).

Text

Wolfram Research (2008), SimilarityRules, Wolfram Language function, https://reference.wolfram.com/language/ref/SimilarityRules.html (updated 2020).

CMS

Wolfram Language. 2008. "SimilarityRules." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/SimilarityRules.html.

APA

Wolfram Language. (2008). SimilarityRules. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SimilarityRules.html

BibTeX

@misc{reference.wolfram_2023_similarityrules, author="Wolfram Research", title="{SimilarityRules}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/SimilarityRules.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_similarityrules, organization={Wolfram Research}, title={SimilarityRules}, year={2020}, url={https://reference.wolfram.com/language/ref/SimilarityRules.html}, note=[Accessed: 19-March-2024 ]}