writeTargetsout.Rd
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
.
writeTargetsout(x, file = "default", silent = FALSE, overwrite = FALSE, step = NULL, new_col=NULL, new_col_output_index=NULL, remove=FALSE, ...)
Object of class SYSargs
or SYSargs2
.
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 (files(x)$cwl
) and <step> will be the step chosen in the argument step
.
If set to TRUE
, all messages returned by the function will be suppressed.
If set to TRUE
, existing files of same name will be overwritten.
Name or numeric position of the step in the workflow to write the output files. The names can be check running names(x$clt)
.
A vector of character strings of the new column name to add to target file.
A vector of numeric index positions of the file in SYSargs2
class output
. It requires new_col
definition.
To remove the original columns. Default is FALSE
.
To pass on additional arguments.
Writes tabular targes files containing the header/comment lines from targetsheader(x)
and the columns from targetsout(x)
.
writeTargetsRef
##########################################
## Examples with \code{SYSargs2} object ##
##########################################
## Construct SYSargs2 object
targets <- system.file("extdata", "targets.txt", package="systemPipeR")
dir_path <- system.file("extdata/cwl", package="systemPipeR")
WF <- loadWorkflow(targets=targets, wf_file="hisat2/hisat2-mapping-se.cwl",
input_file="hisat2/hisat2-mapping-se.yml", dir_path=dir_path)
WF <- renderWF(WF, inputvars=c(FileName="_FASTQ_PATH1_", SampleName="_SampleName_"))
WF
#> Instance of 'SYSargs2':
#> Slot names/accessors:
#> targets: 18 (M1A...V12B), targetsheader: 4 (lines)
#> modules: 1
#> wf: 0, clt: 1, yamlinput: 7 (inputs)
#> input: 18, output: 18
#> cmdlist: 18
#> Sub Steps:
#> 1. hisat2-mapping-se (rendered: TRUE)
#>
#>
## Write targets out file
names(WF$clt)
#> [1] "hisat2-mapping-se.cwl"
writeTargetsout(x=WF, file="default", step=1, new_col=c("sam_file"), new_col_output_index=c(1))
#> Written content of 'targetsout(x)' to file: targets_hisat2-mapping-se.txt