Aleš Erjavec avatar Aleš Erjavec committed 7f7a315

Store the selected organism as a string (taxid).

Comments (0)

Files changed (1)

orangecontrib/bio/widgets/OWGeneInfo.py

 
 
 class OWGeneInfo(OWWidget):
-    settingsList = ["organismIndex", "geneAttr", "useAttr", "autoCommit"]
+    settingsList = ["organismIndex", "geneAttr", "useAttr", "autoCommit",
+                    "taxid"]
     contextHandlers = {
         "": DomainContextHandler(
-            "", ["organismIndex", "geneAttr", "useAttr", "useAltSource"]
+            "", ["organismIndex", "geneAttr", "useAttr", "useAltSource",
+                 "taxid"]
         )
     }
 
         self.outputs = [("Selected Examples", ExampleTable)]
 
         self.organismIndex = 0
+        self.taxid = None
         self.geneAttr = 0
         self.useAttr = False
         self.autoCommit = False
 
         self.organismComboBox = OWGUI.comboBox(
             self.organismBox, self, "organismIndex",
-            callback=self.updateInfoItems,
+            callback=self._onSelectedOrganismChanged,
             debuggingEnabled=0)
 
         # For now only support one alt source, with a checkbox
         self.organismComboBox.addItems(
             [obiTaxonomy.name(tax_id) for tax_id in self.organisms]
         )
+        if self.taxid in self.organisms:
+            self.organismIndex = self.organisms.index(self.taxid)
 
         self.infoLabel.setText("No data on input\n")
         self.__initialized = True
         sys.excepthook(type(exc), exc.args, None)
         self.error(0, "Could not download the necessary files.")
 
+    def _onSelectedOrganismChanged(self):
+        self.taxid = self.organisms[self.organismIndex]
+        if self.data is not None:
+            self.updateInfoItems()
+
     def setData(self, data=None):
         if not self.__initialized:
             self.initfuture.result()
             taxid = data_hints.get_hint(self.data, "taxid", "")
             if taxid in self.organisms:
                 self.organismIndex = self.organisms.index(taxid)
+                self.taxid = taxid
 
             self.useAttr = data_hints.get_hint(self.data, "genesinrows",  self.useAttr)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.