scirpy.ir_dist.metrics.IdentityDistanceCalculator#

class scirpy.ir_dist.metrics.IdentityDistanceCalculator(cutoff=0)#

Calculates the Identity-distance between CDR3 sequences.

The identity distance is defined as
  • 0, if sequences are identical

  • 1, if sequences are not identical.

Choosing a cutoff:

For this DistanceCalculator, per definition, the cutoff = 0. The cutoff argument is ignored.

Parameters:

cutoff (int (default: 0)) – Will eleminate distances > cutoff to make efficient use of sparse matrices. For the IdentityDistanceCalculator this argument will be ignored and is always 0.

Attributes table#

DTYPE

The sparse matrix dtype.

Methods table#

calc_dist_mat(seqs[, seqs2])

In this case, the offseted distance matrix is the identity matrix.

squarify(triangular_matrix)

Mirror a triangular matrix at the diagonal to make it a square matrix.

Attributes#

IdentityDistanceCalculator.DTYPE = 'uint8'#

The sparse matrix dtype. Defaults to uint8, constraining the max distance to 255.

Methods#

IdentityDistanceCalculator.calc_dist_mat(seqs, seqs2=None)#

In this case, the offseted distance matrix is the identity matrix.

More details: DistanceCalculator.calc_dist_mat()

Return type:

csr_matrix

static IdentityDistanceCalculator.squarify(triangular_matrix)#

Mirror a triangular matrix at the diagonal to make it a square matrix.

The input matrix must be upper triangular to begin with, otherwise the results will be incorrect. No guard rails!

Return type:

csr_matrix