createParamFiles: createParam

View source: R/cmdToCWL.R

createParamR Documentation

createParam

Description

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).

Usage

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")

Arguments

commandline

string. Original command-line to create the CWL files from. Please see Details for more information.

cwlVersion

string. The version of the Common Workflow Language. More information here: https://www.commonwl.org/.

class

character. Name of Common Workflow Language Description class. The following is accepted: CommandLineTool.

results_path

Path to the results folder. Default is results.

module_load

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/.

file

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>.

syntaxVersion

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.

writeParamFiles

logical. If set to TRUE, it will write to file the content of the CWL files:*.cwl and *.yml. Default is TRUE.

confirm

If set to FALSE and in an interactive section, it will prompt a question to proceed or not.

overwrite

logical. If set to TRUE, existing files of the same name will be overwritten. Default is FALSE.

silent

logical. If set to TRUE, all messages returned by the function will be suppressed. Default is FALSE.

sysargs

Object of class SYSargs2. Output from the createParamFiles function.

Details

Version 1 syntax

- 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.

Version 2 syntax

- 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.

Value

SYSargs2 object

Author(s)

Le Zhang and Daniela Cassol

References

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

See Also

writeParamFiles printParam subsetParam replaceParam renameParam appendParam loadWorkflow renderWF showClass("SYSargs2")

Examples

## 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)
cmdlist(cmd)

## 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)
cmdlist(cmd2)


tgirke/systemPipeR documentation built on Sept. 24, 2024, 9:48 a.m.