BigelowLab / edna-dada2

Maine eDNA dada2
0 stars 0 forks source link

truncLen numeric #21

Closed robinsleith closed 3 years ago

robinsleith commented 3 years ago

I tried passing two numbers separated by a comma as truncLen in preprocess but got the error below

ERROR [2021-10-11 16:56:45] truncLen can be character, bit if so must be 'auto' or a filename

btupper commented 3 years ago

Uh. You passed passed it like this? truncLen = c(100, 200) That's a guess and hope on my part; what do you mean by "two numbers separated by a comma"?

The error suggests that the input is being seen as a character - are you sure that you passed two numbers and not a character string?

robinsleith commented 3 years ago

I passed truncLen: c(230, 110)

robinsleith commented 3 years ago

I thought I had this working after fixing my incorrect passing of the numbers but just tried again and got this error. Files and yaml here /mnt/storage/data/edna/dada/projects/robin_foo/sam

Error in dada2::filterAndTrim(filelist$forward, ffilt, rev = if (norev) { : 
  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
Calls: main ... is.data.frame -> <Anonymous> -> %>% -> <Anonymous> -> <Anonymous>
In addition: Warning messages:
1: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead. 
2: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead. 
3: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead. 
4: In mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule,  :
  all scheduled cores encountered errors in user code
Execution halted
robinsleith commented 3 years ago

This problem also happens in auto mode so not limited to manual truncLen or this set of samples. traceback() below. Note that I abbreviate 17 and 10 as they are pretty long

26: stop(msg, ": ", errors, domain = NA)
25: validObject(.Object)
24: initialize(value, ...)
23: initialize(value, ...)
22: new("SRFilterResult", x, name = mkScalar(as.character(name)[length(name)]), 
        stats = data.frame(Name = as.character(name), Input = input, 
            Passing = passing, Op = op, stringsAsFactors = FALSE))
21: SRFilterResult(res, new("ScalarCharacter", .Data = "CleanNFilter"))
20: nFilter(maxN[[1]])(fqF)
19: withCallingHandlers(expr, warning = function(w) if (inherits(w, 
        classes)) tryInvokeRestart("muffleWarning"))
18: suppressWarnings(keep <- nFilter(maxN[[1]])(fqF) & nFilter(maxN[[2]])(fqR))
17: (function (fn, fout, maxN = c(0, 0), truncQ = c(2, 2), truncLen = c(0, 
        0), maxLen = c(Inf, Inf), minLen = c(20, 20), trimLeft = c(0, 
        0), trimRight = c(0, 0), minQ = c(0, 0), maxEE = c(Inf, Inf), 
        rm.phix = c(TRUE, TRUE), rm.lowcomplex = c(0, 0), matchIDs = FALSE, 
        orient.fwd = NULL, id.sep = "\\s", id.field = NULL, n = 1e+06, 
        OMP = TRUE, qualityType = "Auto", compress = TRUE, verbose = FALSE, 
...abbreviated here
16: .mapply(FUN, dots, MoreArgs)
15: mcmapply(fastqPairedFilter, mapply(c, fwd, rev, SIMPLIFY = FALSE), 
        mapply(c, filt, filt.rev, SIMPLIFY = FALSE), MoreArgs = list(truncQ = truncQ, 
            truncLen = truncLen, trimLeft = trimLeft, trimRight = trimRight, 
            maxLen = maxLen, minLen = minLen, maxN = maxN, minQ = minQ, 
            maxEE = maxEE, rm.phix = rm.phix, rm.lowcomplex = rm.lowcomplex, 
            orient.fwd = orient.fwd, matchIDs = matchIDs, id.sep = id.sep, 
            id.field = id.field, n = n, OMP = OMP, qualityType = qualityType, 
            compress = compress, verbose = verbose), mc.cores = ncores, 
        mc.silent = TRUE)
14: dada2::filterAndTrim(filelist$forward[i], ffilt[i], rev = if (norev) {
        NULL
    } else {
        filelist$reverse[i]
    }, filt.rev = rfilt[i], compress = compress, multithread = multithread, 
        truncLen = trunc_len, ...)
13: dplyr::as_tibble(., rownames = "name")
12: dada2::filterAndTrim(filelist$forward[i], ffilt[i], rev = if (norev) {
        NULL
    } else {
        filelist$reverse[i]
    }, filt.rev = rfilt[i], compress = compress, multithread = multithread, 
        truncLen = trunc_len, ...) %>% dplyr::as_tibble(rownames = "name")
11: FUN(X[[i]], ...)
10: lapply(seq_along(filelist[[1]]), function(i) {
abbreviated here...
9: list2(...)
8: dplyr::bind_rows(.)
7: lapply(seq_along(filelist[[1]]), function(i) {
       if (norev) {
           trunc_len <- truncLen$forward[i]
       }
       else {
           trunc_len <- c(truncLen$forward[i], truncLen$reverse[i])
       }
       if (verbose) 
           filter_and_trim_show(truncLen = trunc_len)
       dada2::filterAndTrim(filelist$forward[i], ffilt[i], rev = if (norev) {
           NULL
       }
       else {
           filelist$reverse[i]
       }, filt.rev = rfilt[i], compress = compress, multithread = multithread, 
           truncLen = trunc_len, ...) %>% dplyr::as_tibble(rownames = "name")
   }) %>% dplyr::bind_rows()
6: dadautils::filter_and_trim(input_files, output_path = filtN_path, 
       maxN = CFG$dada2_filterAndTrim$maxN, multithread = CFG$multithread, 
       truncLen = truncLen, cutoff_params = CFG$dada2_filterAndTrim$cutoff_params, 
       minLen = CFG$dada2_filterAndTrim$minLen, maxEE = CFG$dada2_filterAndTrim$maxEE, 
       truncQ = CFG$dada2_filterAndTrim$truncQ, rm.phix = CFG$dada2_filterAndTrim$rm.phix, 
       compress = CFG$dada2_filterAndTrim$compress, verbose = CFG$dada2_filterAndTrim$verbose, 
       save_results = FALSE)
5: is.data.frame(x)
4: stopifnot(is.data.frame(x))
3: write_delim(x, file, delim = ",", na = na, append = append, col_names = col_names, 
       quote = quote, escape = escape, eol = eol, num_threads = num_threads, 
       progress = progress)
2: readr::write_csv(., file.path(CFG$output_path, "filter_and_trim.csv"))
1: dadautils::filter_and_trim(input_files, output_path = filtN_path, 
       maxN = CFG$dada2_filterAndTrim$maxN, multithread = CFG$multithread, 
       truncLen = truncLen, cutoff_params = CFG$dada2_filterAndTrim$cutoff_params, 
       minLen = CFG$dada2_filterAndTrim$minLen, maxEE = CFG$dada2_filterAndTrim$maxEE, 
       truncQ = CFG$dada2_filterAndTrim$truncQ, rm.phix = CFG$dada2_filterAndTrim$rm.phix, 
       compress = CFG$dada2_filterAndTrim$compress, verbose = CFG$dada2_filterAndTrim$verbose, 
       save_results = FALSE) %>% readr::write_csv(file.path(CFG$output_path, 
       "filter_and_trim.csv")) at #11
btupper commented 3 years ago

Those two errors seem unrelated. The first means nothing to me, but I can work with the second. I'll investigate this afternoon.

btupper commented 3 years ago

The first error is showing up for others - I suspect related to the recent upgrade.

https://github.com/benjjneb/dada2/issues/1426

https://github.com/benjjneb/dada2/issues/1413

robinsleith commented 3 years ago

Hmm, I checked my session to be sure I was using 1.18 since Nicholas had recently changed the defaults but it was indeed still 1.18

btupper commented 3 years ago

Ooops - I see I have the same 1.18.

I tried running them one at a time and I get the same error. It doesn't matter which order I try to run them in...

Sample 3 
Error in validObject(.Object) : 
  invalid class “SRFilterResult” object: superclass "Mnumeric" not defined in the environment of the object's class
robinsleith commented 3 years ago

Could it be the new version of Rsubread?

btupper commented 3 years ago

Yes - it is exactly that. Rsubread depends upon an updated version of Matrix. dada2/1.18 depends upon the older version of Matrix. We are now forced to upgrade to dada2/1.20. I submitted a support ticket and copied you on it. Well, it was probably time...

robinsleith commented 3 years ago

Should I try with 1.2 and see what happens?

btupper commented 3 years ago

Well... you might want to wait until Nicholas installs the packages at the system level. Otherwise you will have to do a lot of local-library installs. Mayhem lurks there.

robinsleith commented 3 years ago

Isnt that process done? Or is there another set of packages to upgrade? https://github.com/BigelowLab/dadautils/issues/12#issuecomment-942644136

btupper commented 3 years ago

It's a move from R v4.0x to v4.10x. Plus a different module. So everything in tidyverse has to be reinstalled etc.

robinsleith commented 3 years ago

Sounds like a really good time... thanks for clarifying!

robinsleith commented 3 years ago

I just ran the 3step tutorial using 1.2 and it looks like everything worked! I am sure we will find some bugs before too long but this is a win! Thanks for working with Nicholas to get it done!