LikelihoodMatrix#

class pytantan.LikelihoodMatrix#

A likelihood ratio matrix derived from a scoring matrix.

This matrix is in the form:

\[\mathcal{L}_{x,y} = \frac{Q_{x,y}}{P_x P_y}\]

where \(Q_{x,y}\) is the probability of seeing letters \(x\) and \(y\) in equivalent positions of a tandem repeat, and \(P_x\) is the background probability of letter \(x\).

This matrix is related to a scoring matrix \(\mathcal{M}\) with an implicit scale factor \(\lambda\) by the following equation:

\[\mathcal{L}_{x,y} = e^{ \lambda \mathcal{M}_{x,y} }\]
alphabet#

The alphabet used to index the rows and columns of the matrix.

Type:

Alphabet

scoring_matrix#

The scoring matrix this likelihood ratio matrix was derived from, or None if it was created with explicit values.

Type:

ScoringMatrix or None

__init__(alphabet, scoring_matrix)#

Create a new score matrix from the given alphabet and scores.

Parameters:
  • alphabet (str or Alphabet) – The alphabet of the similarity matrix.

  • scoring_matrix (ScoringMatrix) – The scoring matrix, indexed by the alphabet characters.