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

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.canvas.similaritygui', '__doc__': '\n A subclass of the canvas fingerprint similarity manager which is to be\n used from a program with a TKInter interface. This class has methods\n for creating a component which displays all the similarity metrics\n options and takes care of managing the internal state\n ', 'getGUI': <function CanvasFingerprintSimilarityGUI.getGUI>, 'setMetricCB': <function CanvasFingerprintSimilarityGUI.setMetricCB>, 'update': <function CanvasFingerprintSimilarityGUI.update>, 'getCalculationGUI': <function CanvasFingerprintSimilarityGUI.getCalculationGUI>, 'getTab': <function CanvasFingerprintSimilarityGUI.getTab>, 'sortEntryCheck': <function CanvasFingerprintSimilarityGUI.sortEntryCheck>})
__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__(logger)

Initialize the similarity class

__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.similaritygui'
__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)