aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/database.org2
-rw-r--r--wqflask/base/mrna_assay_tissue_data.py26
-rw-r--r--wqflask/base/trait.py8
-rw-r--r--wqflask/wqflask/collect.py15
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py12
-rw-r--r--wqflask/wqflask/search_results.py2
6 files changed, 29 insertions, 36 deletions
diff --git a/doc/database.org b/doc/database.org
index 753179e6..c20e4564 100644
--- a/doc/database.org
+++ b/doc/database.org
@@ -727,7 +727,7 @@ User selection - retained
* Fetching Data
-** Menu
+** Search
What happens at the main search menu can be emulated with curl.
diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py
index 5511af06..e99ef7b5 100644
--- a/wqflask/base/mrna_assay_tissue_data.py
+++ b/wqflask/base/mrna_assay_tissue_data.py
@@ -92,24 +92,22 @@ class MrnaAssayTissueData(object):
def get_symbol_values_pairs(self):
id_list = [self.data[symbol].data_id for symbol in self.data]
- print("id_list:", id_list)
-
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))
+ 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)
- logger.sql(query)
+ logger.sql('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)
+ 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
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index afde3dbe..9566c192 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -82,13 +82,7 @@ class GeneralTrait(object):
dataset=self.dataset.name,
description=self.description_display,
mean=self.mean)
-
-
- def get_info(self):
- """For lots of traits just use get_trait_info in dataset instead...that will be way
- more efficient"""
- self.dataset.get_trait_info([self],
- webqtlDatabaseFunction.retrieve_species(self.dataset.group.name))
+
def get_name(self):
stringy = ""
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py
index 958a1e43..4ea8407c 100644
--- a/wqflask/wqflask/collect.py
+++ b/wqflask/wqflask/collect.py
@@ -297,13 +297,13 @@ def view_collection():
params = request.args
print("PARAMS in view collection:", params)
- if "uc_id" in params:
- uc_id = params['uc_id']
- uc = model.UserCollection.query.get(uc_id)
- traits = json.loads(uc.members)
- print("traits are:", traits)
- else:
- traits = AnonCollection().get_traits()
+ #if "uc_id" in params:
+ uc_id = params['uc_id']
+ uc = model.UserCollection.query.get(uc_id)
+ traits = json.loads(uc.members)
+ print("traits are:", traits)
+ #else:
+ # traits = AnonCollection().get_traits()
print("in view_collection traits are:", traits)
@@ -316,7 +316,6 @@ def view_collection():
trait_ob = trait.GeneralTrait(name=name, dataset_name=dataset_name)
trait_ob.retrieve_info(get_qtl_info=True)
- trait_ob.get_info()
trait_obs.append(trait_ob)
json_version.append(trait_ob.jsonable())
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 71f03d05..401059fd 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -167,9 +167,13 @@ class CorrelationResults(object):
self.trait_symbol_dict = self.dataset.retrieve_genes("Symbol")
tissue_corr_data = self.do_tissue_correlation_for_all_traits()
- for trait in tissue_corr_data.keys()[:self.return_number]:
- self.get_sample_r_and_p_values(trait, self.target_dataset.trait_data[trait])
-
+ if tissue_corr_data != None:
+ for trait in tissue_corr_data.keys()[:self.return_number]:
+ self.get_sample_r_and_p_values(trait, self.target_dataset.trait_data[trait])
+ else:
+ for trait, values in self.target_dataset.trait_data.iteritems():
+ self.get_sample_r_and_p_values(trait, values)
+
elif self.corr_type == "lit":
self.trait_geneid_dict = self.dataset.retrieve_genes("GeneId")
lit_corr_data = self.do_lit_correlation_for_all_traits()
@@ -244,7 +248,7 @@ class CorrelationResults(object):
trait_object.tissue_corr = 0
trait_object.tissue_pvalue = 0
trait_object.lit_corr = 0
- if self.corr_type == "tissue":
+ if self.corr_type == "tissue" and tissue_corr_data != None:
trait_object.tissue_corr = tissue_corr_data[trait][1]
trait_object.tissue_pvalue = tissue_corr_data[trait][2]
elif self.corr_type == "lit":
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 123aec33..a924c7c9 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -102,8 +102,6 @@ views.py).
this_trait = GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
self.trait_list.append(this_trait)
- self.dataset.get_trait_info(self.trait_list, species)
-
#def get_group_species_tree(self):
# self.species_groups = collections.default_dict(list)
# for key in self.results: