schrodinger.application.canvas.clustergui module

Canvas clustering functionality that uses GUI libraries

There are classes to perform custering and to support graphical interfaces to the clustering options.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.canvas.clustergui.CanvasFingerprintClusterGUI(logger)

Bases: schrodinger.application.canvas.cluster.CanvasFingerprintCluster

A subclass of the canvas fingerprint clusterer which is to be used from a program with a TKInter interface. This class has methods for creating a component which displays the clustering linkage options

CREATE_RADIOBUTTON_NAMES = ['Duplicate entries to a new group for each cluster', 'Move entries to a new group for each cluster', 'A group containing the structures nearest the centroid in each cluster', 'Cluster index and size properties for each entry']
DUPLICATE = 0
ENTRY = 3
MOVE = 1
REPRESENTATIVE = 2
close()

Perform the tasks necessary when closing the panel. This will include closing all the open plot windows

doApplyClustering()

Once the clustering has been performed for the selected entries this method will apply it

getApplyGUI()

Return the controls used to apply the clustering to selected entries in the project table

getClusterGUI(command, msg=None)

Returns a GUI Group Box which displays the Cluster Calculation button

Parameters:
  • msg (str) – The message that appears right above the Calculate Clustering button.
  • command (callable object) – function to be called when the Calculate Clustering button is pressed.
Return type:

swidgets.SGroupBox (QGroupBox)

Returns:

groupbox containing the cluster widgets

getClusteringStatistics(id)
getLinkageGUI()

Returns a GUI component which displays the cluster linkage options

Return type:swidgets.SGroupBox (QGroupBox)
Returns:groupbox containing the linkage widgets
getResultsGUI()

Returns a GUI which displays the clustering results in terms of the strain and best number of clusters and provides access to plots for the dendrogram and cluster statistics. This will be deactivated until the update() method is called at which time it will be activated and refreshed with the results from the most recent clustering

getTab(command=None, linkage=True, cluster=True, results=True, apply=True, msg=None)

Creates a tab that can be used in a QTabWidget for calculating clustering. The tab has the following sections: Linkage, Cluster, Clustering Results, Apply Clustering

Parameters:
  • command (callable object) – function to be called when the Calculate Clustering button is pressed.
  • linkage (bool) – True if this section should be included (default)
  • cluster (bool) – True if this section should be included (default)
  • results (bool) – True if this section should be included (default)
  • apply (bool) – True if this section should be included (default)
  • msg (str) – The message that appears right above the Calculate Clustering button.
Return type:

QWidget

Returns:

widget containing the clustering gui

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

setDistanceMatrixCallback(cb)

Set a callback to be called when the mouse is clicked in the distance matrix plot. This should expect to receive two entry IDs

setNumClusters(num)

Set the number of clusters in the Apply Clustering Section

showDendrogramPlot()

Display the clustering dendgoram

showDistanceMatrixPlot()

Display the distance matrix

showStatisticsPlot()

Display a plot of clustering statistics

updateResults()

Once clustering has been performed this method should be called to update the clustering results GUI:

class schrodinger.application.canvas.clustergui.ClusterStatisticsPlotDialog(canvas_cluster)

Bases: schrodinger.ui.qt.appframework.AppFramework

A class which displays a dialog with a plot of the statistics for the most recent clustering

PLOT_TYPES = ['Kelley Penalty', 'R-Squared', 'Semipartial R-Squared', 'Merge Distance', 'Separation Ratio']
click(event)

Click in plot handler

close()

Dismiss the window

num_clusters_selected
redraw()

Redraw the plot with the current settings

setPlotType(plot_type)

Called when the plot type option menu is changed

show()

Show the plot dialog

class schrodinger.application.canvas.clustergui.DendrogramPlotDialog(canvas_cluster=None)

Bases: schrodinger.ui.qt.appframework.AppFramework

A class which displays a dialog with a plot of the dendrogram from the most recent clustering

click(event)

Click in plot handler

close()

Dismiss the window

num_clusters_selected
redraw()

Redraw the plot

show()

Show the plot dialog

class schrodinger.application.canvas.clustergui.DistanceMatrixPlotDialog(canvas_cluster, num_clusters_edit=None, distance_matrix_callback=None, structures=True, num_clusters=None)

Bases: schrodinger.ui.qt.appframework.AppFramework

A class which displays a dialog with a plot of the distance matrix associated with the most recent clustering

PLOT_TYPES = ['Cluster Order', 'Original Order']
click(event)

Click in plot handler

close()

Dismiss the window

draw()

Called when the plot type option menu is changed

drawStructure(canv, eid, title_label)

Draw the structure from the project with entry id ‘eid’ in the Canvas ‘canv’

redraw()

Force a redraw with refetching of the distance map data

setColormap(color_map)

Called when the color map combobox is changed

Parameters:color_map (string) – the new color map
setPlotType(plot_type)

Called when the plot type combobox is changed

Parameters:plot_type (string) – the new plot type
show()

Show the plot dialog