# Filtered files to go into new subdirectory
filtFs <- file.path(path, "filtered", paste0(sample.names, "_F_filt.fastq")) # to write filtered F reads into new file with provided suffix
filtRs <- file.path(path, "filtered", paste0(sample.names, "_R_filt.fastq")) # to write filtered R reads into new file with provided suffix
# Standard filtering parameters: maxN=0 (DADA2 requirement), truncQ=2, rm.phix=TRUE and maxEE=2
# Additional argument for trimming 22-nt primer sequences from start of sequences
out <- filterAndTrim(fnFs, filtFs, fnRs, filtRs,
trimLeft = c(17,21), truncLen=c(275,225),
maxN=0, maxEE=2, truncQ=2, rm.phix=TRUE,
compress=TRUE, multithread=TRUE)
head(out) # removes ~XX% reads