rdkit.Chem.Fingerprints.SimilarityScreener module — The RDKit 2025.09.6 documentation

# rdkit.Chem.Fingerprints.SimilarityScreener module

class definitions for similarity screening

See _SimilarityScreener_ for overview of required API

class rdkit.Chem.Fingerprints.SimilarityScreener.SimilarityScreener(probe=None, metric=None, dataSource=None, fingerprinter=None)

  Bases: `object`

  base class

  important attributes:

    > probe: the probe fingerprint against which we screen.

    > metric: a function that takes two arguments and returns a similarity

    >   measure between them

    > dataSource: the source pool from which to draw, needs to support

    >   a next() method

    > fingerprinter: a function that takes a molecule and returns a

    >   fingerprint of the appropriate format

    Notes

      subclasses must support either an iterator interface or __len__ and __getitem__

  GetSingleFingerprint(probe)

    returns a fingerprint for a single probe object

    This is potentially useful in initializing our internal probe object.

  Reset()

    used to reset screeners that behave as iterators

  SetProbe(probeFingerprint)

    sets our probe fingerprint

class rdkit.Chem.Fingerprints.SimilarityScreener.ThresholdScreener(threshold, **kwargs)

  Bases: `SimilarityScreener`

  Used to return all compounds that have a similarity

    to the probe beyond a threshold value

  Notes:

  > - This is as lazy as possible, so the data source isn’t queried until the client asks for a hit.

  > - In addition to being lazy, this class is as thin as possible. (Who’d have thought it was possible!) Hits are not stored locally, so if a client resets the iteration and starts over, the same amount of work must be done to retrieve the hits.

  > - The thinness and laziness forces us to support only forward iteration (not random access)

  Reset()

    used to reset our internal state so that iteration starts again from the beginning

  next()

    required part of iterator interface

class rdkit.Chem.Fingerprints.SimilarityScreener.TopNScreener(num, **kwargs)

  Bases: `SimilarityScreener`

  A screener that only returns the top N hits found

  Notes

  > - supports forward iteration and getitem

  Reset()

    used to reset screeners that behave as iterators

  next()