run_fastp: Run FastP

Description Usage Arguments Value Examples

View source: R/run_fastp.R

Description

Run the FastP tool to remove contaminating sequencing adapters and low quality bases.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
run_fastp(
  mate1 = NULL,
  mate2 = NULL,
  mate1.out = NULL,
  mate2.out = NULL,
  adapter1 = NULL,
  adapter2 = NULL,
  sample.name = NULL,
  out.dir = NULL,
  phred.quality = 15,
  min.length = 54,
  trim.front.1 = NULL,
  trim.tail.1 = NULL,
  trim.front.2 = NULL,
  trim.tail.2 = NULL,
  threads = 10,
  fastp = NULL,
  version = FALSE
)

Arguments

mate1

List of the paths to files containing to the forward reads

mate2

List of the paths to files containing to the reverse reads

mate1.out

List of paths to the files to write the trimmed forward reads

mate2.out

List of paths to the files to write the trimmed reverse reads

adapter1

Sequence for the adapter for the forward read

adapter2

Sequence for the adapter for the reverse read

sample.name

List of the sample names

out.dir

Name of the directory to write quality control results files. If NULL, which is the default, a directory named "fastP" is created in the current working directory.

phred.quality

The lower limit for the phred score

min.length

The length at which a trimmed read will be discarded

trim.front.1

Trim 'n' bases from front of read1, default is 0

trim.tail.1

Trim 'n' bases from tail of read1, default is 0

trim.front.2

Trim 'n' bases from front of read2, default is 0

trim.tail.2

Trim 'n' bases from tail of read2, default is 0

threads

Number of threads for FastP to use, default set to 10

fastp

Path to the FastP program, required

version

Returns the version number

Value

A file with the FastP commands and creates a directory of adapter and quality trimmed reads

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
32
33
34
35
 ## Not run: 
# Set the directory containing the raw fastq files
reads_path <- "raw_reads"
mate1 <- list.files(path = reads_path, pattern = "*_R1_001.fastq.gz$", full.names = TRUE)
mate2 <- list.files(path = reads_path, pattern = "*_R2_001.fastq.gz$", full.names = TRUE)

# Set the directory for writing the trimmend reads to
trimmed_reads_dir <- "trimmed_reads"
mate1.out <- paste(trimmed_reads_dir,
             (list.files(path = path, pattern = "*_R1_001.fastq.gz$", full.names = FALSE)),
             sep = "/")
mate2.out <- paste(trimmed_reads_dir,
             (list.files(path = path, pattern = "*_R2_001.fastq.gz$", full.names = FALSE)),
             sep = "/")

# Get the sample names from the first reads
sample_names <- unlist(lapply(strsplit
                (list.files(path = path, pattern = "*_R1_001.fastq.gz$", full.names = FALSE),"_"),
                `[[`, 1))

# Set the adapter sequences, these are for Illumina
adapter1 <- "AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC"
adapter2 <- "AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT"

fastp.cmds <- run_fastp(mate1 = mate1,
                        mate2 = mate2,
                        mate1.out = mate1.out,
                        mate2.out = mate2.out,
                        adapter1 = adapter1,
                        adapter2 = adapter2,
                        sample.name =  sample.names,
                        out.dir = fastp.results.dir,
                        fastp = "/software/bin/fastp")

## End(Not run)

GrahamHamilton/pipelineTools documentation built on June 19, 2021, 1:08 p.m.