benjjneb / dada2

Accurate sample inference from amplicon data with single nucleotide resolution
http://benjjneb.github.io/dada2/
GNU Lesser General Public License v3.0
470 stars 142 forks source link

Trouble with the quality filter and trim step #1382

Closed devinjones18 closed 5 months ago

devinjones18 commented 3 years ago

Hi!

I'm having trouble with the Quality filter and trim step and getting this error:

Error in filterAndTrim(fnFs, filtFs, fnRs, filtRs, truncLen = c(240, 160), : These are the errors (up to 5) encountered in individual cores... Error in validObject(.Object) : invalid class “SRFilterResult” object: superclass "Mnumeric" not defined in the environment of the object's class Error in validObject(.Object) : invalid class “SRFilterResult” object: superclass "Mnumeric" not defined in the environment of the object's class Error in validObject(.Object) : invalid class “SRFilterResult” object: superclass "Mnumeric" not defined in the environment of the object's class Error in validObject(.Object) : invalid class “SRFilterResult” object: superclass "Mnumeric" not defined in the environment of the object's class Error in validObject(.Object) : invalid class “SRFilterResult” object: superclass "Mnumeric" not defined in the environment of the object's class

This is my code from start to finish so far. Everything runs and looks good except for the last chunk (which is what gives me this error. I've also noticed that there are no files in my "filtered" folder.

library("devtools")
library("dada2")
library("BiocManager")

packageVersion("dada2")
getwd()
path <- "~/Desktop/Association517" 
list.files(path)
# Forward and reverse fastq filenames have format: SAMPLENAME_R1_001.fastq and SAMPLENAME_R2_001.fastq
fnFs <- sort(list.files(path, pattern="_R1_001.fastq", full.names = TRUE))
fnRs <- sort(list.files(path, pattern="_R2_001.fastq", full.names = TRUE))

length(fnFs) 
length(fnRs)

# Extract sample names, assuming filenames have format: SAMPLENAME_XXX.fastq
sample.names <- sapply(strsplit(basename(fnFs), "_"), `[`, 1)

#File Path Admin
filt_path <- file.path(path, "filtered")
plotQualityProfile(fnFs[1:2])
plotQualityProfile(fnFs[1:2])

**Quality Filter and Trim Assign the filenames for the filtered fastq.gz files.

# Place filtered files in filtered/subdirectory
filtFs <- file.path(path, "filtered", paste0(sample.names, "_F_filt.fastq.gz"))
filtRs <- file.path(path, "filtered", paste0(sample.names, "_R_filt.fastq.gz"))
names(filtFs) <- sample.names
names(filtRs) <- sample.names

#Double check
any(duplicated(c(fnFs, fnRs)))
any(duplicated(c(filtFs, filtRs)))

out <- filterAndTrim(fnFs, filtFs, fnRs, filtRs, truncLen=c(240,160),
              maxN=0, maxEE=c(2,2), truncQ=2, rm.phix=TRUE,
              compress=TRUE, multithread=TRUE)
head(out)
```**
benjjneb commented 3 years ago

Basically, some change in Matrix 1.3.3 broke a function dada2 was using in the ShortRead package. So you can either downgrade to Matrix 1.3.2, or use the current dada2 release where all calls to the offending code are removed.

Workaround by downgrading to Matrix 1.3.2: #212 (comment)

Or fix by updating to current dada2 release 1.20: #212 (comment)

devinjones18 commented 3 years ago

Just updated to dada2 1.20 and it worked! Thank you!