From 0cec57ef9ada33207a6636a54276566896b21da6 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 27 Aug 2019 13:08:37 -0500 Subject: Zooming on a chromosome now also zooms the genome browser Added genome browser css because it wasn't previously committed --- wqflask/wqflask/marker_regression/run_mapping.py | 25 ++++++++++++++++++++-- .../static/new/javascript/init_genome_browser.js | 4 ++++ .../css/purescript-genetics-browser.css | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index bf90c979..af5d0206 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -376,6 +376,25 @@ class RunMapping(object): chr_lengths = get_chr_lengths(self.mapping_scale, self.dataset, self.qtl_results_for_browser) + #ZS: For zooming into genome browser, need to pass chromosome name instead of number + if self.dataset.group.species == "mouse": + if self.selected_chr == 20: + this_chr = "X" + else: + this_chr = str(self.selected_chr) + elif self.dataset.group.species == "rat": + if self.selected_chr == 21: + this_chr = "X" + else: + this_chr = str(self.selected_chr) + else: + if self.selected_chr == 22: + this_chr = "X" + elif self.selected_chr == 23: + this_chr = "Y" + else: + this_chr = str(self.selected_chr) + if self.mapping_method != "gemma": if self.score_type == "LRS": significant_for_browser = self.significant / 4.16 @@ -395,12 +414,14 @@ class RunMapping(object): num_perm = self.num_perm, perm_results = self.perm_output, browser_files = browser_files, - significant = significant_for_browser + significant = significant_for_browser, + selected_chr = this_chr ) else: self.js_data = dict( chr_lengths = chr_lengths, - browser_files = browser_files + browser_files = browser_files, + selected_chr = this_chr ) def run_rqtl_plink(self): diff --git a/wqflask/wqflask/static/new/javascript/init_genome_browser.js b/wqflask/wqflask/static/new/javascript/init_genome_browser.js index eba1a69f..2552fb04 100644 --- a/wqflask/wqflask/static/new/javascript/init_genome_browser.js +++ b/wqflask/wqflask/static/new/javascript/init_genome_browser.js @@ -71,6 +71,10 @@ var config = coordinateSystem: coordinateSystem, }; +if (js_data.selected_chr != -1) { + config['initialChrs'] = {left: js_data.selected_chr, right: js_data.selected_chr} +} + $('#browser_tab').click(function() { if ($('#gwas').length == 0){ GenomeBrowser.main(config)(); diff --git a/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css new file mode 100644 index 00000000..135292ac --- /dev/null +++ b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css @@ -0,0 +1 @@ +body,html{max-width:100%;overflow-x:hidden}#browser{position:absolute;margin:0}#info-line{border:1px solid #aaa;padding:2px;position:absolute;right:0;top:1px;min-width:14%;font-size:9pt}#controls{visibility:hidden;position:absolute;top:4px;left:100px;z-index:1000}#controls>button{border:1px solid #aaa;border-radius:2px;padding-left:6px;padding-right:6px;height:23px;min-width:20px}button#scrollRight,button#zoomIn{margin-left:-2px;margin-right:4px}#infoBox{position:absolute;display:inline-block;z-index:10000;visibility:hidden;padding:5px;border:2px solid grey;border-radius:5%;background-color:#fff;min-height:100px;min-width:10px;max-width:80%;margin-top:9.7em;font-family:sans-serif}#infoBox>div{float:left;margin:1em 1.2em}#infoBox>div>p{margin:.1em} \ No newline at end of file -- cgit v1.2.3