DADA2 troubleshooting_An error was encountered while running DADA2 in R (return code 1)

dada2
(Lei Li) #1

Hi everyone,
I created this new thread for the problems while I am running the DADA2 based on the “trim_remove_primers. qza” result which I got from the previous primer with different length I created. I used the following command to run DADA 2
qiime dada2 denoise-paired
–i-demultiplexed-seqs trimmed_remove_primers.qza
–p-trim-left-f 0
–p-trim-left-r 0
–p-trunc-len-f 0
–p-trunc-len-r 230
–o-representative-sequences try1-qza
–o-table try1-table.qza
–o-denoising-stats stats-dada2-try1.qza
–verbose

I got an error message:
Plugin error from dada2:An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

############################################################
Please review the entire output:
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/tmpmnr7sy5s/forward /tmp/tmpmnr7sy5s/reverse /tmp/tmpmnr7sy5s/output.tsv.biom /tmp/tmpmnr7sy5s/track.tsv /tmp/tmpmnr7sy5s/filt_f /tmp/tmpmnr7sy5s/filt_r 0 230 0 0 2.0 2 consensus 1.0 1 1000000

R version 3.4.1 (2017-06-30)
Loading required package: Rcpp
DADA2 R package version: 1.6.0

  1. Filtering …
  2. Learning Error Rates
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Not all sequences were the same length.
    Error: cannot allocate vector of size 95.4 Mb
    Execution halted
    Warning message:
    system call failed: Cannot allocate memory
    Traceback (most recent call last):
    File “/home/qiime2/miniconda/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_dada2/_denoise.py”, line 231, in denoise_paired
    run_commands([cmd])
    File “/home/qiime2/miniconda/envs/qiime2-2019.1/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.1/lib/python3.6/subprocess.py”, line 418, in run
    output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command ‘[‘run_dada_paired.R’, ‘/tmp/tmpmnr7sy5s/forward’, ‘/tmp/tmpmnr7sy5s/reverse’, ‘/tmp/tmpmnr7sy5s/output.tsv.biom’, ‘/tmp/tmpmnr7sy5s/track.tsv’, ‘/tmp/tmpmnr7sy5s/filt_f’, ‘/tmp/tmpmnr7sy5s/filt_r’, ‘0’, ‘230’, ‘0’, ‘0’, ‘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.1/lib/python3.6/site-packages/q2cli/commands.py”, line 274, in call
results = action(**arguments)
File “</home/qiime2/miniconda/envs/qiime2-2019.1/lib/python3.6/site-packages/decorator.py:decorator-gen-442>”, line 2, in denoise_paired
File “/home/qiime2/miniconda/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 231, in bound_callable
output_types, provenance)
File “/home/qiime2/miniconda/envs/qiime2-2019.1/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.1/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.

See above for debug info.
##################################################################
Can you please guide me to solve this issue? Thank you so much for your help. I really appreciated that !

1 Like
(Colin J Brislawn) #2

Hello Lei,

Thanks for posting your full error message. Did you read the error message looking for clues?

Did you see the section that said

Not all sequences were the same length.
Not all sequences were the same length.
Not all sequences were the same length.
Not all sequences were the same length.

… Are your sequences all the same length? :thinking:


Joking aside, you can use this plugin to trim your reads so they are all the same length:
https://docs.qiime2.org/2019.4/plugins/available/cutadapt/trim-paired/

Let me know if that helps, and keep posting those error messages!

Colin

(Lei Li) #3

Hello Colin,

Thank you so much for your reply @colinbrislawn
Initially I also thought it is the length problem. The length of my raw sequence is the same 251 nts. Since the primer in my sequence had slightly different length as I post before in this remove primer with different length. I should get different length for sure. But I do not know how to fix this issues.
But after read more post in the forum and read the error message more carefully. I think the important part of the error message is:
########################################
Error: cannot allocate vector of size 95.4 Mb
Execution halted
Warning message:
system call failed: Cannot allocate memory
Traceback (most recent call last):
#########################################
It seems that the actually error is coming from out of memory which is a common issue in DADA2. So I followed this DADA2 issue in R. I assigned more RAM to the VM (from 4MB to 12 MB) and also decrease the --p-n-reads-learn to 100000.
After doing all these, no error message appeared and I can go through the DADA2 step completely. I got the results finally!

But after merging, for some sequence I only get small read sleft. For one sample, after merging, 0 left.
I totally have 89 samples. However, after merging, 46 of them had less than 500 reads.
I attached the qzv file before doing denoised step, can you please have a look. Based on these quality plot I used (–p-trunc-len-f 0 –p-trunc-len-r 230) in the DADA 2 step. I know that I should probably play around this values and see how the merged reads changes. And I also think about just try the forward and see the results. Can you please give me some suggestions for increasing the merged reads?

One more thing I want to ask is the sequencing length. I think it is fine to have different sequence length for DADA2 denoise step as mentioned in this thread. But why when I run it, DADA2 keep reporting Not all sequences were the same length? Is this message just trying to inform me that I have different length in the sequence. So this different length won’t hurt the denoise step?? Can you please help me with this question.
trimmed_remove_primers.qzv (295.9 KB)

Thank you!!

(Colin J Brislawn) #5

Good morning,

I’m glad you got this working! It sounds like you are making good progress.

Sounds like Mehrbod is helping you in that other thread, so you can post more questions over there. I think he has answered more of your questions.

Keep up the good work! :qiime2:

Colin

(Lei Li) #6

Good morning Colin,
Thank you for your reply @colinbrislawn . I did change the dada 2 parameter and get the good merged results.
I have follow up question but will post them over the previous thread I created.

Best,
Lei

2 Likes
How to remove primer with different length