diff options
author | zsloan | 2019-08-13 12:25:45 -0500 |
---|---|---|
committer | zsloan | 2019-08-13 12:25:45 -0500 |
commit | c3df49c8bc5aa4ee655bbda3c5d44261fea719d9 (patch) | |
tree | f4779e7caffe12ef3570a35b7067eee20532f5a3 /wqflask | |
parent | 4e6c8eba35a5ecd9e6b5b1c5faa98021656acb9d (diff) | |
download | genenetwork2-c3df49c8bc5aa4ee655bbda3c5d44261fea719d9.tar.gz |
Annotation links for markers only appear if they're in our database now
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/marker_regression/run_mapping.py | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 11ad7aa4..20c5c5bd 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -89,13 +89,8 @@ class RunMapping(object): self.num_vals = start_vars['num_vals'] #ZS: Check if genotypes exist in the DB in order to create links for markers - if "geno_db_exists" in start_vars: - self.geno_db_exists = start_vars['geno_db_exists'] - else: - try: - self.geno_db_exists = "True" - except: - self.geno_db_exists = "False" + + self.geno_db_exists = geno_db_exists(self.dataset) self.mapping_method = start_vars['method'] if "results_path" in start_vars: @@ -324,13 +319,22 @@ class RunMapping(object): ps = marker['Mb']*1000000, url = "/show_trait?trait_id=" + marker['name'] + "&dataset=" + self.dataset.group.name + "Geno" ) - annot_marker = dict( - name = str(marker['name']), - chr = str(marker['chr']), - rs = marker['name'], - pos = marker['Mb']*1000000, - url = "/show_trait?trait_id=" + marker['name'] + "&dataset=" + self.dataset.group.name + "Geno" - ) + + if self.geno_db_exists == "True": + annot_marker = dict( + name = str(marker['name']), + chr = str(marker['chr']), + rs = marker['name'], + pos = marker['Mb']*1000000, + url = "/show_trait?trait_id=" + marker['name'] + "&dataset=" + self.dataset.group.name + "Geno" + ) + else: + annot_marker = dict( + name = str(marker['name']), + chr = str(marker['chr']), + rs = marker['name'], + pos = marker['Mb']*1000000 + ) #if 'p_value' in marker: # logger.debug("P EXISTS:", marker['p_value']) #else: @@ -524,4 +528,11 @@ def write_input_for_browser(this_dataset, gwas_results, annotations): annot_file.write(json.dumps(annotations)) return [gwas_filename, annot_filename] - #return [gwas_filename, annot_filename]
\ No newline at end of file + +def geno_db_exists(this_dataset): + geno_db_name = this_dataset.group.name + "Geno" + try: + 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 |