SYSargsList-class: Class '"SYSargsList"'

SYSargsList-classR Documentation

Class "SYSargsList"

Description

SYSargsList S4 class is a list-like container where each instance stores all the input/output paths and parameter components required for a particular data analysis step based on command-line- or R-based software.

SYSargsList instances are constructed by the SYSargsList function.

Usage

## Accessors

stepsWF(x)
statusWF(x)
targetsWF(x)
outfiles(x)
SE(x, ...)
dependency(x)
projectInfo(x)
runInfo(x)

## Methods

cmdlist(x, ...)
codeLine(x, ...)
SampleName(x, ...)
stepName(x)
baseCommand(x, ...)
targetsheader(x, ...)
yamlinput(x, ...)
viewEnvir(x, silent = FALSE)
copyEnvir(x, list = character(), new.env = globalenv(), silent = FALSE)
addResources(x, step, resources)

## Subset Methods

subset(x, ...)
getColumn(x, step, position = c("outfiles", "targetsWF"), column = 1, 
          names = SampleName(x, step))

## Replacement

appendStep(x, after = length(x), ...) <- value
yamlinput(x, paramName, ...) <- value
replaceStep(x, step, step_name = "default") <- value
renameStep(x, step, ...) <- value
dependency(x, step, ...) <- value
appendCodeLine(x, after = length(x), ...) <- value
replaceCodeLine(x, line, ...) <- value
updateColumn(x, step, position = c("outfiles", "targetsWF")) <- value

Arguments

x

An instance of class SYSargsList.

step

character or numeric. Workflow step name or position index.

silent

If set to TRUE, all messages returned by the function will be suppressed.

list

a character vector naming objects to be copyied from the enviroment.

new.env

An environment to copy to. Default is globalenv().

resources

List for reserving for each cluster job sufficient computing resources including memory (Megabyte), number of nodes (Int), CPU cores, walltime (Minutes), etc. It is necessary two additional files: conffile and template. conffile is the path to configuration file (default location ./.batchtools.conf.R). This file contains in its simplest form just one command, such as this line for the scheduler: cluster.functions <- makeClusterFunctionsSlurm(template="batchtools.slurm.tmpl"). For more detailed information visit this page: https://mllg.github.io/batchtools/index.html. template The template files for a specific queueing/scheduling systems can be downloaded from here: https://github.com/mllg/batchtools/tree/master/inst/templates. Slurm, PBS/Torque, and Sun Grid Engine (SGE) templates are provided within the package demo data.

position

character. Options are "outfiles" or "targetsWF" slots.

column

character or numeric. Which column will be subset from the position argument.

names

character vector. Names of the workflow step.

after

A subscript, after which the values are to be appended.

paramName

character. Input name from yamlinput(x), which value should be replaced.

step_name

character with the new step name. Default value will automatically give a name: step_<step index position>.

line

numeric. Index position of the code line to be added or replaced.

value

object containing the values to be replaced to SYSargsList. Values may be of the same class as the orginal values. For updateColumn<- a DataFrame must have the same rows as the original DataFrame. However, if there is no column/rows in the original DataFrame, the new DataFrame will replace the empty one. If there is a non-empty DataFrame, any existing columns with the same name as this new DataFrame will be replaced. Any columns that do not exist in the original DataFrame will be added to the original DataFrame.

...

Further arguments to be passed to or from other methods.

Objects from the Class

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

Slots

stepsWF:

Object of class "list" storing all the steps objects of the workflow. Each step can either be SYSargs2 or LineWise.

statusWF:

Object of class "list" storing all the success and failure of each step in the workflow.

targetsWF:

Object of class "list" storing all the targets DataFrame for each step in the workflow. For the LineWise steps, a DataFrame with 0 rows and 0 columns will be displayed.

outfiles:

Object of class "list" storing all the output DataFrame for each step in the workflow. For the LineWise steps, a DataFrame with 0 rows and 0 columns will be displayed.

SE:

Object of class "list" storing all the SummarizedExperiment objects in the workflow.

dependency:

Object of class "list" storing all the dependency graphs in the workflow.

projectInfo:

Object of class "list" storing all the projectInfo information of the workflow.

runInfo:

Object of class "list" storing all the runInfo information of each step in the workflow.

targets_connection:

Object of class "list" storing all targets files connection in the workflow.

Methods

