From 7263c52a7d903a2dbdd5d05411821ec960961b4d Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Wed, 18 Nov 2015 23:29:31 +0000 Subject: Committer: Lei Yan On branch master --- wqflask/wqflask/gsearch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 3d693a4c..cb42980c 100755 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -37,7 +37,7 @@ class GSearch(object): AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id AND ProbeSetFreeze.public > 0 ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name - LIMIT 1000 + LIMIT 5000 """ % (self.terms) re = g.db.execute(sql).fetchall() self.trait_list = [] @@ -79,7 +79,7 @@ class GSearch(object): OR Publication.Authors REGEXP "[[:<:]]%s[[:>:]]" OR PublishXRef.Id REGEXP "[[:<:]]%s[[:>:]]") ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id` - LIMIT 1000 + LIMIT 5000 """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms) re = g.db.execute(sql).fetchall() self.trait_list = [] -- cgit v1.2.3 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(-) 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 From ff300e422ab9c3bd2288d08a3de4a9f4c3beb1ba Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 22 Jun 2016 17:32:01 +0000 Subject: Fixed a couple more errors with the correlation page that occurred when you selected Tissue correlation with traits from data sets without 'data_ids' --- wqflask/base/mrna_assay_tissue_data.py | 2 -- wqflask/wqflask/correlation/show_corr_results.py | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) mode change 100755 => 100644 wqflask/base/mrna_assay_tissue_data.py diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py old mode 100755 new mode 100644 index fe117a56..1f1be1e5 --- a/wqflask/base/mrna_assay_tissue_data.py +++ b/wqflask/base/mrna_assay_tissue_data.py @@ -89,8 +89,6 @@ 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 = {} if len(id_list) > 0: diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index f2bba985..b852a99c 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": -- cgit v1.2.3 From 9b25ba56288d8a3b405392854836608ac3741985 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 24 Jun 2016 16:14:33 +0000 Subject: Removed function 'get_info' in trait.py that was never used and reomved 'get_trait_info' call from search_result_page.py because its query was already being run --- wqflask/base/trait.py | 8 +------- wqflask/wqflask/collect.py | 15 +++++++-------- wqflask/wqflask/search_results.py | 3 --- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index b51b8c72..4bce25ac 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -79,13 +79,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/search_results.py b/wqflask/wqflask/search_results.py index 4c4e1ef2..a62f2d51 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -107,13 +107,10 @@ class SearchResultPage(object): #### Excel file needs to be generated #### - #print("foo locals are:", locals()) trait_id = result[0] 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: -- cgit v1.2.3