7.2 Filtering and trimming reads with the QuasR package

Quasr

library(QuasR)

# obtain a list of fastq file paths
fastqFiles <- system.file(package="ShortRead",
                          "extdata/E-MTAB-1147",
                          c("ERR127302_1_subset.fastq.gz",
                            "ERR127302_2_subset.fastq.gz")
)

# defined processed fastq file names
outfiles <- paste(tempfile(pattern=c("processed_1_",
                              "processed_2_")),".fastq",sep="")

# process fastq files
preprocessReads(fastqFiles, outfiles, 
                nBases=1,            # remove reads that have more than 1 N
                truncateEndBases=3,  # trim 3 bases from the end of the reads 
                Lpattern="ACCCGGGA", # Remove ACCCGGGA patern if it occurs at the start 
                minLength=40)        # remove reads shorter than 40 base-pairs