Dada2 Error: return code 1

Hello There,
I am using 6 samples-16S RNA metagenomics data for analysis. I am using 64 GB RAM system with 16 processors and running ubuntu in windows subsystem.

I have encountered with the (reuturn code 1) error in dada2 step. My data is already filtered and trimmed using cutadapt.

Please see the following command:

qiime dada2 denoise-paired
--i-demultiplexed-seqs IHF_37_paired-end-demux.qza
--p-trim-left-f 0
--p-trim-left-r 0
--p-trunc-len-f 0
--p-trunc-len-r 0
--o-representative-sequences IHF_37_rep-seqs-dada2.qza
--o-table table-dada2.qza
--o-denoising-stats stats-dada2.qza
--p-n-threads 12

I have installed qiime2 (version:2022)

Ichecked the error in the forum but unable to find the solution for my error.

Error:
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 /tmp/tmpwnwjuvx5/forward --input_directory_reverse /tmp/tmpwnwjuvx5/reverse --output_path /tmp/tmpwnwjuvx5/output.tsv.biom --output_track /tmp/tmpwnwjuvx5/track.tsv --filtered_directory /tmp/tmpwnwjuvx5/filt_f --filtered_directory_reverse /tmp/tmpwnwjuvx5/filt_r --truncation_length 0 --truncation_length_reverse 0 --trim_left 0 --trim_left_reverse 0 --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 12 --learn_min_reads 1000000 R version 4.1.3 (2022-03-10) Loading required package: Rcpp DADA2: 1.22.0 / Rcpp: 1.0.9 / RcppParallel: 5.1.5 2) Filtering Error in filterAndTrim(unfilts, filts, unfiltsR, filtsR, truncLen = c(truncLen, : These are the errors (up to 5) encountered in individual cores... Error in writeFastq(fqR, fout[[2]], "a", compress = compress) : failed to write record 44333 Error in writeFastq(fqF, fout[[1]], "a", compress = compress) : failed to write record 1334 Error in writeFastq(fqF, fout[[1]], "a", compress = compress) : failed to write record 1081 Error in writeFastq(fqF, fout[[1]], "a", compress = compress) : failed to write record 814 Error in writeFastq(fqR, fout[[2]], "a", compress = compress) : failed to write record 9275 Execution halted Traceback (most recent call last): File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 308, in denoise_paired run_commands([cmd]) File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 36, in run_commands subprocess.run(cmd, check=True) File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/tmp/tmpwnwjuvx5/forward', '--input_directory_reverse', '/tmp/tmpwnwjuvx5/reverse', '--output_path', '/tmp/tmpwnwjuvx5/output.tsv.biom', '--output_track', '/tmp/tmpwnwjuvx5/track.tsv', '--filtered_directory', '/tmp/tmpwnwjuvx5/filt_f', '--filtered_directory_reverse', '/tmp/tmpwnwjuvx5/filt_r', '--truncation_length', '0', '--truncation_length_reverse', '0', '--trim_left', '0', '--trim_left_reverse', '0', '--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', '12', '--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 "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2cli/commands.py", line 339, in call results = action(**arguments) File "", line 2, in denoise_paired File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound_callable outputs = self.callable_executor(scope, callable_args, File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in callable_executor output_views = self._callable(**view_args) File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 321, 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.

Hey @Pratibha_Kadam,

Have you run qiime demux summarize on your demultiplexed sequences artifact? If so, would you mind sharing the visualization here so we can take a look? If not, would you mind running the command first and then sharing the visualization?

Also, could you run qiime info and tell us the exact version of qiime that you have installed?

Thanks!

1 Like

Thank you for your response @colinvwood

Yes! I have demux.qzv, Please find attached.
demux.qzv (312.7 KB)

qiime info output:

(qiime2-2022) mmmuser_101@FMR-NGS:/mnt/e/Metagenomics/IHF_37$ qiime info System versions Python version: 3.8.13 QIIME 2 release: 2022.8 QIIME 2 version: 2022.8.1 q2cli version: 2022.8.0 Installed plugins alignment: 2022.8.0 composition: 2022.8.0 cutadapt: 2022.8.0 dada2: 2022.8.0 deblur: 2022.8.0 demux: 2022.8.0 diversity: 2022.8.0 diversity-lib: 2022.8.0 emperor: 2022.8.0 feature-classifier: 2022.8.0 feature-table: 2022.8.0 fragment-insertion: 2022.8.0 gneiss: 2022.8.0 longitudinal: 2022.8.0 metadata: 2022.8.0 phylogeny: 2022.8.0 quality-control: 2022.8.0 quality-filter: 2022.8.0 sample-classifier: 2022.8.0 taxa: 2022.8.0 types: 2022.8.0 vsearch: 2022.8.0

@Pratibha_Kadam,

It looks like you don't have any problems with the quality of your data.

You mentioned that you have 64gb of RAM available, and that you are allocating 12 cores for this step (--p-n-threads). Because each of these 12 threads/processes will have its own memory requirements, you may be running out of memory. You could try rerunning this step with say --p-n-threads set to to 2 or so. Because you only have six samples, this should still be plenty fast.

Let us know if this fixes the issue!

1 Like

I will run on 3 threads now and let you know.

Hope it works :crossed_fingers:

Thanks for the quick response.

@colinvwood
I tried with 3 threads, it did not work.
I tried with 2 even that did not work for me.

Well, I guess I have to run the data on 1 thread only.

FYI: For my 1 sample it took 10 days to finish the Dada2 run.

I ran Dada2 with one thread only.
Again it had given the (return code 1) error.

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 /tmp/tmp8t58a7i9/forward --input_directory_reverse /tmp/tmp8t58a7i9/reverse --output_path /tmp/tmp8t58a7i9/output.tsv.biom --output_track /tmp/tmp8t58a7i9/track.tsv --filtered_directory /tmp/tmp8t58a7i9/filt_f --filtered_directory_reverse /tmp/tmp8t58a7i9/filt_r --truncation_length 0 --truncation_length_reverse 0 --trim_left 0 --trim_left_reverse 0 --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.1.3 (2022-03-10) Loading required package: Rcpp DADA2: 1.22.0 / Rcpp: 1.0.9 / RcppParallel: 5.1.5 2) Filtering Error in writeFastq(fqR, fout[[2]], "a", compress = compress) : failed to write record 52358 Execution halted Traceback (most recent call last): File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 308, in denoise_paired run_commands([cmd]) File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 36, in run_commands subprocess.run(cmd, check=True) File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/tmp/tmp8t58a7i9/forward', '--input_directory_reverse', '/tmp/tmp8t58a7i9/reverse', '--output_path', '/tmp/tmp8t58a7i9/output.tsv.biom', '--output_track', '/tmp/tmp8t58a7i9/track.tsv', '--filtered_directory', '/tmp/tmp8t58a7i9/filt_f', '--filtered_directory_reverse', '/tmp/tmp8t58a7i9/filt_r', '--truncation_length', '0', '--truncation_length_reverse', '0', '--trim_left', '0', '--trim_left_reverse', '0', '--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 "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2cli/commands.py", line 339, in call results = action(**arguments) File "", line 2, in denoise_paired File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound_callable outputs = self.callable_executor(scope, callable_args, File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in callable_executor output_views = self._callable(**view_args) File "/home/mmmuser_101/anaconda3/envs/qiime2-2022/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 321, 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.

This error seems different than previous one.

Please let me know what to do ahead.

@Pratibha_Kadam,

It seems like the issue may not lie with dada2 or the quality of your data. Although you have 64gb of ram on your machine, because you are running a linux subsystem, you only have a subset of that memory available to you. A next step could be to confirm that you have a reasonable amount allocated to the virtual machine.

Because the error seems to be occurring while writing files, another possibility is that you are not running out of storage (disk space). You may also want to check that.

Thanks.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.