rdkit.SimDivFilters.rdSimDivPickers module

Module containing the diversity and similarity pickers

class rdkit.SimDivFilters.rdSimDivPickers.ClusterMethod(*values)

Bases: Enum

CENTROID = 7
GOWER = 6
MCQUITTY = 5
UPGMA = 4
WARD = 1
class rdkit.SimDivFilters.rdSimDivPickers.HierarchicalClusterPicker(self, clusterMethod: rdkit.SimDivFilters.rdSimDivPickers.ClusterMethod)

Bases: object

A class for diversity picking of items using Hierarchical Clustering

Cluster(self, distMat: numpy.ndarray[dtype=float64, shape=(*), order='C', writable=False], poolSize: int, pickSize: int) list[list[int]]

Return a list of clusters of item from the pool using hierarchical clustering

Parameters:
  • distMat (-) – 1D distance matrix (only the lower triangle elements)

  • poolSize (-) – number of items in the pool

  • pickSize (-) – number of items to pick from the pool

Pick(self, distMat: numpy.ndarray[dtype=float64, shape=(*), order='C', writable=False], poolSize: int, pickSize: int) list[int]

Pick a diverse subset of items from a pool of items using hierarchical clustering

Parameters:
  • distMat (-) – 1D distance matrix (only the lower triangle elements)

  • poolSize (-) – number of items in the pool

  • pickSize (-) – number of items to pick from the pool

class rdkit.SimDivFilters.rdSimDivPickers.LeaderPicker(self)

Bases: object

A class for diversity picking of items using Roger Sayle’s Leader algorithm (analogous to sphere exclusion). The algorithm is currently unpublished, but a description is available in this presentation from the 2019 RDKit UGM: https://github.com/rdkit/UGM_2019/raw/master/Presentations/Sayle_Clustering.pdf

LazyBitVectorPick(self, objects: object, poolSize: int, threshold: float, pickSize: int = 0, firstPicks: object = (), numThreads: int = 1) list[int]

Pick a subset of items from a collection of bit vectors using Tanimoto distance. The threshold value is a distance (i.e. 1-similarity). Note that the numThreads argument is currently ignored.

LazyPick(self, distFunc: object, poolSize: int, threshold: float, pickSize: int = 0, firstPicks: object = (), numThreads: int = 1) list[int]

Pick a subset of items from a pool of items using the user-provided function to determine distances. Note that the numThreads argument is currently ignored.

class rdkit.SimDivFilters.rdSimDivPickers.MaxMinPicker(self)

Bases: object

A class for diversity picking of items using the MaxMin Algorithm

LazyBitVectorPick(self, objects: object, poolSize: int, pickSize: int, firstPicks: object = (), seed: int = -1, useCache: object | None = None) list[int]

Pick a subset of items from a pool of bit vectors using the MaxMin Algorithm Ashton, M. et. al., Quant. Struct.-Act. Relat., 21 (2002), 598-604 :param - vectors: a sequence of the bit vectors that should be picked from. :param - poolSize: number of items in the pool :param - pickSize: number of items to pick from the pool :param - firstPicks: (optional) the first items to be picked (seeds the list) :param - seed: (optional) seed for the random number generator :param - useCache: IGNORED.

LazyBitVectorPickWithThreshold(self, objects: object, poolSize: int, pickSize: int, threshold: float, firstPicks: object = (), seed: int = -1) tuple[list[int], float]

Pick a subset of items from a pool of bit vectors using the MaxMin Algorithm Ashton, M. et. al., Quant. Struct.-Act. Relat., 21 (2002), 598-604 :param - vectors: a sequence of the bit vectors that should be picked from. :param - poolSize: number of items in the pool :param - pickSize: number of items to pick from the pool :param - threshold: stop picking when the distance goes below this value :param - firstPicks: (optional) the first items to be picked (seeds the list) :param - seed: (optional) seed for the random number generator

LazyPick(self, distFunc: object, poolSize: int, pickSize: int, firstPicks: object = (), seed: int = -1, useCache: object | None = None) list[int]

Pick a subset of items from a pool of items using the MaxMin Algorithm Ashton, M. et. al., Quant. Struct.-Act. Relat., 21 (2002), 598-604 :param - distFunc: a function that should take two indices and return the

distance between those two points. NOTE: the implementation caches distance values, so the client code does not need to do so; indeed, it should not.

Parameters:
  • poolSize (-) – number of items in the pool

  • pickSize (-) – number of items to pick from the pool

  • firstPicks (-) – (optional) the first items to be picked (seeds the list)

  • seed (-) – (optional) seed for the random number generator

  • useCache (-) – IGNORED

LazyPickWithThreshold(self, distFunc: object, poolSize: int, pickSize: int, threshold: float, firstPicks: object = (), seed: int = -1) tuple[list[int], float]

Pick a subset of items from a pool of items using the MaxMin Algorithm Ashton, M. et. al., Quant. Struct.-Act. Relat., 21 (2002), 598-604 :param - distFunc: a function that should take two indices and return the

distance between those two points. NOTE: the implementation caches distance values, so the client code does not need to do so; indeed, it should not.

Parameters:
  • poolSize (-) – number of items in the pool

  • pickSize (-) – number of items to pick from the pool

  • threshold (-) – stop picking when the distance goes below this value

  • firstPicks (-) – (optional) the first items to be picked (seeds the list)

  • seed (-) – (optional) seed for the random number generator

Pick(self, distMat: numpy.ndarray[dtype=float64, shape=(*), order='C'], poolSize: int, pickSize: int, firstPicks: object = (), seed: int = -1) list[int]

Pick a subset of items from a pool of items using the MaxMin Algorithm Ashton, M. et. al., Quant. Struct.-Act. Relat., 21 (2002), 598-604

Parameters:
  • distMat (-) – 1D distance matrix (only the lower triangle elements)

  • poolSize (-) – number of items in the pool

  • pickSize (-) – number of items to pick from the pool

  • firstPicks (-) – (optional) the first items to be picked (seeds the list)

  • seed (-) – (optional) seed for the random number generator