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)[source]

Bases: Exception

For CanvasSimilarity method not yet implemented

__init__(*args)[source]

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

args
with_traceback()

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

class schrodinger.application.canvas.similarity.CanvasFingerprintSimilarity(logger)[source]

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)[source]

Initialize the similarity class

debug(output)[source]

Wrapper for debug logging, just to simplify logging

getDescription()[source]

Returns a string representing a summary of the current similarity settings

setMetric(metric_name)[source]

Set the current metric based on the metric name

getMetric()[source]

Returns the currently set metric

calculateSimilarity(fp1, fp2)[source]

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)[source]

Set the value of Alpha as used in the tversky similarity

setBeta(beta)[source]

Set the value of Alpha as used in the tversky similarity

getAlpha()[source]

Get the value of Alpha as used in the tversky similarity

getBeta()[source]

Get the value of Alpha as used in the tversky similarity

getMetricStyle()[source]

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

simHamming(fp1, fp2)[source]
simModifiedTanimoto(fp1, fp2)[source]
simPatternDifference(fp1, fp2)[source]
simShape(fp1, fp2)[source]
simSize(fp1, fp2)[source]
simVariance(fp1, fp2)[source]
simEuclidean(fp1, fp2)[source]
simTanimoto(fp1, fp2)[source]
simTversky(fp1, fp2)[source]
simSoergel(fp1, fp2)[source]
simMcConnaughey(fp1, fp2)[source]
simDice(fp1, fp2)[source]
simCosine(fp1, fp2)[source]
simSimpson(fp1, fp2)[source]
simPetke(fp1, fp2)[source]
simKulczynski(fp1, fp2)[source]
simBuser(fp1, fp2)[source]
simHamann(fp1, fp2)[source]
simMatching(fp1, fp2)[source]
simPearson(fp1, fp2)[source]
simRogersTanimoto(fp1, fp2)[source]
simYule(fp1, fp2)[source]
simDixon(fp1, fp2)[source]
simMinMax(fp1, fp2)[source]
class schrodinger.application.canvas.similarity.CanvasFingerprintSimilarityCLI(logger)[source]

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)[source]

Initialize the similarity class

addOptions(parser)[source]

Add options for similarity type, alpha and beta

parseOptions(options)[source]

Examine the options and set the internal state to reflect them

getSimilarityMetricDescription()[source]

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']
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)