From 2b590ad5c2571b8ad2f984308733c9f387e149a4 Mon Sep 17 00:00:00 2001 From: laurensvdwiel Date: Tue, 16 Apr 2019 09:59:15 +0200 Subject: [PATCH 01/19] applied fix for Jinja2 security issue, see: https://github.com/cmbi/metadome/network/alert/requirements.txt/Jinja2/open --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6f386d8..2e63543 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ Flask-WTF==0.14.2 Flask-JSGlue==0.3 gunicorn==19.8.1 itsdangerous==0.24 -Jinja2==2.10 +Jinja2==2.10.1 kombu==4.2.1 lockfile==0.12.2 MarkupSafe==1.0 From d7eb753fcacbb7d379164948815e22e3a7844434 Mon Sep 17 00:00:00 2001 From: laurensvdwiel Date: Tue, 16 Apr 2019 10:20:53 +0200 Subject: [PATCH 02/19] implemented fix for https://github.com/cmbi/metadome/issues/47 --- metadome/presentation/web/templates/js/dashboard.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metadome/presentation/web/templates/js/dashboard.js b/metadome/presentation/web/templates/js/dashboard.js index 855d41d..b6decdd 100644 --- a/metadome/presentation/web/templates/js/dashboard.js +++ b/metadome/presentation/web/templates/js/dashboard.js @@ -16,6 +16,16 @@ $("#geneName").keyup(function(event) { } }); +// when the user presses the ESC the overlays are disabled +document.addEventListener("keydown", keyPress, false); +function keyPress (e) { + if(e.key === "Escape") { + $("#domain_information_overlay").removeClass("is-active"); + $("#positional_information_overlay").removeClass("is-active"); + d3.selectAll(".tr").classed("is-selected", false); + } +} + function get_query_param(param) { var result = window.location.search.match( new RegExp("(\\?|&)" + param + "(\\[\\])?=([^&]*)")); From 32163571281734fc915e2d7f8a0e7270b13e9691 Mon Sep 17 00:00:00 2001 From: laurensvdwiel Date: Tue, 16 Apr 2019 12:41:07 +0200 Subject: [PATCH 03/19] applied fix for https://github.com/cmbi/metadome/issues/44 --- .../web/static/js/dashboard/visualization.js | 27 ++++++++++++++++++- .../web/templates/js/dashboard.js | 7 +++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/metadome/presentation/web/static/js/dashboard/visualization.js b/metadome/presentation/web/static/js/dashboard/visualization.js index 58ddc3b..edb4d65 100644 --- a/metadome/presentation/web/static/js/dashboard/visualization.js +++ b/metadome/presentation/web/static/js/dashboard/visualization.js @@ -160,7 +160,8 @@ var positionTip = d3.tip() var positionTip_str = ""; positionTip_str += "Position: p." + d.values[0].protein_pos + " " + d.values[0].cdna_pos + "
"; positionTip_str += "Codon: " + d.values[0].ref_codon + "
"; - positionTip_str += "Residue: " + d.values[0].ref_aa_triplet; + positionTip_str += "Residue: " + d.values[0].ref_aa_triplet + "
"; + positionTip_str += "Tolerance score (dn/ds): "+ (Math.round((d.values[0].sw_dn_ds)*100)/100) +' ('+tolerance_rating(d.values[0].sw_dn_ds) +')'; if (d.values[0].domains.length > 0){ positionTip_str += "
In domain(s): "; var n_domains_at_position = d.values[0].domains.length; @@ -1133,4 +1134,28 @@ function tolerance_color(score) { } else { return toleranceColorGradient[8].color; } +} + +//the color coding for specific tolerance scores +//color #f29e2e indicates the average dn/ds tolerance score over all genes +function tolerance_rating(score) { + if (score <= 0.175) { + return ''; + } else if (score <= 0.35) { + return '' ; + } else if (score <= 0.525) { + return '' ; + } else if (score <= 0.7) { + return '' ; + } else if (score <= 0.875) { + return '' ; + } else if (score <= 1.025) { + return '' ; + } else if (score <= 1.2) { + return '' ; + } else if (score <= 1.375) { + return '' ; + } else { + return '' ; + } } \ No newline at end of file diff --git a/metadome/presentation/web/templates/js/dashboard.js b/metadome/presentation/web/templates/js/dashboard.js index b6decdd..65468f2 100644 --- a/metadome/presentation/web/templates/js/dashboard.js +++ b/metadome/presentation/web/templates/js/dashboard.js @@ -605,8 +605,8 @@ function createPositionalInformation(domain_metadomain_coverage, transcript_id, } //Adds positional information for a selected position -function FillPositionalInformation(domain_metadomain_coverage, position_data, data){ - // Reset the positional information +function FillPositionalInformation(domain_metadomain_coverage, position_data, data){ + // Reset the positional information document.getElementById("positional_information_overlay_title").innerHTML = '
'; document.getElementById("positional_information_overlay_body").innerHTML = ''; @@ -618,6 +618,9 @@ function FillPositionalInformation(domain_metadomain_coverage, position_data, da document.getElementById("positional_information_overlay_body").innerHTML += '

