schrodinger.application.canvas.similarity module

Support for Canvas fingerprint similarity operations.

There are classes to perform similarity calculations and to support command line interfaces for similarity options.

Copyright Schrodinger, LLC. All rights reserved.

exception schrodinger.application.canvas.similarity.CanvasSimilarityNotImplemented(*args)

Bases: Exception

For CanvasSimilarity method not yet implemented

__init__(*args)

Initialize self. See help(type(self)) for accurate signature.

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.canvas.similarity', '__doc__': ' For CanvasSimilarity method not yet implemented ', '__init__': <function CanvasSimilarityNotImplemented.__init__>, '__weakref__': <attribute '__weakref__' of 'CanvasSimilarityNotImplemented' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.canvas.similarity'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.canvas.similarity.CanvasFingerprintSimilarity(logger)

Bases: object

A class which encapsulates the Canvas fingerprint similarity tools. This includes recording and implementing the available similarity metrics. Currently the metrics are implemented at the Python level as this demonstrates how the fingerprint manipulations are performed however ultimately these will be replaced with wrappers to the underlying Canvaslibs tools which should be more efficient

SIMILARITY_METRICS = ['Tanimoto', 'Modified Tanimoto', 'Hamming', 'Soergel', 'McConnaughey', 'Dice', 'Cosine', 'Simpson', 'Petke', 'Kulczynski', 'Euclidean', 'Tversky', 'Buser', 'Variance', 'Size', 'Shape', 'Pattern Difference', 'Hamann', 'Matching', 'Pearson', 'Rogers Tanimoto', 'Yule', 'Dixon', 'MinMax']
__init__(logger)

Initialize the similarity class

debug(output)

Wrapper for debug logging, just to simplify logging

getDescription()

Returns a string representing a summary of the current similarity settings

setMetric(metric_name)

Set the current metric based on the metric name

getMetric()

Returns the currently set metric

calculateSimilarity(fp1, fp2)

Calculate the similarity between the two fingerprints and return the value. The similarity is calculated using the similarity method which is current for this object (as set by setMetric())

setAlpha(alpha)

Set the value of Alpha as used in the tversky similarity

setBeta(beta)

Set the value of Alpha as used in the tversky similarity

getAlpha()

Get the value of Alpha as used in the tversky similarity

getBeta()

Get the value of Alpha as used in the tversky similarity

getMetricStyle()

Return a value corresponding to the current metric style. This is used in difference matrix construction as part of clustering

simHamming(fp1, fp2)
simModifiedTanimoto(fp1, fp2)
simPatternDifference(fp1, fp2)
simShape(fp1, fp2)
simSize(fp1, fp2)
simVariance(fp1, fp2)
simEuclidean(fp1, fp2)
simTanimoto(fp1, fp2)
simTversky(fp1, fp2)
simSoergel(fp1, fp2)
simMcConnaughey(fp1, fp2)
simDice(fp1, fp2)
simCosine(fp1, fp2)
simSimpson(fp1, fp2)
simPetke(fp1, fp2)
simKulczynski(fp1, fp2)
simBuser(fp1, fp2)
simHamann(fp1, fp2)
simMatching(fp1, fp2)
simPearson(fp1, fp2)
simRogersTanimoto(fp1, fp2)
simYule(fp1, fp2)
simDixon(fp1, fp2)
simMinMax(fp1, fp2)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.canvas.similarity', '__doc__': '\n A class which encapsulates the Canvas fingerprint similarity tools.\n This includes recording and implementing the available similarity metrics.\n Currently the metrics are implemented at the Python level as this\n demonstrates how the fingerprint manipulations are performed however\n ultimately these will be replaced with wrappers to the underlying\n Canvaslibs tools which should be more efficient\n ', 'SIMILARITY_METRICS': ['Tanimoto', 'Modified Tanimoto', 'Hamming', 'Soergel', 'McConnaughey', 'Dice', 'Cosine', 'Simpson', 'Petke', 'Kulczynski', 'Euclidean', 'Tversky', 'Buser', 'Variance', 'Size', 'Shape', 'Pattern Difference', 'Hamann', 'Matching', 'Pearson', 'Rogers Tanimoto', 'Yule', 'Dixon', 'MinMax'], '__init__': <function CanvasFingerprintSimilarity.__init__>, 'debug': <function CanvasFingerprintSimilarity.debug>, 'getDescription': <function CanvasFingerprintSimilarity.getDescription>, 'setMetric': <function CanvasFingerprintSimilarity.setMetric>, 'getMetric': <function CanvasFingerprintSimilarity.getMetric>, 'calculateSimilarity': <function CanvasFingerprintSimilarity.calculateSimilarity>, 'setAlpha': <function CanvasFingerprintSimilarity.setAlpha>, 'setBeta': <function CanvasFingerprintSimilarity.setBeta>, 'getAlpha': <function CanvasFingerprintSimilarity.getAlpha>, 'getBeta': <function CanvasFingerprintSimilarity.getBeta>, 'getMetricStyle': <function CanvasFingerprintSimilarity.getMetricStyle>, '_getABC': <function CanvasFingerprintSimilarity._getABC>, 'simHamming': <function CanvasFingerprintSimilarity.simHamming>, 'simModifiedTanimoto': <function CanvasFingerprintSimilarity.simModifiedTanimoto>, 'simPatternDifference': <function CanvasFingerprintSimilarity.simPatternDifference>, 'simShape': <function CanvasFingerprintSimilarity.simShape>, 'simSize': <function CanvasFingerprintSimilarity.simSize>, 'simVariance': <function CanvasFingerprintSimilarity.simVariance>, 'simEuclidean': <function CanvasFingerprintSimilarity.simEuclidean>, 'simTanimoto': <function CanvasFingerprintSimilarity.simTanimoto>, 'simTversky': <function CanvasFingerprintSimilarity.simTversky>, 'simSoergel': <function CanvasFingerprintSimilarity.simSoergel>, 'simMcConnaughey': <function CanvasFingerprintSimilarity.simMcConnaughey>, 'simDice': <function CanvasFingerprintSimilarity.simDice>, 'simCosine': <function CanvasFingerprintSimilarity.simCosine>, 'simSimpson': <function CanvasFingerprintSimilarity.simSimpson>, 'simPetke': <function CanvasFingerprintSimilarity.simPetke>, 'simKulczynski': <function CanvasFingerprintSimilarity.simKulczynski>, 'simBuser': <function CanvasFingerprintSimilarity.simBuser>, 'simHamann': <function CanvasFingerprintSimilarity.simHamann>, 'simMatching': <function CanvasFingerprintSimilarity.simMatching>, 'simPearson': <function CanvasFingerprintSimilarity.simPearson>, 'simRogersTanimoto': <function CanvasFingerprintSimilarity.simRogersTanimoto>, 'simYule': <function CanvasFingerprintSimilarity.simYule>, 'simDixon': <function CanvasFingerprintSimilarity.simDixon>, 'simMinMax': <function CanvasFingerprintSimilarity.simMinMax>, '__dict__': <attribute '__dict__' of 'CanvasFingerprintSimilarity' objects>, '__weakref__': <attribute '__weakref__' of 'CanvasFingerprintSimilarity' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.canvas.similarity'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.application.canvas.similarity.CanvasFingerprintSimilarityCLI(logger)

