preprocessReads {systemPipeR} | R Documentation

## Run custom read preprocessing functions

### Description

Applies custom read preprocessing functions to single-end or paired-end FASTQ files. The function uses the `FastqStreamer` function from the `ShortRead` package to stream through large files in a memory-efficient manner.

### Usage

    preprocessReads(args = NULL,
                    FileName1 = NULL, FileName2 = NULL,
                    outfile1 = NULL, outfile2 = NULL,
                    Fct, batchsize = 100000, overwrite = TRUE, ...)

### Arguments

`args` | Object of class `SYSargs` or `SYSargs2`.
`FileName1` | Path to input forward fastq file. Defaul is `NULL`.
`FileName2` | Path to input reverse fastq file. Defaul is `NULL`
`outfile1` | Path to output forward fastq file. Defaul is `NULL`
`outfile2` | Path to output reverse fastq file. Defaul is `NULL`
`Fct` | `character` string of custom read preprocessing function call where both the input and output needs to be an object of class `ShortReadQ`. The name of the input `ShortReadQ` object needs to be `fq`.
`batchsize` | Number of reads to process in each iteration by the internally used `FastqStreamer` function.
`overwrite` | If `TRUE` existing file will be overwritten.
`...` | To pass on additional arguments to the internally used `writeFastq` function.

### Value

Writes to files in FASTQ format. Their names are specified by `outpaths(args)`.

### Author(s)

Thomas Girke

### See Also

FastqStreamer

### Examples

    ## Preprocessing of single-end reads
    dir_path <- system.file("extdata/cwl/preprocessReads/trim-se", package="systemPipeR")
    targetspath <- system.file("extdata", "targets.txt", package="systemPipeR")
    trim <- loadWorkflow(targets=targetspath, wf_file="trim-se.cwl", input_file="trim-se.yml", dir_path=dir_path)
    trim <- renderWF(trim, inputvars=c(FileName="_FASTQ_PATH1_", SampleName="_SampleName_"))
    ## Not run:
    preprocessReads(args=trim[1], Fct="trimLRPatterns(Rpattern='GCCCGGGTAA', subject=fq)", batchsize=100000, overwrite=TRUE, compress=TRUE)

    ## End(Not run)

    ## Preprocessing of paired-end reads
    dir_path <- system.file("extdata/cwl/preprocessReads/trim-pe", package="systemPipeR")
    targetspath <- system.file("extdata", "targetsPE.txt", package="systemPipeR")
    trim <- loadWorkflow(targets=targetspath, wf_file="trim-pe.cwl", input_file="trim-pe.yml", dir_path=dir_path)
    trim <- renderWF(trim, inputvars=c(FileName1="_FASTQ_PATH1_", FileName2="_FASTQ_PATH2_", SampleName="_SampleName_"))
    trim
    ## Not run:
    preprocessReads(args=trim[1], Fct="trimLRPatterns(Rpattern='GCCCGGGTAA', subject=fq)", batchsize=100000, overwrite=TRUE, compress=TRUE)

    ## End(Not run)

[Package systemPipeR version 2.0.8 Index]