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