aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-08-14 13:09:59 -0500
committerzsloan2019-08-14 13:09:59 -0500
commit958d9b8aea04c566a3c15ec8af53e806077b67bb (patch)
tree85d84001ebe1d2fbf2bffaa4b6eafc8791aefc27 /wqflask
parent31b4ef601e16f8e6d42986a0086864854b42461a (diff)
downloadgenenetwork2-958d9b8aea04c566a3c15ec8af53e806077b67bb.tar.gz
Genome browser now takes chromosome list and lengths as input so it will work correctly with non-mouse species or centimorgan positions
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/marker_regression/run_mapping.py29
-rw-r--r--wqflask/wqflask/static/new/javascript/init_genome_browser.js23
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;