writeTargetsout: Write updated targets out to file

Description Usage Arguments Value Author(s) See Also Examples

Description

Convenience write function for generating targets files with updated FileName columns containing the paths to files generated by input/output processes. These processes can be commandline- or R-based software. Typically, the paths to the inputs are stored in the targets infile (targetsin(args) for SYSargs objects or targets.as.df(targets(WF)) for SYSargs2 objects) and the outputs are stored in the targets outfile (targetsout(args) for SYSargs objects or output(WF)) for SYSargs2 objects. Note: by default the function cannot overwrite any existing files. If a file exists then the user has to explicitly remove it or set overwrite=TRUE.

Usage

1
writeTargetsout(x, file = "default", silent = FALSE, overwrite = FALSE, step = NULL, new_col=NULL, new_col_output_index=NULL, ...)

Arguments

x

Object of class SYSargs or SYSargs2.

file

Name and path of the output file. If set to "default" then the name of the output file will have the pattern 'targets_<software>.txt', where <software> will be what software(x) returns, when x is an object of class SYSargs. For an object of class SYSargs2, the output file will have the pattern 'targets_<software>_<step>.txt', where <software> will be the workflow name (cwlfiles(x)$cwl) and <step> will be the step chosen in the argument step.

silent

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

overwrite

If set to TRUE, existing files of same name will be overwritten.

step

Name or numeric position of the step in the workflow to write the output files. The names can be check running names(x$clt).

new_col

A vector of character strings of the new column name to add to target file.

new_col_output_index

A vector of numeric index positions of the file in SYSargs2 class output. It requires new_col definition.

...

To pass on additional arguments.

Value

Writes tabular targes files containing the header/comment lines from targetsheader(x) and the columns from targetsout(x).

Author(s)

Daniela Cassol and Thomas Girke

See Also

writeTargetsRef

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#########################################
## Examples with \code{SYSargs} object ##
#########################################
## Create SYSargs object
param <- system.file("extdata", "tophat.param", package="systemPipeR")
targets <- system.file("extdata", "targets.txt", package="systemPipeR")
args <- systemArgs(sysma=param, mytargets=targets)

## Not run: 
## Write targets out file
writeTargetsout(x=args, file="default")

## End(Not run)

##########################################
## Examples with \code{SYSargs2} object ##
##########################################
## Construct SYSargs2 object 
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

## Not run: 
## Write targets out file
names(WF$clt)
writeTargetsout(x=WF, file="default", step=1, new_col=c("sam_file"), new_col_output_index=c(1))

## End(Not run)

systemPipeR documentation built on Jan. 26, 2021, 2 a.m.