From dc002daace320135b4d32ac08de2ee568e68ba51 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 20 May 2020 14:17:17 -0500 Subject: Fixed issue when some case attribute values don't exist + added phenogen link to trait page --- wqflask/wqflask/show_trait/show_trait.py | 9 ++++++--- wqflask/wqflask/templates/show_trait_details.html | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 072d7f8c..29b2f77e 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -294,7 +294,7 @@ class ShowTrait(object): if check_if_attr_exists(self.this_trait, 'uniprotid'): self.uniprot_link = webqtlConfig.UNIPROT_URL % self.this_trait.uniprotid - self.genotation_link = self.rgd_link = self.gtex_link = self.genebridge_link = self.ucsc_blat_link = self.biogps_link = self.protein_atlas_link = None + self.genotation_link = self.rgd_link = self.phenogen_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 if self.this_trait.symbol: self.genotation_link = webqtlConfig.GENOTATION_URL % self.this_trait.symbol @@ -332,6 +332,7 @@ class ShowTrait(object): if self.dataset.group.species == "rat": self.rgd_link = webqtlConfig.RGD_URL % (self.this_trait.symbol, self.dataset.group.species.capitalize()) + self.phenogen_link = webqtlConfig.PHENOGEN_URL % (self.this_trait.symbol) self.genemania_link = webqtlConfig.GENEMANIA_URL % ("rattus-norvegicus", self.this_trait.symbol) query = """SELECT kgID, chromosome, txStart, txEnd @@ -603,8 +604,10 @@ def get_categorical_variables(this_trait, sample_list): for attribute in sample_list.attributes: attribute_vals = [] for sample_name in this_trait.data.keys(): - attribute_vals.append(this_trait.data[sample_name].extra_attributes[sample_list.attributes[attribute].name]) - + if sample_list.attributes[attribute].name in this_trait.data[sample_name].extra_attributes: + attribute_vals.append(this_trait.data[sample_name].extra_attributes[sample_list.attributes[attribute].name]) + else: + attribute_vals.append("N/A") num_distinct = len(set(attribute_vals)) if num_distinct < 10: diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 62268a54..878b6ced 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -141,6 +141,12 @@ GTEx Portal    + {% if phenogen_link %} + + PhenoGen + +    + {% endif %} {% if genebridge_link %} GeneBridge -- cgit v1.2.3