def clusteringInfo(fData, id): """ Creates a single string representing in a human-readable manner, the options used to perform a particular clustering. @type fData: FacsData @param fData: A FacsData instance containing the specified clustering @type id: int @param id: The id of a clustering within the FacsData instance. @rtype: str @return: An easily understandable string representation of clustering options. """ from cluster.dialogs import getClusterDialog dlg = getClusterDialog(fData.methodIDs[id], None) strOpts, strValues = dlg.getStrMethodArgs() dlg.Destroy() opts = fData.clusteringOpts[id] info = StringIO.StringIO() # create info string for opt in opts: info.write(strOpts[opt]) info.write(': ') if (opt in strValues): info.write(strValues[opt][opts[opt]]) else: info.write(opts[opt]) info.write('\n') return info.getvalue()
def OnCluster(self, event): """ Handles all clustering requests. Clustering requests are handled in the following method: 1. Passes the requested clustering method to L{cluster.dialogs.ClusterOptionsDialog.showDialog} method 2. Passes the data and the returned method options to L{cluster.methods.cluster} 3. Passes the returned cluster membership list to the FacsPlotPanel for display """ dlg = cDlgs.getClusterDialog(event.GetId(), self) if dlg.ShowModal() == wx.ID_OK: if (DataStore.getCurrentDataSet() is not None): self.statusbar.SetStatusText('Running %s clustering...' % cMthds.methods[event.GetId()][1], 0) fcs = DataStore.getCurrentDataSet() data = fcs.data # Remove columns from analysis as specified by the user if len(fcs.selDims) > 0: data = dh.filterData(data, fcs.selDims) clusterIDs, msg = cMthds.cluster(event.GetId(), data, **dlg.getMethodArgs()) DataStore.addClustering(event.GetId(), clusterIDs, dlg.getMethodArgs()) clusteringIndex = DataStore.getCurrentDataSet().clustering.keys()[-1] self.statusbar.SetStatusText(msg, 0) if (dlg.isApplyChecked()): if self.facsPlotPanel.SelectedSubplotIndex is not None: self.facsPlotPanel.CurrentSubplot = dv.Subplot(self.facsPlotPanel.SelectedSubplotIndex, DataStore.getCurrentIndex(), clusteringIndex) self.facsPlotPanel.draw() else: self.facsPlotPanel.addSubplot(DataStore.getCurrentIndex(), clusteringIndex) self.treeCtrlPanel.updateTree() dlg.Destroy()