"SYSargs2"SYSargs2-class.RdSYSargs2 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 loadWF 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. 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 can be created by calls of the form new("SYSargs2", ...).
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 parameters file
clt:Object of class "list" storing data from each CommandLineTool
substep in the Workflow or the single codeCommandLineTool CWL parameters file
yamlinput:Object of class "list" storing data from input (*.yml) 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
files:Object of class "list" paths to input and CWL parameters files
inputvars:Object of class "list" storing data from each inputvars
cmdToCwl:Object of class "list" storing data from each cmdToCwl
status:Object of class "list" storing data from each status
internal_outfiles:Object of class "list" storing raw data from each output
Subsetting of class with bracket operator.
Subsetting of class with bracket operator.
Replacement method for "SYSargs2" class.
Extracting slots elements by name.
Extracts number of samples.
Extracts slot names.
Summary view of SYSargs2 objects.
signature(from = "list", to = "SYSargs2"): as(list, "SYSargs2")
signature(from = "SYSargs2", to = "list")as(SYSargs2, "list")
signature(from = "SYSargs2", to = "DataFrame"): as(x, "DataFrame"); for targets slot.
Coerce back to list as(SYSargs2, "list")
Extract data from targets slot.
Extracts data from targetsheader slot.
Extracts data from modules slot.
Extracts data from wf slot.
Extracts data from clt slot.
Extracts data from yamlinput slot.
Extracts data from cmdlist slot.
Extracts data from input slot.
Extracts data from cmdlist slot.
Extracts data from files slot.
Extracts data from inputvars slot.
Extracts data from cmdToCwl slot.
Extracts data from status slot.
extracting paths to first FASTQ file.
extracting paths to second FASTQ file if data is PE.
Extracts baseCommand from command-line used to execute external software.
Extracts all samples names.
Replacement method for yamlinput slot input.
loadWF and renderWF and runCommandline and clusterRun
showClass("SYSargs2")
#> Class "SYSargs2" [package "systemPipeR"]
#>
#> Slots:
#>
#> Name: targets targetsheader modules wf
#> Class: list list list list
#>
#> Name: clt yamlinput cmdlist input
#> Class: list list list list
#>
#> Name: output files inputvars cmdToCwl
#> Class: list list list list
#>
#> Name: status internal_outfiles
#> Class: list list
## Construct SYSargs2 object from CWl param, CWL input, and targets files
targetspath <- system.file("extdata/cwl/example/targets_example.txt", package="systemPipeR")
dir_path <- system.file("extdata/cwl", package="systemPipeR")
WF <- loadWorkflow(targets=targetspath,
wf_file="example/workflow_example.cwl",
input_file="example/example.yml",
dir_path=dir_path)
WF <- renderWF(WF, inputvars=c(Message = "_STRING_", SampleName = "_SAMPLE_"))
WF
#> Instance of 'SYSargs2':
#> Slot names/accessors:
#> targets: 3 (M1...M3), targetsheader: 1 (lines)
#> modules: 0
#> wf: 1, clt: 1, yamlinput: 3 (inputs)
#> input: 3, output: 3
#> cmdlist: 3
#> Sub Steps:
#> 1. echo (rendered: TRUE)
#>
#>
## Methods
names(WF)
#> [1] "targets" "targetsheader" "modules"
#> [4] "wf" "clt" "yamlinput"
#> [7] "cmdlist" "input" "output"
#> [10] "files" "inputvars" "cmdToCwl"
#> [13] "status" "internal_outfiles"
length(WF)
#> [1] 3
baseCommand(WF)
#> [1] "echo"
SampleName(WF)
#> [1] "M1" "M2" "M3"
## Accessors
targets(WF)
#> $M1
#> $M1$Message
#> [1] "Hello World!"
#>
#> $M1$SampleName
#> [1] "M1"
#>
#>
#> $M2
#> $M2$Message
#> [1] "Hello USA!"
#>
#> $M2$SampleName
#> [1] "M2"
#>
#>
#> $M3
#> $M3$Message
#> [1] "Hello Bioconductor!"
#>
#> $M3$SampleName
#> [1] "M3"
#>
#>
targetsheader(WF)
#> $targetsheader
#> [1] "# Project ID: SPR Example"
#>
modules(WF)
#> character(0)
yamlinput(WF)
#> $message
#> [1] "_STRING_"
#>
#> $SampleName
#> [1] "_SAMPLE_"
#>
#> $results_path
#> $results_path$class
#> [1] "Directory"
#>
#> $results_path$path
#> [1] "./results"
#>
#>
cmdlist(WF)
#> $M1
#> $M1$echo
#> [1] "echo Hello World! > results/M1.txt"
#>
#>
#> $M2
#> $M2$echo
#> [1] "echo Hello USA! > results/M2.txt"
#>
#>
#> $M3
#> $M3$echo
#> [1] "echo Hello Bioconductor! > results/M3.txt"
#>
#>
input(WF)
#> $M1
#> $M1$Message
#> [1] "Hello World!"
#>
#> $M1$SampleName
#> [1] "M1"
#>
#>
#> $M2
#> $M2$Message
#> [1] "Hello USA!"
#>
#> $M2$SampleName
#> [1] "M2"
#>
#>
#> $M3
#> $M3$Message
#> [1] "Hello Bioconductor!"
#>
#> $M3$SampleName
#> [1] "M3"
#>
#>
output(WF)
#> $M1
#> $M1$echo
#> [1] "results/M1.txt"
#>
#>
#> $M2
#> $M2$echo
#> [1] "results/M2.txt"
#>
#>
#> $M3
#> $M3$echo
#> [1] "results/M3.txt"
#>
#>
files(WF)
#> $cwl
#> [1] "example/workflow_example.cwl"
#>
#> $yml
#> [1] "example/example.yml"
#>
#> $dir_path
#> [1] "/home/runner/work/systemPipeR/systemPipeR/inst/extdata/cwl"
#>
#> $steps
#> [1] "echo"
#>
#> $cltpaths
#> example
#> "/home/runner/work/systemPipeR/systemPipeR/inst/extdata/cwl/example/example.cwl"
#>
#> $output_names
#> example/example.cwl
#> "string"
#>
#> $targets
#> [1] "/home/runner/work/systemPipeR/systemPipeR/inst/extdata/cwl/example/targets_example.txt"
#>
#> $id
#> [1] "SampleName"
#>
inputvars(WF)
#> $Message
#> [1] "_STRING_"
#>
#> $SampleName
#> [1] "_SAMPLE_"
#>
cmdToCwl(WF)
#> list()
status(WF)
#> $status.summary
#> [1] "Pending"
#>
#> $status.completed
#> Targets Total_Files Existing_Files Missing_Files echo
#> M1 M1 1 0 1 Pending
#> M2 M2 1 0 1 Pending
#> M3 M3 1 0 1 Pending
#>
#> $status.time
#> Targets time_start time_end
#> M1 M1 <NA> <NA>
#> M2 M2 <NA> <NA>
#> M3 M3 <NA> <NA>
#>
## The subsetting operator '[' allows to select specific command-line/sample
WF2 <- WF[1:2]
if (FALSE) {
## Execute SYSargs2 on single machine
WF2 <- runCommandline(WF2)
}
if (FALSE) {
## 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(WF, FUN = runCommandline, conffile=".batchtools.conf.R",
template="batchtools.slurm.tmpl", Njobs=2, runid="01", resourceList=resources)
## Monitor progress of submitted jobs
getStatus(reg=reg)
}