Accessories function to modify the Command-line Version 2

printParam2(sysargs, base = FALSE, args = FALSE, inputs = FALSE,
        outputs = FALSE, stdout = FALSE, raw_cmd = FALSE, all = TRUE)
appendParam2(sysargs, x, position = c("inputs", "args", "outputs"),
        after = NULL, verbose = FALSE)
replaceParam2(sysargs, x, index=NULL,
              position = c("inputs", "baseCommand", "args", "outputs", "stdout"),
              verbose = FALSE)
removeParam2(sysargs, index=NULL, position = c("inputs", "args", "outputs", "stdout"),
             verbose = FALSE)
renameParam2(sysargs, index=NULL, new_names,
             position = c("inputs", "args", "outputs", "stdout"), verbose = FALSE)

Arguments

sysargs

Object of class SYSargs2. Output from the createParamFiles function.

base

logical, print out base command information?

args

logical, print out arguments information?

inputs

logical, print out inputs information?

outputs

logical, print out outputs information?

stdout

logical, print out stdout information?

raw_cmd

logical, print out parsed raw command information?

all

logical, print out all base command, arguments, inputs, outputs, and raw command information? Turn this to TRUE will overwrite all above to TRUE. If you need to print out selected positions, turn this to FALSE and turn other positions to TRUE.

position

string, one of the positions to apply a modification. For appendParam2: "inputs", "args", "outputs", for replaceParam2: "inputs", "baseCommand", "args", "outputs", "stdout", for removeParam2, renameParam2: "inputs", "args", "outputs", "stdout".

index

numeric or character vector, index of items to remove or rename item(s) inside the position you choose, in removeParam2, renameParam2, replaceParam2.

after

integer, in appendParam2, after which current item you want to append the new items in the position you have selected? For example, if you want the new item to be the first, then use 0, if last, then use 999 to make sure it goes to the last one.

x

named list or string, new items to replace or append in different positions. Replace list length must be the same as index. Different positions will have different requirements. See details of the x format requirements.

new_names

character vector, new names that you wish to replace the old names. new_names vector length must be the same as index in renameParam2.

verbose

logical, show addtional information during/after operation? for example, print the new changes.

Details

- printParam2: prints its arguments defined by position and index.

- removeParam2: removes items in certain positions you select.

- replaceParam2: replaces the values in command-line with indices given in list by those given in values

- renameParam2: rename the names of items in certain position.

- appendParam2: Add arguments to the original command line. Adding new basecommand or standard out is not allowed.

x format

- If x is a character, it requires exact 3 semi-colons ; to separate the string in to 4 columns. Values before the third column is the same as createParam inputs, first column: prefix/argument name, second column: type, third column: default value. The fourth column (new): numeric, index of the new item, this will be translated into position entries in CWL.

- If x is a list, it must be named. Following items must be included in list: preF, type, value, index. They refer to prefix, param type, default value, and position index correspondingly.

Value

SYSargs2 object

References

For more details on CWL, please consult the following page: https://www.commonwl.org/

Author

Le Zhang and Daniela Cassol

See also

writeParamFiles createParamFiles loadWorkflow renderWF showClass("SYSargs2")

Examples

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 
# string format
new_cmd <- 'p: -abc; string; abc; 7'
cmd2 <- appendParam2(cmd2, x = new_cmd, position = "inputs")
printParam2(cmd2, all = FALSE, inputs = TRUE, raw_cmd = TRUE)
#> *****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
#> abc:
#>     type: string
#>     prefix: -abc
#>     default value: abc
#>     position: 7
#> *****Parsed raw command line*****
#> mycmd2 -s sample1.txt -s sample2.txt --c -o myout.txt  a.fasta --nn 12 -abc abc > abc.txt 
# list format
new_cmd <- list(name = "new_arg", preF = "--foo", index = "8")
cmd2 <- appendParam2(cmd2, x = new_cmd, position = "args")
printParam2(cmd2, all = FALSE, args = TRUE, raw_cmd = TRUE)
#> *****Arguments*****
#> argument1:
#>     prefix: --c
#>     position: 3
#> new_arg:
#>     prefix: --foo
#>     position: 8
#> *****Parsed raw command line*****
#> mycmd2 -s sample1.txt -s sample2.txt --c -o myout.txt  a.fasta --nn 12 -abc abc --foo > abc.txt 
# rename
cmd2 <- renameParam2(cmd2, "new_name_arg", index = "new_arg", position = "args")
printParam2(cmd2, all = FALSE, args = TRUE, raw_cmd = TRUE)
#> *****Arguments*****
#> argument1:
#>     prefix: --c
#>     position: 3
#> new_name_arg:
#>     prefix: --foo
#>     position: 8
#> *****Parsed raw command line*****
#> mycmd2 -s sample1.txt -s sample2.txt --c -o myout.txt  a.fasta --nn 12 -abc abc --foo > abc.txt 
# remove
cmd2 <- removeParam2(cmd2, index = "new_name_arg", position = "args")
printParam2(cmd2, all = FALSE, args = TRUE, raw_cmd = TRUE)
#> *****Arguments*****
#> argument1:
#>     prefix: --c
#>     position: 3
#> *****Parsed raw command line*****
#> mycmd2 -s sample1.txt -s sample2.txt --c -o myout.txt  a.fasta --nn 12 -abc abc > abc.txt