diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/marker_regression/run_mapping.py | 29 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/init_genome_browser.js | 23 |
2 files changed, 29 insertions, 23 deletions
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 20c5c5bd..1c08d653 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -365,6 +365,8 @@ class RunMapping(object): with Bench("Trimming Markers for Table"): self.trimmed_markers = trim_markers_for_table(results) + chr_lengths = get_chr_lengths(self.mapping_scale, self.dataset, self.qtl_results_for_browser) + if self.mapping_method != "gemma": if self.score_type == "LRS": significant_for_browser = self.significant / 4.16 @@ -380,6 +382,7 @@ class RunMapping(object): #mapping_scale = self.mapping_scale, #chromosomes = chromosome_mb_lengths, #qtl_results = self.qtl_results, + chr_lengths = chr_lengths, num_perm = self.num_perm, perm_results = self.perm_output, browser_files = browser_files, @@ -387,6 +390,7 @@ class RunMapping(object): ) else: self.js_data = dict( + chr_lengths = chr_lengths, browser_files = browser_files ) @@ -535,4 +539,27 @@ def geno_db_exists(this_dataset): geno_db = data_set.create_dataset(dataset_name=geno_db_name, get_samplelist=False) return "True" except: - return "False"
\ No newline at end of file + return "False" + +def get_chr_lengths(mapping_scale, dataset, qtl_results): + chr_lengths = [] + if mapping_scale == "physic": + for i, the_chr in enumerate(dataset.species.chromosomes.chromosomes): + this_chr = { + "chr": dataset.species.chromosomes.chromosomes[the_chr].name, + "size": str(dataset.species.chromosomes.chromosomes[the_chr].length) + } + chr_lengths.append(this_chr) + else: + this_chr = 1 + highest_pos = 0 + for i, result in enumerate(qtl_results): + if int(result['chr']) > this_chr or i == (len(qtl_results) - 1): + chr_lengths.append({ "chr": str(this_chr), "size": str(highest_pos)}) + this_chr = int(result['chr']) + highest_pos = 0 + else: + if float(result['ps']) > highest_pos: + highest_pos = float(result['ps']) + + return chr_lengths
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/init_genome_browser.js b/wqflask/wqflask/static/new/javascript/init_genome_browser.js index 7dfd6712..a544f3cb 100644 --- a/wqflask/wqflask/static/new/javascript/init_genome_browser.js +++ b/wqflask/wqflask/static/new/javascript/init_genome_browser.js @@ -9,28 +9,7 @@ localUrls = annotations: annot_filename }; -var coordinateSystem = - [ - { chr: "1", size: "195471971" }, - { chr: "2", size: "182113224" }, - { chr: "3", size: "160039680" }, - { chr: "4", size: "156508116" }, - { chr: "5", size: "151834684" }, - { chr: "6", size: "149736546" }, - { chr: "7", size: "145441459" }, - { chr: "8", size: "129401213" }, - { chr: "9", size: "124595110" }, - { chr: "10", size: "130694993" }, - { chr: "11", size: "122082543" }, - { chr: "12", size: "120129022" }, - { chr: "13", size: "120421639" }, - { chr: "14", size: "124902244" }, - { chr: "15", size: "104043685" }, - { chr: "16", size: "98207768" }, - { chr: "17", size: "94987271" }, - { chr: "18", size: "90702639" }, - { chr: "19", size: "61431566" }, - ]; +var coordinateSystem = js_data.chr_lengths var vscaleWidth = 90.0; var legendWidth = 140.0; |