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¶
- MOVE = 1¶
- REPRESENTATIVE = 2¶
- ENTRY = 3¶
- __init__(logger)¶
Initialize the instance of the cluster class
- 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))
- 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
- 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
- setNumClusters(num)¶
Set the number of clusters in the Apply Clustering Section
- getApplyGUI()¶
Return the controls used to apply the clustering to selected entries in the project table
- doApplyClustering()¶
Once the clustering has been performed for the selected entries this method will apply it
- updateResults()¶
Once clustering has been performed this method should be called to update the clustering results GUI:
- close()¶
Perform the tasks necessary when closing the panel. This will include closing all the open plot windows
- showStatisticsPlot()¶
Display a plot of clustering statistics
- showDendrogramPlot()¶
Display the clustering dendgoram
- showDistanceMatrixPlot()¶
Display the distance matrix
- 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
- getClusteringStatistics(id)¶
- 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
- num_clusters_selected¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- PLOT_TYPES = ['Kelley Penalty', 'R-Squared', 'Semipartial R-Squared', 'Merge Distance', 'Separation Ratio']¶
- __init__(canvas_cluster)¶
Create an instance of the dialog. Objects passed are the parent and the CanvasFingerprintCluster object which will have the statistics
- Parameters
canvas_cluster (CanvasFingerprintCluster object) – object that contains the clustering statistics
- 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
- close()¶
Dismiss the window
- click(event)¶
Click in plot handler
- 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
- num_clusters_selected¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(canvas_cluster=None)¶
Create an instance of the dialog. Either canvas_cluster should be specified (CanvasFingerprintCluster object with data)
- Parameters
canvas_cluster (CanvasFingerprintCluster object) – object that contains the clustering statistics
- show()¶
Show the plot dialog
- close()¶
Dismiss the window
- redraw()¶
Redraw the plot
- click(event)¶
Click in plot handler
- 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']¶
- __init__(canvas_cluster, num_clusters_edit=None, distance_matrix_callback=None, structures=True, num_clusters=None)¶
Create an instance of the dialog.
- Parameters
canvas_cluster (CanvasFingerprintCluster object) – object that contains the clustering statistics
num_clusters_edit (QLineEdit) – the widget that contains the number of clusters
distance_matrix_callback (function) – function called with the IDs of the structures which are clicked
structures (bool) – True if the distance matrix should show structures when the user clicks on the plot, False if not
- setPlotType(plot_type)¶
Called when the plot type combobox is changed
- Parameters
plot_type (string) – the new plot type
- setColormap(color_map)¶
Called when the color map combobox is changed
- Parameters
color_map (string) – the new color map
- redraw()¶
Force a redraw with refetching of the distance map data
- draw()¶
Called when the plot type option menu is changed
- show()¶
Show the plot dialog
- close()¶
Dismiss the window
- click(event)¶
Click in plot handler
- drawStructure(canv, eid, title_label)¶
Draw the structure from the project with entry id ‘eid’ in the Canvas ‘canv’