createParamFiles.Rd
The constructor function creates an SYSargs2
S4 class object from
command-line string. Also, the function creates and saves the CWL param files.
The latest storages all the parameters required for running command-line software,
following the standard and specification defined on Common Workflow Language (CWL).
createParamFiles(commandline, cwlVersion = "v1.1", class = "CommandLineTool",
results_path = "./results", module_load = "baseCommand",
file = "default", syntaxVersion = "v1",
writeParamFiles = TRUE, confirm = FALSE,
overwrite = FALSE, silent = FALSE)
writeParamFiles(sysargs, file = "default", overwrite = TRUE, silent = FALSE,
syntaxVersion = "v1")
string. Original command-line to create the CWL files from. Please see
Details
for more information.
string. The version of the Common Workflow Language. More information here: https://www.commonwl.org/.
character. Name of Common Workflow Language Description class. The following
is accepted: CommandLineTool
.
Path to the results folder. Default is results
.
string, Name of software to load by Environment Modules system. Default is
"baseCommand", which creates a subfolder and two files: *.cwl and *.yml
at ./param/cwl/
.
character. Name and path of output files. If set to "default" then the name of
the output files will have the pattern <software>.cwl
and
<software>.yml
, where <software> will be what baseCommand(x)
returns, when x
is an object of class SYSargs2
.
Also, it creates a subfolder at ./param/cwl/
with name <software>.
character. One of "v1"
or "v2"
, what CWL parsing syntax version to use.
Default is to use the old version. The V2 version comes with more feature support,
but has more syntax restrictions. See details.
logical. If set to TRUE, it will write to file the content of the CWL
files:*.cwl
and *.yml
. Default is TRUE
.
If set to FALSE
and in an interactive section, it will prompt a question to
proceed or not.
logical. If set to TRUE, existing files of the same name will be overwritten.
Default is FALSE
.
logical. If set to TRUE, all messages returned by the function will be
suppressed. Default is FALSE
.
Object of class SYSargs2
. Output from the createParamFiles
function.
- First line of the command-line object will be treated as the
baseCommand
;
- For argument lines (starting from the second line), any word before the first
space with leading `-` or `--` in each will be treated as a prefix, like
-S
or --min
. Any line without this first word will be treated
as no prefix;
- All defaults are placed inside <...>
;
- First argument is the input argument type. F
for "File", int
for integer, string
for string;
- Optional: use the keyword out
followed the type with a ,
comma
separation to indicate if this argument is also a CWL output;
- Then, use :
to separate keywords and default values, any non-space
value after the :
will be treated as the default value;
- If any argument has no default value, just a flag, like --verbose
,
there no need to add any <...>
.
- The \
is not required, however for consistency it is recommended to add.
- First line of the command-line object will be treated as the
baseCommand
;
- Each line specifies one argument and its default value.
- Each line is composed with exact 2 ;
to seprate 3 columns.
- Text before first ;
will be will used as prefix/names.
If it starts with keyword "p:
", anything after "p:
"
and before the first ;
will be used as prefix, and the name
of this position will be the prefix but with leading dash(s) "-
",
"-
" removed. If there is any duplication, a number index will be
added to the end. If there is no keyword "p:
" before first ;
,
all text before first ;
will be the name.
- If there is keyword "p:
" before first ;
but nothing before
and after the second ;
, this position will be treated as CWL argument
instead of input.
- Text between first and second ;
is type. Must be one of File, Directory,
string, int, double, float, long, boolean.
- Text after second ;
and before \
or end of the line is the
default value. If it starts with keyword "out
" or "stdout
", this
position will also be added to outputs or standard output.
- There is only 1 position with "stdout
" allowed and usually it is the
last position arguement.
- Ending with "\
" is recommended but not required.
SYSargs2
object
For more details on CWL
, please consult the following
page: https://www.commonwl.org/
writeParamFiles
printParam
subsetParam
replaceParam
renameParam
appendParam
loadWorkflow
renderWF
showClass("SYSargs2")
## syntax version 1 example
command <- "
hisat2 \
-S <F, out: ./results/M1A.sam> \
-x <F: ./data/tair10.fasta> \
-k <int: 1> \
-min-intronlen <int: 30> \
-max-intronlen <int: 3000> \
-threads <int: 4> \
-U <F: ./data/SRR446027_1.fastq.gz> \
--verbose
"
cmd <- createParam(command, writeParamFiles=FALSE)
#> *****BaseCommand*****
#> hisat2
#> *****Inputs*****
#> S:
#> type: File
#> preF: -S
#> yml: ./results/M1A.sam
#> x:
#> type: File
#> preF: -x
#> yml: ./data/tair10.fasta
#> k:
#> type: int
#> preF: -k
#> yml: 1
#> min-intronlen:
#> type: int
#> preF: -min-intronlen
#> yml: 30
#> max-intronlen:
#> type: int
#> preF: -max-intronlen
#> yml: 3000
#> threads:
#> type: int
#> preF: -threads
#> yml: 4
#> U:
#> type: File
#> preF: -U
#> yml: ./data/SRR446027_1.fastq.gz
#> verbose:
#> type:
#> preF: --verbose
#> yml:
#> *****Outputs*****
#> output1:
#> type: File
#> value: ./results/M1A.sam
#> *****Parsed raw command line*****
#> hisat2 -S ./results/M1A.sam -x ./data/tair10.fasta -k 1 -min-intronlen 30 -max-intronlen 3000 -threads 4 -U ./data/SRR446027_1.fastq.gz --verbose
cmdlist(cmd)
#> $defaultid
#> $defaultid$hisat2
#> [1] "hisat2 -S ./results/M1A.sam -x ./data/tair10.fasta -k 1 -min-intronlen 30 -max-intronlen 3000 -threads 4 -U ./data/SRR446027_1.fastq.gz --verbose "
#>
#>
## syntax version 2 example
command2 <- '
mycmd2 \
p: -s; File; sample1.txt \
p: -s; File; sample2.txt \
p: --c; ; \
p: -o; File; out: myout.txt \
ref_genome; File; a.fasta \
p: --nn; int; 12 \
mystdout; File; stdout: abc.txt
'
cmd2 <- createParam(command2, syntaxVersion = "v2", writeParamFiles=FALSE)
#> *****BaseCommand*****
#> mycmd2
#> *****Arguments*****
#> argument1:
#> prefix: --c
#> position: 3
#> *****Inputs*****
#> s1:
#> type: File
#> prefix: -s
#> default value: sample1.txt
#> position: 1
#> s2:
#> type: File
#> prefix: -s
#> default value: sample2.txt
#> position: 2
#> o:
#> type: File
#> prefix: -o
#> default value: myout.txt
#> position: 4
#> ref_genome:
#> type: File
#> prefix:
#> default value: a.fasta
#> position: 5
#> nn:
#> type: int
#> prefix: --nn
#> default value: 12
#> position: 6
#> *****Outputs*****
#> output1:
#> type: File
#> default value: myout.txt
#> *****Standard Outputs*****
#> mystdout:
#> type: File
#> default value: abc.txt
#> *****Parsed raw command line*****
#> mycmd2 -s sample1.txt -s sample2.txt --c -o myout.txt a.fasta --nn 12 > abc.txt
cmdlist(cmd2)
#> $defaultid
#> $defaultid$mycmd2
#> [1] "mycmd2 --c -s sample1.txt -s sample2.txt -o myout.txt a.fasta --nn 12 myout.txt > abc.txt"
#>
#>