about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-10-30 13:36:53 +0300
committerAlexander_Kabui2024-10-30 13:38:39 +0300
commit8c87de4d70795c07098608342d9fee1acc571346 (patch)
tree032569fe99b2f3c9ba1ceb6d61e19f4cbef452ad
parenteb0bf73bad1bcf4453e105204acbeeeb8f75c7d1 (diff)
downloadgenenetwork3-8c87de4d70795c07098608342d9fee1acc571346.tar.gz
feat: add option for using pstrata for permutation.
-rw-r--r--scripts/rqtl2_wrapper.R16
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/rqtl2_wrapper.R b/scripts/rqtl2_wrapper.R
index 07b9874..966d3c6 100644
--- a/scripts/rqtl2_wrapper.R
+++ b/scripts/rqtl2_wrapper.R
@@ -17,7 +17,8 @@ make_option(c("-i", "--input_file"), action="store", default=NULL, type='charact
 make_option(c("-p", "--nperm"), type="integer", default= 1,  action="store_true", help="No  of permutations "),
  make_option(c("-d", "--directory"), action = "store", default = NULL, type = "character", help="Temporary working directory: should also host the input file ."),
  make_option(c("-m", "--method"), action = "store", default = "HK", type = "character", help="Scan Mapping Method - HK (Haley Knott), LMM( Linear Mixed Model ), LOCO (Leave one Chromosome Out)"),
-make_option(c("-o", "--output_file"), action="store", default=NULL, type='character', help="a file name of where to write the output json results")
+make_option(c("-o", "--output_file"), action="store", default=NULL, type='character', help="a file name of where to write the output json results"),
+  make_option(c("--pstrata"), action="store_true", default=NULL, help="Use permutation strata")
 )
 
 
@@ -394,8 +395,17 @@ perform_permutation_test <- function(cross,
 
 
 
-# TODO ! get these parameters from argument from the user
-perm <- perform_permutation_test(dataset, Pr, n_perm = NO_OF_PERMUTATION, method = "LMM")
+
+# check if pstrata
+
+if (!(is.null(opt$pstrata)) && (!is.null(Xcovar))){
+perm_strata <- mat2strata(Xcovar)
+} else {
+perm_strata <- NULL
+}
+
+perm <- perform_permutation_test(dataset, Pr, n_perm = NO_OF_PERMUTATION,perm_strata = perm_strata, method = "LMM")
+
 # get the permutation summary with a significance threshold
 get_lod_significance <- function(perm, threshold = c(0.2, 0.05)){
       cat("Fetch the lod with significance thresholds ")