Anonymous avatar Anonymous committed e54c812

minor bug fixes
progressbar is smoother

Comments (0)

Files changed (1)

 ## used: for cluster and reference frequencies of GO terms
 ##
 def populateGO(geneList, Lann, Lgo, LonlyGOIDs=None, progressBar = None, progressStart = 0.0, progressPart = 100.0):
-    if LonlyGOIDs and len(LonlyGOIDs) == 0:
+    if (LonlyGOIDs <> None and len(LonlyGOIDs) == 0) or (geneList <> None and len(geneList) == 0):
         return {}, {}, {}
 
     genesGOIDdirect = {}
         ## go over only the GOIDs in list
         for daGOID in LonlyGOIDs:
             if progressBar:
+                pcn += 1.0
                 progressBar(progressStart + progressPart * pcn / len(LonlyGOIDs))
-                pcn += 1.0
             geneAnn = Lann['GOID2gene'].get(daGOID, None)
             if not(geneAnn): continue
 
+            ppcn = 0.0
             for (daGene, daNOT, daEvidence, daAspect, daDB_Object_Type) in geneAnn:
+                if progressBar:
+                    ppcn += 1
+                    progressBar(progressStart + (pcn + ppcn / len(geneAnn)) * (progressPart/len(LonlyGOIDs)))
                 if daAspect <> Lgo['aspect']: continue ## skip annotations different from the loaded GO aspect
                 if daGene not in geneList:
                     continue
                     tmpl = genesGOIDboth.get(GOID, [])
                     if (daGene, daEvidence) not in tmpl:
                         genesGOIDboth[GOID] = tmpl + [(daGene, daEvidence)]
-
     else:
         ## go over all genes and find the apropriate GOIDs
         for gene in geneList: ## go over genes
             if progressBar:
+                pcn += 1.0
                 progressBar(progressStart + progressPart * pcn / len(geneList))
-                pcn += 1.0
 
             geneAnn = Lann['gene2GOID'].get(gene, None)
             if not(geneAnn): continue
 
+            ppcn = 0.0
             for (daGOID, daNOT, daEvidence, daAspect, daDB_Object_Type) in geneAnn:
+                if progressBar:
+                    ppcn += 1
+                    progressBar(progressStart + (pcn + (ppcn / len(geneAnn))) * (progressPart / len(geneList)))
                 if daAspect <> Lgo['aspect']: continue ## skip annotations different from the loaded GO aspect
     ##            if daNOT <> '': continue ## should we skip those annotations that tell when a gene is not part of a specific GO term?
 
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.