orange-bioinformatics / _bioinformatics / obiGeneAtlas.py

Diff from to

_bioinformatics/obiGeneAtlas.py

 AtlasExperiment = ExperimentExpression
 ##
 
+CACHE_VERSION = 1
+
+
 def _cache(name="AtlasGeneResult.shelve"):
     """ Return a open cache instance (a shelve object).
     """
             os.makedirs(orngServerFiles.localpath("GeneAtlas"))
         except OSError:
             pass
-    return shelve.open(orngServerFiles.localpath("GeneAtlas", name))
+    cache = shelve.open(orngServerFiles.localpath("GeneAtlas", name))
+    if cache.get(name + "__CACHE_VERSION__", None) == CACHE_VERSION:
+        return cache
+    else:
+        cache = shelve.open(orngServerFiles.localpath("GeneAtlas", name), "n")
+        cache[name + "__CACHE_VERSION__"] = CACHE_VERSION
+        return cache
+
 
 SLEEP_TIME_MULTIPLIER = 3.0
 
             experiments = expression["experiments"]
             result_experiment = []
             for exp in experiments:
-                exp_accession = exp["accession"]
-                updown = exp["expression"]
+                if "accession" in exp:
+                    exp_accession = exp["accession"]
+                elif "experimentAccession" in exp:
+                    exp_accession = exp["experimentAccession"]
+                else:
+                    raise KeyError()
+                if "expression" in exp:
+                    updown = exp["expression"]
+                elif "updn" in exp:
+                    updown = exp["updn"]
+                else:
+                    raise KeyError
                 pval = exp["pvalue"]
                 result_experiment.append(ExperimentExpression(exp_accession, updown, pval))
             result_expressions.append(ExpressionResults(ef, efv, up, down, result_experiment))
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.