Error running DADA2 in R (return code 1)

hello everyone, I have data from samples end paired demultiplexed and I'm trying to run the command of dada2 but I get error. Reading the forum I find similar cases but I still can not find a solution for this, I am using the virtual machine version qiime2-2019.4.

The command aplicated is the following:
qiime dada2 denoise-paired
--i-demultiplexed-seqs demux.qza
--p-trim-left-f 6
--p-trim-left-r 6
--p-trunc-len-f 272
--p-trunc-len-r 272
--o-table table.qza
--o-representative-sequences rep-seqs.qza
--o-denoising-stats denoising-stats.qza

The error message is:
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_paired.R /tmp/tmphkefebnm/forward /tmp/tmphkefebnm/reverse /tmp/tmphkefebnm/output.tsv.biom /tmp/tmphkefebnm/track.tsv /tmp/tmphkefebnm/filt_f /tmp/tmphkefebnm/filt_r 272 272 6 6 2.0 2 consensus 1.0 1 1000000

R version 3.5.1 (2018-07-02)
Loading required package: Rcpp
DADA2: 1.10.0 / Rcpp: 1.0.1 / RcppParallel: 4.4.2

  1. Filtering Error in (function (fn, fout, maxN = c(0, 0), truncQ = c(2, 2), truncLen = c(0, :
    Mismatched forward and reverse sequence files: 18008, 17509.
    Execution halted
    Traceback (most recent call last):
    File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2_dada2/_denoise.py", line 231, in denoise_paired
    run_commands([cmd])
    File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2_dada2/_denoise.py", line 36, in run_commands
    subprocess.run(cmd, check=True)
    File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['run_dada_paired.R', '/tmp/tmphkefebnm/forward', '/tmp/tmphkefebnm/reverse', '/tmp/tmphkefebnm/output.tsv.biom', '/tmp/tmphkefebnm/track.tsv', '/tmp/tmphkefebnm/filt_f', '/tmp/tmphkefebnm/filt_r', '272', '272', '6', '6', '2.0', '2', 'consensus', '1.0', '1', '1000000']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2cli/commands.py", line 311, in call
results = action(**arguments)
File "</home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/decorator.py:decorator-gen-451>", line 2, in denoise_paired
File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/qiime2/sdk/action.py", line 231, in bound_callable
output_types, provenance)
File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/qiime2/sdk/action.py", line 365, in callable_executor
output_views = self._callable(**view_args)
File "/home/qiime2/miniconda/envs/qiime2-2019.4/lib/python3.6/site-packages/q2_dada2/_denoise.py", line 246, in denoise_paired
" and stderr to learn more." % e.returncode)
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.

Annex the quality plots:

I thank you very much for your support and guidance

Hi @Francis,

Welcome!

It looks like DADA2 is failing because of your sequence quality, particularly on your reverse reads. My suggestion would be to use your forward reads alone (which is a common practice, even with shorter reads)and trim your forward reads as well where you see the clear drop in quality.

I might also discuss the read quality with your sequencing provider/center on the off chance they’d resequence for you.

Best,
Justine

hello justine, thank you for your prompt response. I will try to work only with the Forward data then. I’ll keep you informed. regards

Hi again, if it worked by using only the data from the Forward sequences, apparently the error was due to the low quality of the Reverse sequences. Thank you very much for the help @jwdebelius, now I will continue with the analysis.

Glad you got that working, @Francis!

Just for completeness sake, and to clarify for anyone else who receives this error:

The reverse read quality does look really bad and would cause issues, but this specific error is not actually caused by read quality, it is occurring because your forward and reverse sequence files have different numbers of reads.

This could be because the fastq data were already filtered for some reason, e.g., to remove low-quality sequences (unlikely, since the reverse reads look so bad), or it could be because you are using the wrong file! Just something you may want to double check in case you are using the wrong reverse file.

If you have the correct file, just proceed as you are (with the forward reads only), though you may want to figure out why the reads are mismatched for future sequencing runs that follow the same protocol, e.g., if there is some type of preliminary filtering being applied then you probably want to skip that step to avoid this error in the future (e.g., on runs that have higher quality reverse reads).

2 Likes

To follow up on this, the reverse sequences have fewer reads than the forward sequences --- this suggests (to me) that you might be dealing with an incomplete data transfer. I suggest double-checking that the files have transferred to completion (there are various ways of checking file integrity, my favorite is the md5sum).

3 Likes

Thank you very much @Nicholas_Bokulich and @thermokarst, your comments cleared all my doubts about the error, I will follow your suggestion to check the integrity of my files and make a better analysis. Best regards