trim_reads: Trim low-quality bases and adapters using fastp

View source: R/03_read_filtering.R

trim_readsR Documentation

Trim low-quality bases and adapters using fastp

Description

Trim low-quality bases and adapters using fastp

Usage

trim_reads(
  sample_info = NULL,
  fastqdir = "results/01_FASTQ_files",
  filtdir = "results/03_filtered_FASTQ",
  qcdir = "results/QC_dir/fastp_stats",
  threads = 1,
  delete_raw = FALSE
)

Arguments

sample_info

Data frame of sample metadata created with the function create_sample_info.

fastqdir

Path to the directory where .fastq files will be stored. Default: results/01_FASTQ_files.

filtdir

Path to the directory where filtered .fastq files will be temporarily stored. After trimming, filtered reads are moved back to fastqdir. Default: results/03_filtered_FASTQ.

qcdir

Character indicating the path to the directory where output summary stats will be saved. Default: results/QC_dir/fastp_stats.

threads

Numeric indicating the number of threads to use in fastp. Default: 1.

delete_raw

Logical indicating whether to delete raw (unfiltered) FASTQ files after QC and filtering with fastp. It is recommended to delete raw files, as they use much memory and the useful information will be on filtered files, even if no filtering is performed. Default: FALSE.

Value

A 2-column data frame with run accession in the first column and fastp run status in the second column, with "OK" if it ran successfully and NA if a file could not be run.

Examples

data(sample_info)
fastqdir <- tempdir()
file.copy(system.file("extdata", "SRR1039508_1.fastq.gz", package = "bears"),
          fastqdir)
file.copy(system.file("extdata", "SRR1039508_2.fastq.gz", package = "bears"),
          fastqdir)
filtdir <- paste0(fastqdir, "/filtdir")
qcdir <- file.path(tempdir(), "qcdir")
if(!dir.exists(filtdir)) { dir.create(filtdir, recursive = TRUE) }
if(!dir.exists(qcdir)) { dir.create(qcdir, recursive = TRUE) }
if(fastp_is_installed()) {
    trim_status <- trim_reads(sample_info, fastqdir, filtdir, qcdir)
}

almeidasilvaf/gead documentation built on April 26, 2023, 3:47 p.m.