[

signature(x = "SYSargsList", i = "ANY", j = "ANY", drop = "ANY"): subsetting of class with bracket operator

[[

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

$

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

coerce

signature(from = "list", to = "SYSargsList"): as(list, "SYSargsList")

coerce

signature(from = "SYSargsList", to = "list"): as(SYSargsList, "list")

sysargslist

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

length

signature(x = "SYSargsList"): extracts number of SYSargsList steps

names

signature(x = "SYSargsList"): extracts slot names

show

signature(object = "SYSargsList"): summary view of SYSargsList steps

stepsWF

signature(x = "SYSargsList"): extract data from stepsWF slot

statusWF

signature(x = "SYSargsList"): extract data from statusWF slot

targetsWF

signature(x = "SYSargsList"): extract data from targetsWF slot

outfiles

signature(x = "SYSargsList"): extract data from outfiles slot

SE

signature(x = "SYSargsList"): extract data from SE slot

dependency

signature(x = "SYSargsList"): extract data from dependency slot

projectInfo

signature(x = "SYSargsList"): extract data from projectInfo slot

runInfo

signature(x = "SYSargsList"): extract data from runInfo slot

cmdlist

signature(x = "SYSargsList", ...): extracts data from cmdlist slot for each SYSargs2 step

codeLine

signature(x = "SYSargsList", step): extracts data from codeLine slot for LineWise step

SampleName

signature(x = "SYSargsList", step): extracts Sample ID from SYSargs2 instance step

stepName

signature(x = "SYSargsList"): extracts steps names from workflow instance

baseCommand

signature(x = "SYSargsList", step): extracts baseCommand from SYSargs2 instance step

targetsheader

signature(x = "SYSargsList", step): extracts targetsheader from SYSargs2 instance step

yamlinput

signature(x = "SYSargsList", step): extracts data from yamlinput slot for each SYSargs2 step

viewEnvir

signature(x = "SYSargsList", silent = FALSE): return a vector of character strings giving the names of the objects in the SYSargsList environment

copyEnvir

signature(x = "SYSargsList", list = character(), new.env = globalenv(), silent = FALSE): copy of the contents or select objects from SYSargsList environment and place them into new.env

addResources

signature(x = "SYSargsList", step, resources): Adds the computing resources for one or multiple steps in the workflow. If the particular step(s) is set to be executed "management section," when the resources is added, the step(s) will be executed on the "compute section."

getColumn

signature(x = "SYSargsList", step, position = c("outfiles", "targetsWF"), column = 1, names = SampleName(x, step)): extracts the information for targetsWF or outfiles slots. The information can be used in an R code downstream

[[<-

signature(x = "SYSargsList", i = "ANY", j = "ANY", value = "ANY"): replacement method for SYSargsList class

appendStep<-

signature(x = "SYSargsList", after = length(x)): insert the SYSargsList or LineWise object onto x at the position given by after

yamlinput<-

signature(x = "SYSargsList", step, paramName ): replace a value in the yamlinput slot for a specific step instance

replaceStep<-

signature(x = "SYSargsList", step, step_name = "default"): replace a specific step in the workflow instance

renameStep<-

signature(x = "SYSargsList"): rename a stepName in the workflow instance

dependency<-

signature(x = "SYSargsList", step): replace dependency graph for a specific step instance

appendCodeLine<-

signature(x = "SYSargsList", step, after = length(x)): insert the R code in a specific step at the position given by after

replaceCodeLine<-

signature(x = "SYSargsList", step, line): replace the R code in a specific step at the position given by line

updateColumn<-

signature(x = "SYSargsList", step, position = c("outfiles", "targetsWF")): update or add a new column in targetsWF or outfiles slots

Author(s)

Daniela Cassol and Thomas Girke

See Also

SYSargs2, LineWise, and SPRproject

Examples

sal <- SPRproject(overwrite=TRUE)
targetspath <- system.file("extdata/cwl/example/targets_example.txt", 
                            package="systemPipeR")

## Constructor and `appendStep<-`
appendStep(sal) <- SYSargsList(step_name = "echo", 
                               targets=targetspath, dir=TRUE,
                               wf_file="example/workflow_example.cwl", 
                               input_file="example/example.yml", 
                               dir_path = system.file("extdata/cwl", 
                               package="systemPipeR"),
                               inputvars = c(Message = "_STRING_",
                               SampleName = "_SAMPLE_"))
                               
appendStep(sal) <- LineWise(code = {
                            hello <- lapply(getColumn(sal, step=1, 'outfiles'), function(x) yaml::read_yaml(x))
                            }, 
                            step_name = "R_read", 
                            dependency = "echo")
sal 

length(sal)
names(sal)

## Accessors

stepsWF(sal)
statusWF(sal)
targetsWF(sal)
outfiles(sal)
SE(sal)
dependency(sal)
projectInfo(sal)
runInfo(sal)

## Methods

cmdlist(sal, step=1, targets=1:2) ## SYSargs2 step
codeLine(sal, step=2) ## LineWise step
SampleName(sal, step="echo")
stepName(sal)
baseCommand(sal, 1) ## SYSargs2 step
targetsheader(sal, step=1) ## SYSargs2 step
yamlinput(sal, step=1) ## SYSargs2 step
viewEnvir(sal)
copyEnvir(sal, list = character(), new.env = globalenv())

resources <- list(conffile= system.file("extdata/.batchtools.conf.R", 
                            package="systemPipeR"),
                  template= system.file("extdata/batchtools.slurm.tmpl", 
                            package="systemPipeR"),
                  Njobs=3, ## Usually, the samples number
                  walltime=60, ## minutes
                  ntasks=1,
                  ncpus=4, 
                  memory=1024 ## Mb
)
addResources(sal, 1, resources= resources)

## Subset Methods

sal_sub <- subset(sal, subset_steps=1, input_targets=1:2, keep_steps = TRUE)
sal_sub
targetsIn <- getColumn(sal, step=1, position = c("outfiles"))
targetsIn

## Replacement
renameStep(sal, step=1) <- "new_echo"
dependency(sal, step=2) <- "new_echo"
updateColumn(sal, step=2, position = c("targetsWF")) <- data.frame(targetsIn)
targetsWF(sal)

replaceStep(sal, step=2) <- LineWise(code = {
                            hello <- "Printing a new message"
                            }, 
                            step_name = "R_hello", 
                            dependency = "new_echo")
codeLine(sal)
yamlinput(sal, step=1, paramName="results_path") <- list(results_path=list(
                                            class="Directory", path="./data"))
cmdlist(sal, step = 1, targets = 1)
appendCodeLine(sal, step=2, after = 0) <- "log <- log(10)"
codeLine(sal, 2)
replaceCodeLine(sal, step=2, line=1) <- LineWise(code = {
                            log <- log(50)
                            })
codeLine(sal, 2)

tgirke/systemPipeR documentation built on March 27, 2024, 11:31 p.m.