From 471dd08f14897d15df96e5db60208fcfaf7c9bd7 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 28 Feb 2018 18:23:57 +0000
Subject: Fixed issue that caused some GEMMA results to appear incorrectly
---
wqflask/wqflask/marker_regression/gemma_mapping.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py
index 68920130..54cde3c6 100644
--- a/wqflask/wqflask/marker_regression/gemma_mapping.py
+++ b/wqflask/wqflask/marker_regression/gemma_mapping.py
@@ -3,7 +3,7 @@ import os, math, string, random, json
from base import webqtlConfig
from base.trait import GeneralTrait
from base.data_set import create_dataset
-from utility.tools import flat_files, GEMMA_COMMAND, GEMMA_WRAPPER_COMMAND, TEMPDIR, assert_bin, assert_file
+from utility.tools import flat_files, GEMMA_COMMAND, GEMMA_WRAPPER_COMMAND, TEMPDIR
import utility.logger
logger = utility.logger.getLogger(__name__ )
@@ -11,7 +11,6 @@ logger = utility.logger.getLogger(__name__ )
def run_gemma(this_dataset, samples, vals, covariates, method, use_loco):
"""Generates p-values for each marker using GEMMA"""
- assert_bin(GEMMA_COMMAND);
if this_dataset.group.genofile != None:
genofile_name = this_dataset.group.genofile[:-5]
else:
@@ -193,7 +192,7 @@ def parse_gemma_output(genofile_name):
# if marker['chr'] != previous_chr:
# previous_chr = marker['chr']
marker['Mb'] = float(line.split("\t")[2]) / 1000000
- marker['p_value'] = float(line.split("\t")[10])
+ marker['p_value'] = float(line.split("\t")[11])
if math.isnan(marker['p_value']) or (marker['p_value'] <= 0):
marker['lod_score'] = 0
#marker['lrs_value'] = 0
@@ -203,7 +202,7 @@ def parse_gemma_output(genofile_name):
marker_obs.append(marker)
included_markers.append(line.split("\t")[1])
- p_values.append(float(line.split("\t")[10]))
+ p_values.append(float(line.split("\t")[11]))
return marker_obs
@@ -241,7 +240,7 @@ def parse_loco_output(this_dataset, gwa_output_filename):
else:
marker['chr'] = line.split("\t")[0]
marker['Mb'] = float(line.split("\t")[2]) / 1000000
- marker['p_value'] = float(line.split("\t")[10])
+ marker['p_value'] = float(line.split("\t")[11])
if math.isnan(marker['p_value']) or (marker['p_value'] <= 0):
marker['lod_score'] = 0
#marker['lrs_value'] = 0
@@ -251,6 +250,6 @@ def parse_loco_output(this_dataset, gwa_output_filename):
marker_obs.append(marker)
included_markers.append(line.split("\t")[1])
- p_values.append(float(line.split("\t")[10]))
+ p_values.append(float(line.split("\t")[11]))
- return marker_obs
+ return marker_obs
\ No newline at end of file
--
cgit v1.2.3
From 67004cd8990ae97c0da234399721b5eb11b1675f Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 28 Feb 2018 18:28:12 +0000
Subject: Forgot to import function assert_file
---
wqflask/wqflask/marker_regression/gemma_mapping.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py
index 54cde3c6..2ed97303 100644
--- a/wqflask/wqflask/marker_regression/gemma_mapping.py
+++ b/wqflask/wqflask/marker_regression/gemma_mapping.py
@@ -3,7 +3,7 @@ import os, math, string, random, json
from base import webqtlConfig
from base.trait import GeneralTrait
from base.data_set import create_dataset
-from utility.tools import flat_files, GEMMA_COMMAND, GEMMA_WRAPPER_COMMAND, TEMPDIR
+from utility.tools import assert_file, flat_files, GEMMA_COMMAND, GEMMA_WRAPPER_COMMAND, TEMPDIR
import utility.logger
logger = utility.logger.getLogger(__name__ )
--
cgit v1.2.3
From e5992ce3e047fcfe79d66ed42c00c1af63438482 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 15 Mar 2018 17:59:35 +0000
Subject: Resolved conflicts
---
.../wqflask/correlation_matrix/show_corr_matrix.py | 9 +-
.../wqflask/marker_regression/marker_regression.py | 1 +
.../marker_regression/marker_regression_gn1.py | 2 +
.../wqflask/marker_regression/qtlreaper_mapping.py | 17 +-
wqflask/wqflask/templates/correlation_matrix.html | 3 +-
.../show_trait_calculate_correlations.html | 106 ++++++------
.../templates/show_trait_mapping_tools.html | 185 ++++++++++++++++++++-
wqflask/wqflask/views.py | 2 +-
8 files changed, 250 insertions(+), 75 deletions(-)
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
index b34beb7b..077386a3 100644
--- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
+++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
@@ -173,9 +173,12 @@ class CorrelationMatrix(object):
for sample in self.all_sample_list:
groups.append(1)
- pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors)
-
- self.loadings_array = self.process_loadings()
+ try:
+ self.pca_works = "True"
+ pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors)
+ self.loadings_array = self.process_loadings()
+ except:
+ self.pca_works = "False"
self.js_data = dict(traits = [trait.name for trait in self.traits],
groups = groups,
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 087b95b4..db4f8f46 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -228,6 +228,7 @@ class MarkerRegression(object):
results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait,
self.dataset,
self.samples,
+ self.vals,
self.json_data,
self.num_perm,
self.bootCheck,
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 211cf187..66884b0c 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -1204,6 +1204,8 @@ class MarkerRegression(object):
else:
if self.mapping_method == "gemma" or self.mapping_method == "gemma_bimbam":
string2 = 'Using GEMMA mapping method with no control for other QTLs.'
+ if self.covariates != "":
+ string3 = 'Using following traits as covariates: ' + self.covariates
elif self.mapping_method == "rqtl_plink" or self.mapping_method == "rqtl_geno":
string2 = 'Using R/qtl mapping method with no control for other QTLs.'
elif self.mapping_method == "plink":
diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py
index 50228b5e..6b58190f 100644
--- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py
+++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py
@@ -1,17 +1,20 @@
-def gen_reaper_results(this_trait, dataset, samples_before, json_data, num_perm, bootCheck, num_bootstrap, do_control, control_marker, manhattan_plot):
+import utility.logger
+logger = utility.logger.getLogger(__name__ )
+
+def gen_reaper_results(this_trait, dataset, samples_before, trait_vals, json_data, num_perm, bootCheck, num_bootstrap, do_control, control_marker, manhattan_plot):
genotype = dataset.group.read_genotype_file()
if manhattan_plot != True:
genotype = genotype.addinterval()
- samples, values, variances, sample_aliases = this_trait.export_informative()
-
trimmed_samples = []
trimmed_values = []
- for i in range(0, len(samples)):
- if this_trait.data[samples[i]].name in samples_before:
- trimmed_samples.append(samples[i])
- trimmed_values.append(values[i])
+ for i in range(0, len(samples_before)):
+ try:
+ trimmed_values.append(float(trait_vals[i]))
+ trimmed_samples.append(samples_before[i])
+ except:
+ pass
perm_output = []
bootstrap_results = []
diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html
index ab793d58..d27788a8 100644
--- a/wqflask/wqflask/templates/correlation_matrix.html
+++ b/wqflask/wqflask/templates/correlation_matrix.html
@@ -61,6 +61,7 @@
+{% if pca_works == "True" %}