aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/mrna_assay_tissue_data.py
diff options
context:
space:
mode:
authorzsloan2018-08-14 20:16:32 +0000
committerzsloan2018-08-14 20:16:32 +0000
commit838362c116b02c090dadeb76cda27e9902a6626a (patch)
treea6be104cc73e3bc9e271f9b5ca854dd32f3b810d /wqflask/base/mrna_assay_tissue_data.py
parent0bead53661ea701ffd9f9d565e4d2ecbbed81a8e (diff)
parent85defabb17ecdef1c7b8e92fa2e06b44d1e9ca49 (diff)
downloadgenenetwork2-838362c116b02c090dadeb76cda27e9902a6626a.tar.gz
Merge branch 'testing' of https://github.com/genenetwork/genenetwork2 into production
Diffstat (limited to 'wqflask/base/mrna_assay_tissue_data.py')
-rw-r--r--wqflask/base/mrna_assay_tissue_data.py66
1 files changed, 1 insertions, 65 deletions
diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py
index eb836e6c..6fec5dcd 100644
--- a/wqflask/base/mrna_assay_tissue_data.py
+++ b/wqflask/base/mrna_assay_tissue_data.py
@@ -18,21 +18,11 @@ class MrnaAssayTissueData(object):
def __init__(self, gene_symbols=None):
self.gene_symbols = gene_symbols
- self.have_data = False
if self.gene_symbols == None:
self.gene_symbols = []
- #print("self.gene_symbols:", self.gene_symbols)
-
self.data = collections.defaultdict(Bunch)
- #self.gene_id_dict ={}
- #self.data_id_dict = {}
- #self.chr_dict = {}
- #self.mb_dict = {}
- #self.desc_dict = {}
- #self.probe_target_desc_dict = {}
-
query = '''select t.Symbol, t.GeneId, t.DataId, t.Chr, t.Mb, t.description, t.Probe_Target_Description
from (
select Symbol, max(Mean) as maxmean
@@ -52,7 +42,6 @@ class MrnaAssayTissueData(object):
in_clause = db_tools.create_in_clause(gene_symbols)
#ZS: This was in the query, not sure why: http://docs.python.org/2/library/string.html?highlight=lower#string.lower
-
query += ''' Symbol in {} group by Symbol)
as x inner join TissueProbeSetXRef as t on t.Symbol = x.Symbol
and t.Mean = x.maxmean;
@@ -67,9 +56,7 @@ class MrnaAssayTissueData(object):
for result in results:
symbol = result[0]
- #if symbol.lower() in [gene_symbol.lower() for gene_symbol in gene_symbols]:
if symbol.lower() in lower_symbols:
- #gene_symbols.append(symbol)
symbol = symbol.lower()
self.data[symbol].gene_id = result.GeneId
@@ -79,8 +66,6 @@ class MrnaAssayTissueData(object):
self.data[symbol].description = result.description
self.data[symbol].probe_target_description = result.Probe_Target_Description
- print("self.data: ", pf(self.data))
-
###########################################################################
#Input: cursor, symbolList (list), dataIdDict(Dict)
#output: symbolValuepairDict (dictionary):one dictionary of Symbol and Value Pair,
@@ -107,53 +92,4 @@ class MrnaAssayTissueData(object):
else:
symbol_values_dict[result.Symbol.lower()].append(result.value)
- #for symbol in self.data:
- # data_id = self.data[symbol].data_id
- # symbol_values_dict[symbol] = self.get_tissue_values(data_id)
-
-
- return symbol_values_dict
-
-
- #def get_tissue_values(self, data_id):
- # """Gets the tissue values for a particular gene"""
- #
- # tissue_values=[]
- #
- # query = """SELECT value, id
- # FROM TissueProbeSetData
- # WHERE Id IN {}""".format(db_tools.create_in_clause(data_id))
- #
- # #try :
- # results = g.db.execute(query).fetchall()
- # for result in results:
- # tissue_values.append(result.value)
- # #symbol_values_dict[symbol] = value_list
- # #except:
- # # symbol_values_pairs[symbol] = None
- #
- # return tissue_values
-
-########################################################################################################
-#input: cursor, symbolList (list), dataIdDict(Dict): key is symbol
-#output: SymbolValuePairDict(dictionary):one dictionary of Symbol and Value Pair.
-# key is symbol, value is one list of expression values of one probeSet.
-#function: wrapper function for getSymbolValuePairDict function
-# build gene symbol list if necessary, cut it into small lists if necessary,
-# then call getSymbolValuePairDict function and merge the results.
-########################################################################################################
-
-#def get_trait_symbol_and_tissue_values(symbol_list=None):
-# tissue_data = MrnaAssayTissueData(gene_symbols=symbol_list)
-#
-# #symbolList,
-# #geneIdDict,
-# #dataIdDict,
-# #ChrDict,
-# #MbDict,
-# #descDict,
-# #pTargetDescDict = getTissueProbeSetXRefInfo(
-# # GeneNameLst=GeneNameLst,TissueProbeSetFreezeId=TissueProbeSetFreezeId)
-#
-# if len(tissue_data.gene_symbols):
-# return get_symbol_values_pairs(tissue_data)
+ return symbol_values_dict \ No newline at end of file