dada2-paired giving return code 1

Hello,

I have searched the forums and have found similar issues, but none were exactly the same, and the solutions offered in those threads did not work. I am running q2cli version 2025.4.0 in a conda on an HPC.

Here is the exact command I ran:

qiime dada2 denoise-paired \
--i-demultiplexed-seqs demux.qza \
--p-trim-left-f 0 --p-trim-left-r 0 \
--p-trunc-len-f 151 --p-trunc-len-r 151 \
--o-representative-sequences rep-seqs-dada2.qza \
--o-table table-dada2.qza \
--o-denoising-stats stats-dada2.qza --verbose

I tried it with minimal trimming (two bp from each end) and with no trimming, as shown above.

Here is the error message I have received:
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 /p/work1/tmp/madszi/tmpc_src91f/forward --input_directory_reverse /p/work1/tmp/madszi/tmpc_src91f/reverse --output_path /p/work1/tmp/madszi/tmpc_src91f/output.tsv.biom --output_track /p/work1/tmp/madszi/tmpc_src91f/track.tsv --filtered_directory /p/work1/tmp/madszi/tmpc_src91f/filt_f --filtered_directory_reverse /p/work1/tmp/madszi/tmpc_src91f/filt_r --truncation_length 150 --truncation_length_reverse 150 --trim_left 2 --trim_left_reverse 2 --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

R version 4.3.3 (2024-02-29)
Loading required package: Rcpp
DADA2: 1.30.0 / Rcpp: 1.0.14 / RcppParallel: 5.1.9
2) Filtering .............
3) Learning Error Rates
90961836 total bases in 614607 reads from 13 samples will be used for learning the error rates.
90961836 total bases in 614607 reads from 13 samples will be used for learning the error rates.
Error rates could not be estimated (this is usually because of very few reads).
Error in getErrors(err, enforce = TRUE) : Error matrix is NULL.
6: stop("Error matrix is NULL.")
5: getErrors(err, enforce = TRUE)
4: dada(drps, err = NULL, errorEstimationFunction = errorEstimationFunction,
selfConsist = TRUE, multithread = multithread, verbose = verbose,
MAX_CONSIST = MAX_CONSIST, OMEGA_C = OMEGA_C, ...)
3: learnErrors(filtsR, nreads = nreads.learn, multithread = multithread)
2: withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
1: suppressWarnings(learnErrors(filtsR, nreads = nreads.learn, multithread = multithread))
Traceback (most recent call last):
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 341, in denoise_paired
run_commands([cmd])
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/qiime2/plugin/util.py", line 65, in run_commands
subprocess.run(cmd, check=True)
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/p/work1/tmp/madszi/tmpc_src91f/forward', '--input_directory_reverse', '/p/work1/tmp/madszi/tmpc_src91f/reverse', '--output_path', '/p/work1/tmp/madszi/tmpc_src91f/output.tsv.biom', '--output_track', '/p/work1/tmp/madszi/tmpc_src91f/track.tsv', '--filtered_directory', '/p/work1/tmp/madszi/tmpc_src91f/filt_f', '--filtered_directory_reverse', '/p/work1/tmp/madszi/tmpc_src91f/filt_r', '--truncation_length', '150', '--truncation_length_reverse', '150', '--trim_left', '2', '--trim_left_reverse', '2', '--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 "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/q2cli/commands.py", line 529, in call
results = self._execute_action(
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/q2cli/commands.py", line 601, in _execute_action
results = action(**arguments)
File "", line 2, in denoise_paired
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
outputs = self.callable_executor(
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/qiime2/sdk/action.py", line 359, in callable_executor
output_views = self._callable(**view_args)
File "/p/app/projects/FUNAN/.conda/envs/qiime2amplicon_env/lib/python3.10/site-packages/q2_dada2/_denoise.py", line 354, 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.

From my search on the forums, I have gathered that the issue has something to do with the error matrix being null, but the suggested reasons for this don't apply (i.e., my dataset is more than one sample, I'm not overly trimming, and the quality of reads is good).

Hi @madszi,

Welcome to the :qiime2: forum! :waving_hand:

You're correct about the source of the error! So let's try to figure out why the error matrix might be null in this case. Would you mind sharing your demux file with me so I can take a closer look?

Cheers :lizard:

Hi Liz,

I can't share my demux file publicly, and I can't seem to figure out how to send a PM (there is no "message" button on your profile). How should I get this message to you?

Thanks,
Madelyn

Hi @madszi,

I just sent you a DM that you should be able to reply to. Let me know if you don't see it for some reason.

Hey @madszi,

Thanks for sharing your demux file! Could you please provide a bit more information about your data? Specifically:

  • What target region did you sequence (e.g., 16S V4, ITS1, etc.)?
  • What type of sequencer was used to generate your data (e.g., Illumina MiSeq, NovaSeq, etc.)?

Hi Liz,

I targeted the 16S V3 and V4 regions using an Illumina iSeq100.

Thanks,
Madelyn

Hey @madszi,

Thanks for providing that clarification! That explains the issue—your target region (16S V3-V4) typically produces an amplicon of around 460 bp. Since you sequenced using 150 bp paired-end reads, your combined read length is only 300 bp (150 bp forward + 150 bp reverse). This isn’t long enough to fully cover the V3-V4 region (i.e. the forward and reverse reads don’t overlap) which is why DADA2 can’t merge them.

In this case, you have a couple of options on how to proceed here:

  • Use only the forward reads for analysis (via denoise-single)
  • Re-sequence your samples with longer read lengths (e.g., 2x250 bp) if paired-end merging is critical for your analysis

Hope this helps! Feel free to follow up if you have any additional questions. Cheers :lizard:

1 Like