scirpy.ir_dist.metrics.ParallelDistanceCalculator

class scirpy.ir_dist.metrics.ParallelDistanceCalculator(cutoff, *, n_jobs=None, block_size=50)

Abstract base class for a DistanceCalculator that computes distances in parallel.

It does so in a blockwise fashion. The function computing distances for a single block needs to be overriden.

Parameters
n_jobs : int | NoneOptional[int] (default: None)

Number of jobs to use for the pairwise distance calculation. If None, use all jobs (only for ParallelDistanceCalculators).

block_size : int | NoneOptional[int] (default: 50)

The width of a block of the matrix that will be delegated to a worker process. The block contains block_size ** 2 elements.

Attributes

DTYPE

The sparse matrix dtype.

Methods

calc_dist_mat(seqs[, seqs2])

Calculate the distance matrix.

squarify(triangular_matrix)

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