diff options
author | Pjotr Prins | 2024-04-03 13:28:49 +0200 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-12 07:42:01 -0500 |
commit | 4dd2ab8da310a34e598553ef951d3233ded9d1ab (patch) | |
tree | f7e62eef1886607cf494ea94993436044ff72191 | |
parent | 9d221ad285e4d41e0a83af88bef8f221356848ba (diff) | |
download | genenetwork3-4dd2ab8da310a34e598553ef951d3233ded9d1ab.tar.gz |
Make sure dir exists before running R/qtl
-rw-r--r-- | gn3/api/rqtl.py | 4 | ||||
-rw-r--r-- | scripts/rqtl_wrapper.R | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py index dd9078f..68299d4 100644 --- a/gn3/api/rqtl.py +++ b/gn3/api/rqtl.py @@ -38,6 +38,10 @@ run the rqtl_wrapper script and return the results as JSON if kwarg in boolean_kwargs: rqtl_bool_kwargs.append(kwarg) + outdir = os.path.join(get_tmpdir(),"gn3") + if not os.path.isdir(outdir): + os.mkdir(outdir) + rqtl_cmd = generate_rqtl_cmd( rqtl_wrapper_cmd='scripts/rqtl_wrapper.R', rqtl_wrapper_kwargs=rqtl_kwargs, diff --git a/scripts/rqtl_wrapper.R b/scripts/rqtl_wrapper.R index 0d1f2ff..b4725d0 100644 --- a/scripts/rqtl_wrapper.R +++ b/scripts/rqtl_wrapper.R @@ -22,7 +22,7 @@ option_list = list( make_option(c("--pstrata"), action="store_true", default=NULL, help="Use permutation strata (stored as final column/vector in phenotype input file)"), make_option(c("-s", "--scale"), type="character", default="mb", help="Mapping scale - Megabases (Mb) or Centimorgans (cM)"), make_option(c("--control"), type="character", default=NULL, help="Name of marker (contained in genotype file) to be used as a control"), - make_option(c("-o", "--outdir"), type="character", default=NULL, help="Directory in which to write result file"), + make_option(c("-o", "--outdir"), type="character", default=file.path(tmp_dir, "gn3"), help="Directory in which to write result file"), make_option(c("-f", "--filename"), type="character", default=NULL, help="Name to use for result file"), make_option(c("-v", "--verbose"), action="store_true", default=NULL, help="Show extra information") ); @@ -62,7 +62,7 @@ geno_file = opt$geno pheno_file = opt$pheno # Generate randomized filename for cross object -cross_file = file.path(tmp_dir, "output", paste(stri_rand_strings(1, 8), ".cross", sep = "")) +cross_file = file.path(tmp_dir, "gn3", paste(stri_rand_strings(1, 8), ".cross", sep = "")) trim <- function( x ) { gsub("(^[[:space:]]+|[[:space:]]+$)", "", x) } |