Skip to content

Tanimoto

Compute pairwise Tanimoto similarities and distances for a set of fingerprints.

TanimotoSimilarities(ids, condensed_distances, edges, min_sim)

Dataclass holding the results of one similarity pass over a set of fingerprints.

condensed_distances

The lower-triangle of (1 - Tm) matrix where the compound at index i has distances to compounds at indices j in 0..i-1. Length is N(N-1)/2 where N is the number of compounds.

edges

List of tuples containing the compound ids and their Tanimoto similarity for every pair with Tm >= floor.

ids

Frozen id order for the compounds set in the similarity pass. Indices in condensed_distances refer to this.

min_sim

The threshold applied to produce edges. Only pairs with Tm >= floor are included in edges.

n

Number of compounds in the similarity pass.

__post_init__()

check_floor(min_sim)

Check that the floor value is valid.

PARAMETER DESCRIPTION
min_sim

The floor value to check.

TYPE: float

compute_pairwise(items, min_sim)

One pass: build the condensed distance array AND the >= min_sim edge list.

PARAMETER DESCRIPTION
items

a dictionary with the compound ids as the keys and their fingerprints as the values.

TYPE: dict[str, ExplicitBitVect]

min_sim

Minimum Tanimoto similarity for an edge to be kept

TYPE: float

RETURNS DESCRIPTION
TanimotoSimilarities

A TanimotoSimilarities object containing the condensed distance array and the edge list.