SYSargs2-class {systemPipeR} | R Documentation

## Class `"SYSargs2"`

### Description

`SYSargs2 class` stores all the information and instructions needed for processing a set of input files with a specific command-line or a series of command-line within a workflow. The `SYSargs2` S4 class object is created from the `loadWorkflow` and `renderWF` function, which populates all the command-line for each sample in each step of the particular workflow. Each sample level input/outfile operation uses its own `SYSargs2` instance. The output of `SYSargs2` define all the expected output files for each step in the workflow, which usually it is the sample input for the next step in an `SYSargs2` instance. Between different instances, this connectivity is established by writing the subsetting output with the `writeTargetsout` function to a new targets file that serves as input to the next `loadWorkflow` and `renderWF` call. By chaining several `SYSargs2` steps together one can construct complex workflows involving many sample-level input/output file operations with any combination of command-line or R-based software.

### Objects from the Class

Objects can be created by calls of the form `new("SYSargs2", ...)`.

### Slots

`targets`:

  Object of class `"list"` storing data from each sample from `targets` file

`targetsheader`:

  Object of class `"list"` storing header/comment lines of targets file

`modules`:

  Object of class `"list"` storing software versions from module system

`wf`:

  Object of class `"list"` storing data from Workflow `CWL param` file

`clt`:

  Object of class `"list"` storing data from each CommandLineTool step in the Workflow or the single CommandLineTool `CWL param` file

`yamlinput`:

  Object of class `"list"` storing data from `input` file

`cmdlist`:

  Object of class `"list"` storing all command-line used to execute external software

`input`:

  Object of class `"list"` storing data from each target defined in `inputvars`

`output`:

  Object of class `"list"` paths to final outputs files

`cwlfiles`:

  Object of class `"list"` paths to `input` and `CWL param` files

`inputvars`:

  Object of class `"list"` storing data from each `inputvars`

### Methods

[

  `signature(x = "SYSargs2")`: subsetting of class with bracket operator

[[

  `signature(x = "SYSargs2", i = "ANY", j = "missing")`: subsetting of class with bracket operator

[[<-

  `signature(x = "SYSargs2")`: replacement method for SYSargs2 class

$

  `signature(x = "SYSargs2")`: extracting slots elements by name

clt

  `signature(x = "SYSargs2")`: extracts data from `clt` slot

cmdlist

  `signature(x = "SYSargs2")`: extracts data from `cmdlist` slot

coerce

  `signature(from = "list", to = "SYSargs2")`: `as(list, "SYSargs2")`

cwlfiles

  `signature(x = "SYSargs2")`: extracts data from `cwlfiles` slot

infile1

  `signature(x = "SYSargs2")`: extracting paths to first FASTQ file

infile2

  `signature(x = "SYSargs2")`: extracting paths to second FASTQ file if data is PE

input

  `signature(x = "SYSargs2")`: extracts data from `input` slot

inputvars

  `signature(x = "SYSargs2")`: extracts data from `inputvars` slot

length

  `signature(x = "SYSargs2")`: extracts number of samples

modules

  `signature(x = "SYSargs2")`: extracts data from `modules` slot

names

  `signature(x = "SYSargs2")`: extracts slot names

output

  `signature(x = "SYSargs2")`: extracts data from `cmdlist` slot

show

  `signature(object = "SYSargs2")`: summary view of `SYSargs2` objects

sysargs2

  `signature(x = "SYSargs2")`: Coerce back to list `as(SYSargs2, "list")`

targets

  `signature(x = "SYSargs2")`: extract data from `targets` slot

targetsheader

  `signature(x = "SYSargs2")`: extracts data from `targetsheader` slot

wf

  `signature(x = "SYSargs2")`: extracts data from `wf` slot

yamlinput

  `signature(x = "SYSargs2")`: extracts data from `yamlinput` slot

### Author(s)

Daniela Cassol and Thomas Girke

### See Also

`loadWorkflow` and `renderWF` and `runCommandline` and `clusterRun`

### Examples

    showClass("SYSargs2")

    ## Construct SYSargs2 object from CWl param, CWL input, and targets files
    targets <- system.file("extdata", "targets.txt", package="systemPipeR")
    dir_path <- system.file("extdata/cwl/hisat2/hisat2-se", package="systemPipeR")
    WF <- loadWorkflow(targets=targets, wf_file="hisat2-mapping-se.cwl",
                      input_file="hisat2-mapping-se.yml", dir_path=dir_path)
    WF <- renderWF(WF, inputvars=c(FileName="_FASTQ_PATH1_", SampleName="_SampleName_"))
    WF
    names(WF); modules(WF); targets(WF)[1]; cmdlist(WF)[1:2]; output(WF)

    ## The subsetting operator '[' allows to select specific command-line
    cmdlist(WF)[1:2]

    ## Not run:
    ## Execute SYSargs2 on single machine
    WF <- runCommandline(args=WF)

    ## Execute SYSargs2 on multiple machines of a compute cluster. The following
    ## example uses the conf and template files for the Slurm scheduler. Please
    ## read the instructions on how to obtain the corresponding files for other schedulers.
    file.copy(system.file("extdata", ".batchtools.conf.R", package="systemPipeR"), ".")
    file.copy(system.file("extdata", "batchtools.slurm.tmpl", package="systemPipeR"), ".")
    resources <- list(walltime=120, ntasks=1, ncpus=4, memory=1024)
    reg <- clusterRun(args, FUN = runCommandline, conffile=".batchtools.conf.R", template="batchtools.slurm.tmpl", Njobs=18, runid="01", resourceList=resources)

    ## Monitor progress of submitted jobs
    getStatus(reg=reg)

    ## Updates the path in the object \code{output(WF)}
    WF <- output_update(WF, dir=FALSE, replace=TRUE, extension=c(".sam", ".bam"))

    ## Alignment stats
    read_statsDF <- alignStats(WF)
    read_statsDF <- cbind(read_statsDF[targets$FileName,], targets)
    write.table(read_statsDF, "results/alignStats.xls", row.names=FALSE, quote=FALSE, sep="\t")

    ## End(Not run)

[Package systemPipeR version 1.24.6 Index]