Bases: schrodinger.application.canvas.similarity.CanvasFingerprintSimilarity

A subclass of the CanvasFingerprintSimilarity class which supports operations from the command line. In particular the parsing and applying of options and the printing of a description of the available similarity metrics

__init__(logger)

Initialize the similarity class

addOptions(parser)

Add options for similarity type, alpha and beta

parseOptions(options)

Examine the options and set the internal state to reflect them

getSimilarityMetricDescription()

Return a string which contains a description available similarity

SIMILARITY_METRICS = ['Tanimoto', 'Modified Tanimoto', 'Hamming', 'Soergel', 'McConnaughey', 'Dice', 'Cosine', 'Simpson', 'Petke', 'Kulczynski', 'Euclidean', 'Tversky', 'Buser', 'Variance', 'Size', 'Shape', 'Pattern Difference', 'Hamann', 'Matching', 'Pearson', 'Rogers Tanimoto', 'Yule', 'Dixon', 'MinMax']
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.canvas.similarity', '__doc__': '\n A subclass of the CanvasFingerprintSimilarity class which supports\n operations from the command line. In particular the parsing and\n applying of options and the printing of a description of the\n available similarity metrics\n ', '__init__': <function CanvasFingerprintSimilarityCLI.__init__>, 'addOptions': <function CanvasFingerprintSimilarityCLI.addOptions>, 'parseOptions': <function CanvasFingerprintSimilarityCLI.parseOptions>, 'getSimilarityMetricDescription': <function CanvasFingerprintSimilarityCLI.getSimilarityMetricDescription>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.canvas.similarity'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

calculateSimilarity(fp1, fp2)

Calculate the similarity between the two fingerprints and return the value. The similarity is calculated using the similarity method which is current for this object (as set by setMetric())

debug(output)

Wrapper for debug logging, just to simplify logging

getAlpha()

Get the value of Alpha as used in the tversky similarity

getBeta()

Get the value of Alpha as used in the tversky similarity

getDescription()

Returns a string representing a summary of the current similarity settings

getMetric()

Returns the currently set metric

getMetricStyle()

Return a value corresponding to the current metric style. This is used in difference matrix construction as part of clustering

setAlpha(alpha)

Set the value of Alpha as used in the tversky similarity

setBeta(beta)

Set the value of Alpha as used in the tversky similarity

setMetric(metric_name)

Set the current metric based on the metric name

simBuser(fp1, fp2)
simCosine(fp1, fp2)
simDice(fp1, fp2)
simDixon(fp1, fp2)
simEuclidean(fp1, fp2)
simHamann(fp1, fp2)
simHamming(fp1, fp2)
simKulczynski(fp1, fp2)
simMatching(fp1, fp2)
simMcConnaughey(fp1, fp2)
simMinMax(fp1, fp2)
simModifiedTanimoto(fp1, fp2)
simPatternDifference(fp1, fp2)
simPearson(fp1, fp2)
simPetke(fp1, fp2)
simRogersTanimoto(fp1, fp2)
simShape(fp1, fp2)
simSimpson(fp1, fp2)
simSize(fp1, fp2)
simSoergel(fp1, fp2)
simTanimoto(fp1, fp2)
simTversky(fp1, fp2)
simVariance(fp1, fp2)
simYule(fp1, fp2)