From 72db6b91baf15de4fbd64cd4aef022cf32067b0c Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 19 Apr 2018 15:31:23 +0000 Subject: Changed width of top bar and a couple other html objects to 100% instead of set width Changed to using BIMBAM files to build Marker objects in dataset.py --- wqflask/base/data_set.py | 23 +++++++++++++++++++--- wqflask/wqflask/marker_regression/gemma_mapping.py | 4 ++-- .../wqflask/marker_regression/marker_regression.py | 1 - wqflask/wqflask/templates/base.html | 4 ++-- wqflask/wqflask/templates/index_page_orig.html | 2 +- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 9ca880d0..4a422ee4 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -169,8 +169,27 @@ class Markers(object): """Todo: Build in cacheing so it saves us reading the same file more than once""" def __init__(self, name): json_data_fh = open(locate(name + ".json",'genotype/json')) + try: - markers = json.load(json_data_fh) + markers = [] + with open(locate(name + "_snps.txt", 'r')) as bimbam_fh: + marker = {} + if len(bimbam_fh[0].split(", ")) > 2: + delimiter = ", " + elif len(bimbam_fh[0].split(",")) > 2: + delimiter = "," + elif len(bimbam_fh[0].split("\t")) > 2: + delimiter = "\t" + else: + delimiter = " " + for line in bimbam_fh: + marker['name'] = line.split(delimiter)[0] + marker['Mb'] + marker['chr'] = line.split(delimiter)[2] + marker['cM'] + markers.append(marker) + #try: + # markers = json.load(json_data_fh) except: markers = [] @@ -180,8 +199,6 @@ class Markers(object): marker['Mb'] = float(marker['Mb']) self.markers = markers - #logger.debug("self.markers:", self.markers) - def add_pvalues(self, p_values): logger.debug("length of self.markers:", len(self.markers)) diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 7563eb2c..157e4f33 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -32,7 +32,7 @@ def run_gemma(this_dataset, samples, vals, covariates, method, use_loco): if covariates != "": gen_covariates_file(this_dataset, covariates) - if method == "gemma": + if method == "gemma_plink": gemma_command = GEMMA_COMMAND + ' -bfile %s/%s -k %s/%s.cXX.txt -lmm 1 -maf 0.1' % (flat_files('mapping'), this_dataset.group.name, flat_files('mapping'), @@ -113,7 +113,7 @@ def run_gemma(this_dataset, samples, vals, covariates, method, use_loco): def gen_pheno_txt_file(this_dataset, genofile_name, vals, method): """Generates phenotype file for GEMMA""" - if method == "gemma": + if method == "gemma_plink": current_file_data = [] with open("{}/{}.fam".format(flat_files('mapping'), this_dataset.group.name), "r") as outfile: for i, line in enumerate(outfile): diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index bfb63995..50e673c4 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -587,7 +587,6 @@ def export_mapping_results(dataset, trait, markers, results_path, mapping_scale, output_file.write(",Dominance") output_file.write("\n") for i, marker in enumerate(markers): - logger.debug("THE MARKER:", marker) output_file.write(marker['name'] + "," + str(marker['chr']) + "," + str(marker['Mb']) + ",") if "lod_score" in marker.keys(): output_file.write(str(marker['lod_score'])) diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 64daa1cc..e8b51523 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -22,9 +22,9 @@
-