run_cutadapt: Run Cutadapt

View source: R/run_cutadapt.R

run_cutadaptR Documentation

Run Cutadapt

Description

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

Usage

run_cutadapt(
  input1 = NULL,
  input2 = NULL,
  output1.trim = NULL,
  output2.trim = NULL,
  quality = NULL,
  nextseq = FALSE,
  minimum = NULL,
  trim.only = FALSE,
  cut.for = NULL,
  cut.rev = NULL,
  length = NULL,
  adapter1 = NULL,
  adapter2 = NULL,
  polyA = NULL,
  adapter.5.prime = NULL,
  maximum.error.rate = NULL,
  parallel = FALSE,
  cores = 4,
  execute = TRUE,
  cutadapt = NULL,
  version = FALSE
)

Arguments

input1

List of the paths to files containing to the forward reads

input2

List of the paths to files containing to the reverse reads

output1.trim

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

output2.trim

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

quality

The lower limit for the phred score

nextseq

Was the sequence data generated on a NextSeq 500, trims dark cycle bases appearing as high-quality G bases

minimum

The length at which a trimmed read will be discarded

trim.only

Only keep reads that have had adapters trimmed

cut.for

Remove the first 'n' bases form the 5' end of the forward read

cut.rev

Remove the first 'n' bases form the 5' end of the reverse read

length

Shorten each read down to a certain length

adapter1

Sequence for the adapter for the forward read

adapter2

Sequence for the adapter for the reverse read

polyA

Number of A's

adapter.5.prime

Sequence of te 5 prime adapter

maximum.error.rate

Maximum number of errors tolerated, default 0.1 or 10 percent

parallel

Run in parallel, default set to FALSE

cores

Number of cores/threads to use for parallel processing, default set to 4

execute

Whether to execute the commands or not, default set to TRUE

cutadapt

Path to the Cutadapt program, required

version

Returns the version number

Value

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

Examples

 ## Not run: 
 # Version number
 run_cutadapt(cutadapt = cutadapt.path,
                         version = TRUE)

# Trimmed reads directory
trimmed.reads.dir <- "trimmed_reads"
#Create the directory for the trimmed reads
dir.create(trimmed.reads.dir, showWarnings = FALSE)

read1.pattern <- "*_R1_001.fastq.gz$"
read2.pattern <- "*_R2_001.fastq.gz$"

reads.path <- "/export/buzz2/gpfrawdata/nextseq01/FastQ/2019/NeilBulleid/
               1466_NS205_0325_MarieAnnPringle_20190313"

mate1 <- list.files(path = reads.path,
                    pattern = read1.pattern,
                    full.names = TRUE)
mate1.trim <- paste(trimmed.reads.dir,(list.files(path = reads.path,
                                                 pattern = read1.pattern,
                                                 full.names = FALSE)), sep = "/")

mate2 <- list.files(path = reads.path,
                    pattern = read2.pattern,
                    full.names = TRUE)
mate2.trim <- paste(trimmed.reads.dir,(list.files(path = reads.path,
                                                 pattern = read2.pattern,
                                                 full.names = FALSE)), sep = "/")

# Single end
run_cutadapt(input1 = mate1,
             output1.trim = mate1.trim,
             quality = 25,
             minimum = 17,
             trim.only = TRUE,
             cut = 1,
             adapter1 = "AGATCGGAAGAGCACACGTCT",
             cutadapt = cutadapt.path)

# Paired end
run_cutadapt(input1 = mate1,
             input2 = mate2,
             output1.trim = mate1.trim,
             output2.trim = mate2.trim,
             quality = 25,
             minimum = 17,
             trim.only = TRUE,
             cut = 1,
             adapter1 = "AGATCGGAAGAGCACACGTCT",
             adapter1 = "AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT",
             cutadapt = cutadapt.path)
 
## End(Not run)


GrahamHamilton/pipelineTools documentation built on Dec. 8, 2024, 3:53 p.m.