# An error was encountered while running DADA2 in R (return code 1); Error in err\[c(1, 6, 11, 16), \] \<- 1

**URL:** https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311
**Category:** User Support
**Tags:** dada2
**Created:** [August 29, 2019, 2:21pm UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311 "2019-08-29T14:21:49Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![carolhuaxia](https://forum.qiime2.org/user_avatar/forum.qiime2.org/carolhuaxia/32/5635_2.png) [@carolhuaxia](https://forum.qiime2.org/u/carolhuaxia)
#### Post date: [August 29, 2019, 2:21pm UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/1 "2019-08-29T14:21:49Z")

</div>

I extract 16S seqs from metagenome seq data. Then I use qiime(qiime2-2019.7) to analysis. I encountered error when running **dada2 denoise-paired** step.

here is my command:

```shell
qiime dada2 denoise-paired 
    --i-demultiplexed-seqs ./meta3_16s.qza \
    --p-trunc-len-f 140 \
    --p-trunc-len-r 138 \
    --o-representative-sequences ./rep-seqs-dada2.qza \
    --o-table ./table-dada2.qza \
    --o-denoising-stats ./denoising-stats.qza \
    --output-dir ./temp \
    --p-n-threads 6 \
    --verbose

```

This returns the following 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\_paired.R /tmp/tmp\_v9xvd13/forward /tmp/tmp\_v9xvd13/reverse /tmp/tmp\_v9xvd13/output.tsv.biom /tmp/tmp\_v9xvd13/track.tsv /tmp/tmp\_v9xvd13/filt\_f /tmp/tmp\_v9xvd13/filt\_r 140 138 0 0 2.0 2.0 2 consensus 1.0 6 1000000
> 
> R version 3.5.1 (2018-07-02)  
> Loading required package: Rcpp  
> DADA2: 1.10.0 / Rcpp: 1.0.2 / RcppParallel: 4.4.3
> 
> 1. Filtering ..........................................
> 2. Learning Error Rates  
> 470646820 total bases in 3361763 reads from 1 samples will be used for learning the error rates.  
> Error in err[c(1, 6, 11, 16),] \<- 1 :  
> incorrect number of subscripts on matrix  
> Execution halted  
> Traceback (most recent call last):  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/q2\_dada2/\_denoise.py", line 234, in denoise\_paired  
> run\_commands([cmd])  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/q2\_dada2/\_denoise.py", line 36, in run\_commands  
> subprocess.run(cmd, check=True)  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/subprocess.py", line 418, in run  
> output=stdout, stderr=stderr)  
> subprocess.CalledProcessError: Command '['run\_dada\_paired.R', '/tmp/tmp\_v9xvd13/forward', '/tmp/tmp\_v9xvd13/reverse', '/tmp/tmp\_v9xvd13/output.tsv.biom', '/tmp/tmp\_v9xvd13/track.tsv', '/tmp/tmp\_v9xvd13/filt\_f', '/tmp/tmp\_v9xvd13/filt\_r', '140', '138', '0', '0', '2.0', '2.0', '2', 'consensus', '1.0', '6', '1000000']' returned non-zero exit status 1.
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/q2cli/commands.py", line 327, in **call**  
> results = action(\*\*arguments)  
> File "\</home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/decorator.py:decorator-gen-459\>", line 2, in denoise\_paired  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py", line 240, in bound\_callable  
> output\_types, provenance)  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py", line 383, in _callable\_executor_  
> output\_views = self.\_callable(\*\*view\_args)  
> File "/home/luohx/software/anaconda3/envs/qiime2-2019.7/lib/python3.6/site-packages/q2\_dada2/\_denoise.py", line 249, 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.

besides this error, I also have other doubts.

- 
  1. when not use the parameter --verbose, the error return like as follow, but I counld not find the file /tmp/qiime2-q2cli-err-04x\_31km.log:

> Plugin error from dada2:
> 
> An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.
> 
> Debug info has been saved to /tmp/qiime2-q2cli-err-04x\_31km.log

- 
  1. I have imported 42 pairend fastq.gz 16S seq data, why in the error message there are only one sample?  
 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/e/efbae60e9e79aa5beced6af5836563cbe7468df2.png)

