Dada2 not working

I am running this code:
qiime dada2 denoise-paired *
** --i-demultiplexed-seqs paired-end-demux.qza *

** --p-trunc-len-r 270 **
** --p-trunc-len-f 300 **
** --p-trim-left-f 6 **
** --p-trim-left-r 6 **
** --o-representative-sequences rep-seqs.qza **
** --o-table table.qza **
** --o-denoising-stats dada2-stats.qza **
** --verbose**

It generates this long error message:

Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: run_dada.R --input_directory /var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/forward --input_directory_reverse /var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/reverse --output_path /var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/output.tsv.biom --output_track /var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/track.tsv --filtered_directory /var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/filt_f --filtered_directory_reverse /var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/filt_r --truncation_length 300 --truncation_length_reverse 270 --trim_left 6 --trim_left_reverse 6 --max_expected_errors 2.0 --max_expected_errors_reverse 2.0 --truncation_quality_score 2 --min_overlap 12 --pooling_method independent --chimera_method consensus --min_parental_fold 1.0 --allow_one_off False --num_threads 1 --learn_min_reads 1000000

Warning message:
*package ‘optparse’ was built under R version 4.3.3 *
*R version 4.2.2 (2022-10-31) *
Loading required package: Rcpp
Error: package or namespace load failed for ‘Rcpp’ in library.dynam(lib, package, package.lib):

  • shared object ‘Rcpp.so’ not found*
    Error: package ‘Rcpp’ could not be loaded
    *5: stop(gettextf("package %s could not be loaded", sQuote(pkg)), *
  •   call. = FALSE, domain = NA)*
    

4: .getRequiredPackages2(pkgInfo, quietly = quietly)
3: library(dada2)
*2: withCallingHandlers(expr, warning = function(w) if (inherits(w, *

  •   classes)) tryInvokeRestart("muffleWarning"))*
    

1: suppressWarnings(library(dada2))
Traceback (most recent call last):

  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_dada2/_denoise.py", line 350, in denoise_paired*
  • run_commands([cmd])*
  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_dada2/_denoise.py", line 37, in run_commands*
  • subprocess.run(cmd, check=True)*
  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/subprocess.py", line 528, in run*
  • raise CalledProcessError(retcode, process.args,*
    subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/forward', '--input_directory_reverse', '/var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/reverse', '--output_path', '/var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/output.tsv.biom', '--output_track', '/var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/track.tsv', '--filtered_directory', '/var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/filt_f', '--filtered_directory_reverse', '/var/folders/th/6hmj39h16bx1znbmws_xvbsw0000gn/T/tmpz255odk5/filt_r', '--truncation_length', '300', '--truncation_length_reverse', '270', '--trim_left', '6', '--trim_left_reverse', '6', '--max_expected_errors', '2.0', '--max_expected_errors_reverse', '2.0', '--truncation_quality_score', '2', '--min_overlap', '12', '--pooling_method', 'independent', '--chimera_method', 'consensus', '--min_parental_fold', '1.0', '--allow_one_off', 'False', '--num_threads', '1', '--learn_min_reads', '1000000']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 520, in call*
  • results = self._execute_action(*
  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 581, in _execute_action*
  • results = action(*arguments)
  • File "", line 2, in denoise_paired*
  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 342, in bound_callable*
  • outputs = self.callable_executor(*
  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 576, in callable_executor*
  • output_views = self._callable(*view_args)
  • File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_dada2/_denoise.py", line 363, in denoise_paired*
  • raise Exception("An error was encountered while running DADA2"*
    Exception: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

Plugin error from dada2:

  • An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.*

I think its an issue with some of the R packages I installed but this should not be affecting the conda environment. But when i run which R it comes back as: /usr/local/bin/R

I have already tried deleting the conda environment and reinstalling.

Hello @J_Taylor,

We've seen issues like this a few times. Usually it isn't just R packages you installed causing problems, but R itself.

As you can see, even with your conda environment activate you are using R from outside the conda environment. Can you please do the following.

  1. With your QIIME 2 conda env active, run echo $PATH and post the result here
  2. post the contents of your .bashrc file here

With this information, it may be possible to see how/why the incorrect version of R is being used.

1 Like