schrodinger.application.canvas.similaritygui module

Support for Canvas fingerprint similarity operations that use GUI components.

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

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.canvas.similaritygui.CanvasFingerprintSimilarityGUI(logger)

Bases: schrodinger.application.canvas.similarity.CanvasFingerprintSimilarity

A subclass of the canvas fingerprint similarity manager which is to be used from a program with a TKInter interface. This class has methods for creating a component which displays all the similarity metrics options and takes care of managing the internal state

getGUI()

Returns a GUI component which displays the similarity options

setMetricCB(metric)

A callback for setting the similarity metric - takes care of enabling the alpha and beta boxes. Also makes sure that the program is ready to calculate similarity via the chosen metric.

Parameters

metric (str) – the name of the similarity metric to use

update()

Update the internal state to reflect the GUI (used mainly for alpha and beta values

getCalculationGUI(command, msg=None)

Create the GUI section that has the calculate button

Parameters
  • command (callable object) – function to be called when the Calculate Similarity button is pressed.

  • msg (str) – The message that appears right above the button

Return type

swidgets.SGroupBox (QGroupBox object)

Returns

a groupbox with the calculation widgets

getTab(command=None, settings=True, calculation=True, msg=None)

Creates a tab that can be used in a QTabWidget for calculating similarity. The tab has a CanvasFingerprintSimilarityGUI section and a Similarity Calculation section (set up here).

Parameters
  • command (callable object) – function to be called when the Calculate Similarity button is pressed.

  • settings (bool) – True if the settings section is included, False if not

  • calculation (bool) – True if the calculation section is included, False if not

  • msg (str) – The message that appears right above the button in the Calculation section

Return type

QWidget

Returns

widget containing the clustering gui

Usage: QTabWidget.addTab(fp_sim.getTab(doSimilarity))

sortEntryCheck()

Check if entries should be sorted or not (based on the toggle state of the Sort selected entries checkbox on the Similarity Tab.

Return type

bool

Returns

True if the Sort checkbox is checked, False if it is not or it doesn’t exist

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

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)