From 8ae986b527ce8df34ffbe875116e453d3803e958 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 21 Jun 2016 16:45:27 +0000 Subject: No longer runs query to get symbol_values_dict when no id_list to fix occasional error with correlation page --- wqflask/base/mrna_assay_tissue_data.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py index 039f5d1f..fe117a56 100755 --- a/wqflask/base/mrna_assay_tissue_data.py +++ b/wqflask/base/mrna_assay_tissue_data.py @@ -93,19 +93,20 @@ class MrnaAssayTissueData(object): symbol_values_dict = {} - query = """SELECT TissueProbeSetXRef.Symbol, TissueProbeSetData.value - FROM TissueProbeSetXRef, TissueProbeSetData - WHERE TissueProbeSetData.Id IN {} and - TissueProbeSetXRef.DataId = TissueProbeSetData.Id""".format(db_tools.create_in_clause(id_list)) - - print("TISSUE QUERY:", query) - - results = g.db.execute(query).fetchall() - for result in results: - if result.Symbol.lower() not in symbol_values_dict: - symbol_values_dict[result.Symbol.lower()] = [result.value] - else: - symbol_values_dict[result.Symbol.lower()].append(result.value) + if len(id_list) > 0: + query = """SELECT TissueProbeSetXRef.Symbol, TissueProbeSetData.value + FROM TissueProbeSetXRef, TissueProbeSetData + WHERE TissueProbeSetData.Id IN {} and + TissueProbeSetXRef.DataId = TissueProbeSetData.Id""".format(db_tools.create_in_clause(id_list)) + + print("TISSUE QUERY:", query) + + results = g.db.execute(query).fetchall() + for result in results: + if result.Symbol.lower() not in symbol_values_dict: + symbol_values_dict[result.Symbol.lower()] = [result.value] + else: + symbol_values_dict[result.Symbol.lower()].append(result.value) #for symbol in self.data: # data_id = self.data[symbol].data_id -- cgit v1.2.3