Commits

Aleš Erjavec committed 8b1e95b Merge

Merged biolab/orange-bioinformatics into default

Comments (0)

Files changed (3)

orangecontrib/bio/widgets/OWHeatMap.py

         
     def handleNewSignals(self):
         self.send('Examples', None)
-        self.error(0)
         if self.data:
-            if self.data.domain.has_discrete_attributes(): 
-                self.error(0, "Data contains discrete attributes")
-            elif len(self.data.domain.features) == 1:
-                self.error(0, "Cannot construct heatmap with only a single feature")
-            else:
-                self.update_heatmaps()
+            self.update_heatmaps()
         else:
             self.clear()
 
         data = None
         if self.sorted_data:
             if self.selected_rows:
-                examples = [self.sorted_data[i] for i in self.selected_rows]
+                #bug if merge is used does not return enough genes
+                #examples = [self.sorted_data[i] for i in self.selected_rows]
+
+                #uses Merge parameter, but does not work correctly for data with multiple classes
+                examples = [self.sorted_data[i*self.Merge+j] for i in self.selected_rows for j in range(self.Merge) if i*self.Merge+j < len(self.sorted_data)]
+
                 data = orange.ExampleTable(examples)
             else:
                 data = None

orangecontrib/bio/widgets/OWSetEnrichment.py

     settingsList = ["speciesIndex", "genesinrows", "geneattr", "categoriesCheckState"]
     contextHandlers = {"":DomainContextHandler("", ["speciesIndex", "genesinrows", "geneattr", "categoriesCheckState"])}
 
+    def refreshHierarchy(self):
+        self.setHierarchy(*self.getHierarchy(taxid=self.taxid_list[self.speciesIndex]))
+
     def __init__(self, parent=None, signalManager=None, name="Gene Set Enrichment Analysis", **kwargs):
         OWWidget.__init__(self, parent, signalManager, name, **kwargs)
         self.inputs = [("Data", ExampleTable, self.setData, Default), ("Reference", ExampleTable, self.setReference)]
 
         self.speciesComboBox = OWGUI.comboBox(self.controlArea, self,
                       "speciesIndex", "Species",
-                      callback=lambda: self.data and self.updateAnnotations(),
+                      callback=lambda: (self.refreshHierarchy(), self.data and self.updateAnnotations()),
                       debuggingEnabled=0)
 
         box = OWGUI.widgetBox(self.controlArea, "Gene names")
             self.genesinrows = data_hints.get_hint(data, "genesinrows", self.genesinrows)
 
             self.openContext("", data)
-
-#            print self.speciesIndex
-
-            self.setHierarchy(*self.getHierarchy(taxid=self.taxid_list[self.speciesIndex]))
+        
+            self.refreshHierarchy()
 
             self.loadedGenematcher = "None"
             self.updateAnnotations()
                 self.groupsWidgetItems[full_cat] = item
                 fill(value, item, full_cat, org=org)
 
+        self.groupsWidget.clear()
         fill(hierarchy[1], self.groupsWidget, org=hierarchy[0])
         fill(hierarchy_noorg[1], self.groupsWidget, org=hierarchy_noorg[0])
 
         #FIXME this should also recompute FDR
         self.categoriesCheckState = self.getHierarchyCheckState()
         categories = self.selectedCategories()
+        
         if not set(categories) <= set(self.currentAnnotatedCategories):
             self.updateAnnotations()
         else:
             self.filterAnnotationsChartView()
+        
 
     def updateGeneMatcherSettings(self):
         from .OWGOEnrichmentAnalysis import GeneMatcherDialog
                 item.setData(2, Qt.ToolTipRole, QVariant(len(cmapped))) # For filtering
                 item.setData(3, Qt.DisplayRole, QVariant(refFmt % (len(rmapped), 100.0*len(rmapped)/len(referenceGenes))))
                 item.setData(4, Qt.DisplayRole, QVariant("%0.6f" % p_val)) if p_val > 0.001 else item.setData(4, Qt.DisplayRole, QVariant("%0.2e" % p_val))
-                item.setData(4, 42, QVariant(p_val))
-                #stoplec 4 - zelim sort po p_val
+                item.setData(4, 42, QVariant(p_val)) #sorting
                 item.setData(4, Qt.ToolTipRole, QVariant("%0.10f" % p_val))
                 item.setData(5, Qt.DisplayRole, QVariant(enrichment))
                 item.setData(5, Qt.ToolTipRole, QVariant("%.3f" % enrichment))
         if self.updatingAnnotationsFlag:
             return
         categories = set(" ".join(cat) for cat, taxid in self.selectedCategories())
+
+        #compute FDR after selection categories
+    
         filterString = str(self.filterLineEdit.text()).lower()
         itemsHidden = []
         for item in self.treeItems:
 
     app = QApplication(sys.argv)
     w = OWSetEnrichment()
-    w.updateHierarchy()
     data = orange.ExampleTable("yeast-class-RPR.tab")
+    #data = orange.ExampleTable("/home/marko/Downloads/tmp.tab")
 #    data = orange.ExampleTable("../human")
 #    print cProfile.runctx("w.setData(data)", globals(), locals())
     w.setData(data)
 NAME = 'Orange-Bioinformatics'
 DOCUMENTATION_NAME = 'Orange Bioinformatics'
 
-VERSION = '2.5a10'
+VERSION = '2.5a13'
 
 DESCRIPTION = 'Orange Bioinformatics add-on for Orange data mining software package.'
 LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()