Skip to content
Snippets Groups Projects
Commit 0ab756c6 authored by Francesco Sabatini's avatar Francesco Sabatini
Browse files

cli and submit

parents
No related branches found
No related tags found
No related merge requests found
library(optparse)
# ------------------------------------------------------------------------------
# defaults
# ------------------------------------------------------------------------------
default.max.inter.t <- 1
default.nperm <- 99
# ------------------------------------------------------------------------------
# parsing arguments
# ------------------------------------------------------------------------------
options <- list (
make_option(
opt_str = c("-m", "--max.inter.t"),
dest = "max.inter.t",
type = "integer",
default = default.max.inter.t,
help = "Max number of interactions for traits",
metavar = "4"
),
make_option(
opt_str = c("-n", "--chunkn"),
dest = "chunkn",
type = "integer",
default = 1,
help = "How many chunks?",
metavar = "4"
),
make_option(
opt_str = c("-i", "--chunk.i"),
dest = "chunk.i",
type = "integer",
default = NA,
help = "Which chunk?",
metavar = "4"
),
make_option(
opt_str = c("-p", "--nperm"),
dest = "nperm",
type = "integer",
default = default.nperm,
help = "How many permutations?",
metavar = "4"
)
)
parser <- OptionParser(
usage = "Rscript %prog [options] data dt_beals header output",
option_list = options,
description = "\nan awesome R script",
epilogue = "use with caution, the awesomeness might slap you in the face!"
)
cli <- parse_args(parser, positional_arguments = 4)
# ------------------------------------------------------------------------------
# assign a few shortcuts
# ------------------------------------------------------------------------------
species.path <- cli$args[1]
traits.path <- cli$args[2]
output <- cli$args[3]
myfunction <- cli$args[4]
max.inter.t <- cli$options$max.inter.t
chunkn <- cli$options$chunkn
chunk.i <- cli$options$chunk.i
nperm <- cli$options$nperm
# ------------------------------------------------------------------------------
# actual program
# ------------------------------------------------------------------------------
source("01b_MesobromionCluster.R")
Mesobromion(species.path, traits.path, output, myfunction, max.inter.t, chunkn, chunk.i, nperm)
#!/bin/bash
#$ -S /bin/bash
#$ -N HIDDEN
#$ -o /work/$USER/$JOB_NAME-$JOB_ID-$TASK_ID.log
#$ -j y
#$ -l h_rt=00:30:00:00
#$ -l h_vmem=1G
#$ -pe smp 1-1
#$ -cwd
#$ -t 1-1
module load R
output=/data/splot/HIDDEN/output/HIDDEN
Rscript \
cli_01b.r \
--max.inter.t 2 \
--chunk.i $SGE_TASK_ID \
--chunkn 399 \
--nperm 99 \
/data/splot/HIDDEN/species.out.10perc.txt \
/data/splot/HIDDEN/traits.out.10perc.txt \
"$output" \
"get.corXY"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment