createParam {systemPipeR} | R 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", writeParamFiles = TRUE, confirm = FALSE,
                      overwrite = FALSE, silent = FALSE)

    writeParamFiles(sysargs, file = "default", overwrite = TRUE, silent = FALSE)

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

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

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

    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)

[Package systemPipeR version 2.0.8 Index]