filter_trim: A wrapper of the function 'dada2::filterAndTrim()' to use in...

View source: R/targets_misc.R

filter_trimR Documentation

A wrapper of the function dada2::filterAndTrim() to use in targets pipeline

Description

lifecycle-maturing

This function filter and trim (with parameters passed on to dada2::filterAndTrim() function) forward sequences or paired end sequence if 'rev' parameter is set. It return the list of files to subsequent analysis in a targets pipeline.

Usage

filter_trim(
  fw = NULL,
  rev = NULL,
  output_fw = paste(getwd(), "/output/filterAndTrim_fwd", sep = ""),
  output_rev = paste(getwd(), "/output/filterAndTrim_rev", sep = ""),
  return_a_vector = FALSE,
  ...
)

Arguments

fw

(required) a list of forward fastq files

rev

a list of reverse fastq files for paired end trimming

output_fw

Path to output folder for forward files. By default, this function will create a folder "output/filterAndTrim_fwd" in the current working directory.

output_rev

Path to output folder for reverse files. By default, this function will create a folder "output/filterAndTrim_fwd" in the current working directory.

return_a_vector

(logical, default FALSE) If true, the return is a vector of path (usefull when used with targets::tar_targets(..., format="file"))

...

Other parameters passed on to dada2::filterAndTrim() function.

Value

A list of files. If rev is set, will return a list of two lists. The first list is a list of forward files, and the second one is a list of reverse files.

Author(s)

Adrien Taudière

See Also

dada2::filterAndTrim()

Examples

testFastqs_fw <- c(
  system.file("extdata", "sam1F.fastq.gz", package = "dada2"),
  system.file("extdata", "sam2F.fastq.gz", package = "dada2")
)
testFastqs_rev <- c(
  system.file("extdata", "sam1R.fastq.gz", package = "dada2"),
  system.file("extdata", "sam2R.fastq.gz", package = "dada2")
)

filt_fastq_fw <- filter_trim(testFastqs_fw, output_fw = tempdir())
derep_fw <- derepFastq(filt_fastq_fw[1])
derep_fw

filt_fastq_pe <- filter_trim(testFastqs_fw,
  testFastqs_rev,
  output_fw = tempdir("fw"),
  output_rev = tempdir("rev")
)
derep_fw_pe <- derepFastq(filt_fastq_pe[[1]])
derep_rv_pe <- derepFastq(filt_fastq_pe[[2]])
derep_fw_pe
derep_rv_pe

MiscMetabar documentation built on Oct. 8, 2024, 1:07 a.m.