aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorDannyArends2015-03-18 17:34:07 +0100
committerDannyArends2015-03-18 17:34:07 +0100
commit90cd6a9df350c197185c638729299959ac54d3b0 (patch)
tree373acf48af8030be4b3a3e5ec89aa2ca14f481d1 /wqflask
parentbb083659c0cc21e4817989d637e6d65ea7768665 (diff)
downloadgenenetwork2-90cd6a9df350c197185c638729299959ac54d3b0.tar.gz
Some more minor code/comment updates, making code a little shorter
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/marker_regression/marker_regression.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 5ddae0a1..60bc721e 100755
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -314,20 +314,18 @@ class MarkerRegression(object):
def create_covariates(self, cross):
ro.globalenv["the_cross"] = cross
- ro.r('genotypes <- pull.geno(the_cross)') # Get genotype matrix
- userinputS = self.control.replace(" ", "").split(",") # TODO sanitize user input !!! never trust a user
- covariate_names = ', '.join('"{0}"'.format(w) for w in userinputS)
- print(covariate_names)
- ro.r('covariates <- genotypes[,c(' + covariate_names + ')]') # get covariate matrix,
- print("COVARIATES:", ro.r["covariates"])
+ ro.r('genotypes <- pull.geno(the_cross)') # Get the genotype matrix
+ userinputS = self.control.replace(" ", "").split(",") # TODO sanitize user input, Never Ever trust a user
+ covariate_names = ', '.join('"{0}"'.format(w) for w in userinputS)
+ print("Marker names of selected covariates:", covariate_names)
+ ro.r('covariates <- genotypes[,c(' + covariate_names + ')]') # Get the covariate matrix by using the marker name as index to the genotype file
+ print("R/qtl matrix of covariates:", ro.r["covariates"])
return ro.r["covariates"]
def sanitize_rqtl_phenotype(self):
pheno_as_string = "c("
- null_pos = []
for i, val in enumerate(self.vals):
if val == "x":
- null_pos.append(i)
if i < (len(self.vals) - 1):
pheno_as_string += "NA,"
else:
@@ -342,7 +340,7 @@ class MarkerRegression(object):
def process_rqtl_results(self, result): # TODO: how to make this a one liner and not copy the stuff in a loop
qtl_results = []
-
+
output = [tuple([result[j][i] for j in range(result.ncol)]) for i in range(result.nrow)]
print("R/qtl scanone output:", output)