aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorLei Yan2013-10-09 17:50:48 -0500
committerLei Yan2013-10-09 17:50:48 -0500
commit5daef1bd5e6e494b477797993bb72488b24dd8b3 (patch)
tree69d999141b3904020b30acabc31dbf4c97edf5e2 /wqflask/base/data_set.py
parent9173f1e03f51cb141b0efa35b5e81c632b9a2689 (diff)
downloadgenenetwork2-5daef1bd5e6e494b477797993bb72488b24dd8b3.tar.gz
Improved some of the code related to the correlation page
For example, changed the two functions getting gene symbols and ids for a dataset into one function that can take a column name as a parameter
Diffstat (limited to 'wqflask/base/data_set.py')
-rwxr-xr-xwqflask/base/data_set.py63
1 files changed, 43 insertions, 20 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 16f9da5d..20c9a24f 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -1075,32 +1075,55 @@ class MrnaAssayDataSet(DataSet):
""" % (escape(trait), escape(self.name))
results = g.db.execute(query).fetchall()
return results
-
- def retrieve_gene_symbols(self):
- query = """
- select ProbeSet.Name, ProbeSet.Symbol, ProbeSet.GeneId
- from ProbeSet,ProbeSetXRef
- where ProbeSetXRef.ProbeSetFreezeId = %s and
- ProbeSetXRef.ProbeSetId=ProbeSet.Id;
- """ % (self.id)
- results = g.db.execute(query).fetchall()
- symbol_dict = {}
- for item in results:
- symbol_dict[item[0]] = item[1]
- return symbol_dict
- def retrieve_gene_ids(self):
+
+ def retrieve_genes(self, column_name):
query = """
- select ProbeSet.Name, ProbeSet.GeneId
+ select ProbeSet.Name, ProbeSet.%s
from ProbeSet,ProbeSetXRef
where ProbeSetXRef.ProbeSetFreezeId = %s and
ProbeSetXRef.ProbeSetId=ProbeSet.Id;
- """ % (self.id)
+ """ % (column_name, escape(str(self.id)))
results = g.db.execute(query).fetchall()
- symbol_dict = {}
- for item in results:
- symbol_dict[item[0]] = item[1]
- return symbol_dict
+ print("in retrieve_genes results {}: {}".format(type(results), results))
+
+ return dict(results)
+
+ #return {item[0]: item[1] for item in results}
+
+ #symbol_dict = {}
+ #for item in results:
+ # symbol_dict[item[0]] = item[1]
+ #return symbol_dict
+
+ #def retrieve_gene_symbols(self):
+ # query = """
+ # select ProbeSet.Name, ProbeSet.Symbol, ProbeSet.GeneId
+ # from ProbeSet,ProbeSetXRef
+ # where ProbeSetXRef.ProbeSetFreezeId = %s and
+ # ProbeSetXRef.ProbeSetId=ProbeSet.Id;
+ # """ % (self.id)
+ # results = g.db.execute(query).fetchall()
+ # symbol_dict = {}
+ # for item in results:
+ # symbol_dict[item[0]] = item[1]
+ # return symbol_dict
+ #
+ #def retrieve_gene_ids(self):
+ # query = """
+ # select ProbeSet.Name, ProbeSet.GeneId
+ # from ProbeSet,ProbeSetXRef
+ # where ProbeSetXRef.ProbeSetFreezeId = %s and
+ # ProbeSetXRef.ProbeSetId=ProbeSet.Id;
+ # """ % (self.id)
+ # return process_and_run_query(query)
+ # results = g.db.execute(query).fetchall()
+ # symbol_dict = {}
+ # for item in results:
+ # symbol_dict[item[0]] = item[1]
+ # return symbol_dict
+
+
class TempDataSet(DataSet):