1. biolab
  2. Untitled project
  3. orange-bioinformatics


Flashpoint  committed c7d693f

Added a genesets statistics function to obiGeneSets.py. Added additional columns in OWCustomSets.py

  • Participants
  • Parent commits c4f8bb0
  • Branches default

Comments (0)

Files changed (2)

File _bioinformatics/obiGeneSets.py

View file
     return GeneSets(handleNELines(contents, hline))
+def getGenesetsStats(genesets):
+    num_sets = len(genesets)
+    unique_genes = len(set([gene for geneset in genesets for gene in geneset.genes]))
+    genes_per_geneset = sum([len(geneset.genes) for geneset in genesets])/num_sets
+    return num_sets, unique_genes, genes_per_geneset
 We have multiple paths for gene set data:

File _bioinformatics/widgets/prototypes/OWCustomSets.py

View file
 from StringIO import StringIO
 import Orange
+import cPickle as pickle
 from OWWidget import *
 import OWGUI
-from Orange.bio.obiGeneSets import loadGMT, list_local, register, local_path, remove_local, modification_date
+from Orange.bio.obiGeneSets import loadGMT, list_local, register, local_path, remove_local, modification_date, getGenesetsStats
 class standard_icons(object):
     def __init__(self, qwidget=None, style=None):
         self.listView = QTreeWidget(ma)
-        self.listView.setColumnCount(2)
-        self.listView.setHeaderLabels(["Genesets name", "Import time"])
+        self.listView.setColumnCount(5)
+        self.listView.setHeaderLabels(["Name", "Gene Sets", "Unique Genes", "Average no. of Genes/Geneset", "Import time"])
             name = geneset[geneset.index("_._")+3:geneset.index(".gmt")+4]
             the_file = os.path.join(local_path(), geneset)
             mod_time = str(modification_date(the_file))
+            sets = pickle.load(open(the_file, "rb"))
+            stats = getGenesetsStats(sets)
             item.setText(0, name)
-            item.setText(1, mod_time[:mod_time.rfind(".")])
+            item.setText(1, str(stats[0]))
+            item.setText(2, str(stats[1]))
+            item.setText(3, str(stats[2]))
+            item.setText(4, mod_time[:mod_time.rfind(".")])
         print list_local()