diff options
author | Lei Yan | 2013-10-09 17:50:48 -0500 |
---|---|---|
committer | Lei Yan | 2013-10-09 17:50:48 -0500 |
commit | 5daef1bd5e6e494b477797993bb72488b24dd8b3 (patch) | |
tree | 69d999141b3904020b30acabc31dbf4c97edf5e2 /wqflask/base/data_set.py | |
parent | 9173f1e03f51cb141b0efa35b5e81c632b9a2689 (diff) | |
download | genenetwork2-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-x | wqflask/base/data_set.py | 63 |
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): |