Protein: p.'+ position_data.values[0].protein_pos +' '+ position_data.values[0].ref_aa_triplet+'

'; document.getElementById("positional_information_overlay_body").innerHTML += '

cDNA: '+ position_data.values[0].cdna_pos +' '+ position_data.values[0].ref_codon +'

'; + document.getElementById("positional_information_overlay_body").innerHTML += '

Tolerance score (dn/ds): '+ (Math.round((position_data.values[0].sw_dn_ds)*100)/100) +' ('+tolerance_rating(position_data.values[0].sw_dn_ds) +')

'; + + // retrieve domain information var domain_information = ""; var meta_domain_information = ""; From f7b3f44dfad0c5992335900e21f1a60e290c8639 Mon Sep 17 00:00:00 2001 From: laurensvdwiel Date: Tue, 16 Apr 2019 13:53:00 +0200 Subject: [PATCH 04/19] fix for https://github.com/cmbi/metadome/issues/43 --- .../web/static/js/dashboard/visualization.js | 28 +++++++++++++++++-- .../presentation/web/templates/dashboard.html | 13 ++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/metadome/presentation/web/static/js/dashboard/visualization.js b/metadome/presentation/web/static/js/dashboard/visualization.js index edb4d65..1e56038 100644 --- a/metadome/presentation/web/static/js/dashboard/visualization.js +++ b/metadome/presentation/web/static/js/dashboard/visualization.js @@ -83,6 +83,9 @@ var metadomain_graph_visible = true; // indicates if clinvar variants are annotated in the schematic protein representation var clinvar_variants_visible = false; +//indicates if homologous clinvar variants are annotated in the schematic protein representation +var homologous_clinvar_variants_visible = false; + // indicates the various colors to indicate the tolerance var toleranceColorGradient = [ { offset : "0%", @@ -963,12 +966,15 @@ function draw_position_schematic_protein(d, element){ if (d.values[0].ClinVar != null) { pathogenic_missense_variant_count += d.values[0].ClinVar.length; } - + } + + var homologous_pathogenic_missense_variant_count = 0; + if (homologous_clinvar_variants_visible){ // count pathogenic variants linked via meta-domain relationships if (d.values[0].domains != null){ meta_domain_ids.forEach(domain_id => { if (d.values[0].hasOwnProperty('domains') && d.values[0].domains[domain_id] != null){ - pathogenic_missense_variant_count = Math.max(d.values[0].domains[domain_id].pathogenic_missense_variant_count, pathogenic_missense_variant_count); + homologous_pathogenic_missense_variant_count = d.values[0].domains[domain_id].pathogenic_missense_variant_count; } }); } @@ -986,6 +992,13 @@ function draw_position_schematic_protein(d, element){ return 'red'; } + // if containing pathogenic variants, display it as red + if (homologous_pathogenic_missense_variant_count > 0){ + d3.select(element).style("fill-opacity", 0.7); + return 'red'; + } + + else{ d3.select(element).style("fill-opacity", 0.2); return "grey"; @@ -1002,6 +1015,17 @@ function toggleClinvarVariantsInProtein(clinvar_checkbox){ }); } +function toggleHomologousClinvarVariantsInProtein(clinvar_checkbox){ + var focusAxis = d3.select("#tolerance_axis"); + + homologous_clinvar_variants_visible = clinvar_checkbox.checked; + + focusAxis.selectAll(".toleranceAxisTick").style("fill", function(d, i) { + return draw_position_schematic_protein(d, this); + }); +} + + // Rescale the landscape for zooming or brushing purposes function rescaleLandscape(){ var focus = d3.select("#tolerance_graph"); diff --git a/metadome/presentation/web/templates/dashboard.html b/metadome/presentation/web/templates/dashboard.html index bc78a59..df95fc2 100644 --- a/metadome/presentation/web/templates/dashboard.html +++ b/metadome/presentation/web/templates/dashboard.html @@ -115,13 +115,24 @@ Show Gene's Tolerance Landscape + + +
+ +
+