- 
  1. the following is the quality plot of the importing 16S data. Because It is extracted from metagenome, the length is 150nt. I am not sure the overlap length between the forward and reverse reads, and want to maintain as long as possible reads, so the truncating parameters are loose, set ` --p-trunc-len-f 140 \--p-trunc-len-r 138 \`. And I trimmed the primers and barcodes by` trim galore`, I don't use the parameter `--p-trim`. I doubt whether the low seq quality is the reason of the error.  
 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/f/f0098be2e5b00a6a3e4a74ccc6e82930eaa31a5b.png)

I have search the problem in qiime2 forum, there are some similar topics. But I go through the error detail, there are not exactly the same. so anyone can figure out what's the problem and how can I correct it . Many thanks

---

<div class="post-metadata">

### Author: ![colinbrislawn](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinbrislawn/32/6221_2.png) [@colinbrislawn](https://forum.qiime2.org/u/colinbrislawn)
#### Post date: [August 29, 2019, 2:26pm UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/2 "2019-08-29T14:26:28Z")

</div>

Hello @carolhuaxia

Welcome to the forums! Thank you for posting!  
(The first few posts need to get approved before you can see them, so that's why this post may have been hard to find)

I think you are on the right track:

> [@carolhuaxia](#):
>
> I have imported 42 pairend fastq.gz 16S seq data, why in the error message there are only one sample?

It looks like the importing may not have worked correctly... Maybe we could go back to the import step and make sure all 42 of your samples is getting recognized.

Given that the forward reads is high quality but the reverse read is low quality, you could also just try just importing the forward read.

Let me know what you try next!  
Colin

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [August 29, 2019, 4:11pm UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/3 "2019-08-29T16:11:16Z")

</div>



---

<div class="post-metadata">

### Author: ![carolhuaxia](https://forum.qiime2.org/user_avatar/forum.qiime2.org/carolhuaxia/32/5635_2.png) [@carolhuaxia](https://forum.qiime2.org/u/carolhuaxia)
#### Post date: [August 30, 2019, 3:06am UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/4 "2019-08-30T03:06:36Z")

</div>

I checked the data importing step. The following is the command:

> echo import 16S seq  
> qiime tools import   
> --type 'SampleData[PairedEndSequencesWithQuality]'   
> --input-path ${WORKDIR}/fastq\_manifest.txt   
> --output-path ${WORKDIR}/meta3\_16s.qza   
> --input-format PairedEndFastqManifestPhred33V2
> 
> echo Output visualization for sequence qualities  
> qiime demux summarize --i-data {WORKDIR}/meta3\_16s.qza --o-visualization {WORKDIR}/meta3\_16s.qzv

viewed the meta3\_16s.qzv in the Qimme2 View as follow:

 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/b/bba360e993f0aa6760db8eae2ff64a1d2866e146.png)

this inferred all 42 samples are imported. this not the problem.  
So why thre is only one sample showed in the` dada2 denoise-paired` step error?

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [August 30, 2019, 3:54am UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/5 "2019-08-30T03:54:02Z")

</div>

I believe the error is stemming from an issue related to the _characteristics_ of the reads (I seem to recall this has to do with the case when many (all?) sequences are unique). See this thread for more detail:

> [@Error running DADA2 in 454 data](https://forum.qiime2.org/t/error-running-dada2-in-454-data/8051/2):
>
> I found a similar error on the DADA2 error tracker: [https://github.com/benjjneb/dada2/issues/614](https://github.com/benjjneb/dada2/issues/614) Maybe you can try some of the checks suggested in that thread? You will already have a copy of DADA2 (and R) on hand in your QIIME 2 env. FWIW, in the linked issue it sounds like the reason this error happened is because all of the reads in the data were unique - no groupings of reads were identified.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [August 30, 2019, 3:54am UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/6 "2019-08-30T03:54:04Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [September 30, 2019, 9:54am UTC](https://forum.qiime2.org/t/an-error-was-encountered-while-running-dada2-in-r-return-code-1-error-in-err-c-1-6-11-16-1/11311/7 "2019-09-30T09:54:05Z")

</div>

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