From 74e81163fb3c2418b88f6d4fbb99760c63a3fea6 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 14 Nov 2019 12:03:09 -0600 Subject: Changed code to rebuild dataset list each time you view the trait page to avoid having to restart each time a new dataset is added. Will need to keep an eye out for any issues, but doesn't seem to affect speed much Fixed logic for UniProt link to use UniProtId instead of protein ID --- wqflask/base/data_set.py | 8 ++++++-- wqflask/wqflask/show_trait/show_trait.py | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index d9b7f668..f58367ca 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -119,8 +119,12 @@ Publish or ProbeSet. E.g. def __call__(self, name): return self.datasets[name] +def rebuild_dataset_ob(): + Dataset_Getter = Dataset_Types() + return Dataset_Getter + # Do the intensive work at startup one time only -Dataset_Getter = Dataset_Types() +Dataset_Getter = rebuild_dataset_ob() def create_datasets_list(): if USE_REDIS: @@ -922,7 +926,7 @@ class MrnaAssayDataSet(DataSet): 'blatseq', 'targetseq', 'chipid', 'comments', 'strand_probe', 'strand_gene', - 'proteinid', + 'proteinid', 'uniprotid', 'probe_set_target_region', 'probe_set_specificity', 'probe_set_blat_score', diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index e7423293..64597711 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -45,6 +45,7 @@ class ShowTrait(object): if 'trait_id' in kw and kw['dataset'] != "Temp": self.temp_trait = False self.trait_id = kw['trait_id'] + data_set.rebuild_dataset_ob() helper_functions.get_species_dataset_trait(self, kw) elif 'group' in kw: self.temp_trait = True @@ -268,8 +269,8 @@ class ShowTrait(object): self.genbank_link = webqtlConfig.GENBANK_ID % genbank_id self.uniprot_link = None - if check_if_attr_exists(self.this_trait, 'proteinid'): - self.uniprot_link = webqtlConfig.UNIPROT_URL % self.this_trait.proteinid + if check_if_attr_exists(self.this_trait, 'uniprotid'): + self.uniprot_link = webqtlConfig.UNIPROT_URL % self.this_trait.uniprotid self.genotation_link = self.gtex_link = self.genebridge_link = self.ucsc_blat_link = self.biogps_link = self.protein_atlas_link = None self.string_link = self.panther_link = self.aba_link = self.ebi_gwas_link = self.wiki_pi_link = self.genemania_link = self.ensembl_link = None -- cgit v1.2.3