# Exporting DADA2 (R package) results to work with qiime2

**URL:** <https://forum.qiime2.org/t/exporting-dada2-r-package-results-to-work-with-qiime2/2573>\
**Category:** User Support\
**Tags:** dada2\
**Created:** [January 15, 2018, 12:34pm UTC](https://forum.qiime2.org/t/exporting-dada2-r-package-results-to-work-with-qiime2/2573 "2018-01-15T12:34:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaroslaw\_Grzadziel](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@Jaroslaw\_Grzadziel](https://forum.qiime2.org/u/Jaroslaw_Grzadziel)\
**Post date:** [January 15, 2018, 12:34pm UTC](https://forum.qiime2.org/t/exporting-dada2-r-package-results-to-work-with-qiime2/2573/1 "2018-01-15T12:34:32Z")

</div>

According to the [Dada2: qiime2 virtual machine vs RStudio performance](https://forum.qiime2.org/t/dada2-qiime2-virtual-machine-vs-rstudio-performance/2511) topic, especially:

> [@Dada2: qiime2 virtual machine vs RStudio performance](https://forum.qiime2.org/t/dada2-qiime2-virtual-machine-vs-rstudio-performance/2511/3):
>
> Use DADA2 from within R or RStudio (i.e. outside of QIIME 2), save the results, and import the feature table to continue analyses in QIIME 2.

I want to ask if anybody know how exactly move from R to q2 ?  
Dada2 workflow in R produces this kind of outputs:

**errF and errR** - the result of errors learning  
**derepFs and derep Rs** - the result of dereplication  
**dadaFs and dada Rs** - after sequences variants inference  
**mergers** - merged paired reads

**seqtab.nochim -** the file where first column is samples list, next columns headers are sequences after chimera removal and below we can see counts, **see below:**

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

As I mentioned in previous topic I prefer using R for dada2, however I would like to taxonomy assignment in qiime2 (and other downstream analysis). Have anyone an idea how to deal with this problem ? Maybe someone is already working like this ?

Thanks 🙂

---

<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:** [January 17, 2018, 5:03pm UTC](https://forum.qiime2.org/t/exporting-dada2-r-package-results-to-work-with-qiime2/2573/3 "2018-01-17T17:03:09Z")

</div>

Hi @Jaroslaw_Grzadziel!

> [@Jaroslaw\_Grzadziel](#):
>
> I want to ask if anybody know how exactly move from R to q2 ?

Have you had a chance to review this topic from a few months back?

> [@Dada2 back to qiime 2](https://forum.qiime2.org/t/dada2-back-to-qiime-2/1316):
>
> Hi All, Due to slow running time, I ran dada2 independently using R. However, I have an issue: How do I create a phylogenetic tree in Qiime2? Procedure: I saved the output of the dada2 taxa file transformed it and created a taxa table: taxat \<- t(taxa)#transpose the table taxat \<- cbind('#OTUID' = rownames(taxat ), taxat)#Add '#OTUID' to the header (required by biom) write.table(taxa, "dada2\_taxa.txt", sep='\t', row.names=FALSE, quote=FALSE) I converted the dada2\_taxa.txt into a biom table…

Let us know if that gets you moving in the right direction! Thanks! 🦖

---

<div class="post-metadata">

**Author:** ![Jaroslaw\_Grzadziel](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@Jaroslaw\_Grzadziel](https://forum.qiime2.org/u/Jaroslaw_Grzadziel)\
**Post date:** [January 17, 2018, 8:29pm UTC](https://forum.qiime2.org/t/exporting-dada2-r-package-results-to-work-with-qiime2/2573/5 "2018-01-17T20:29:20Z")

</div>

Thank you @thermokarst **again**!! I have no idea why I couldn't find this topic.

**Summing up the resolution \* (thanks to @ebolyen):**

- \*assuming that we want to start with **dada2 in R** and move to taxonomy assignments and different analysis in qiime2 (e.g following q2 tutorials like Moving Pictures etc.)

1. **in R**  
`write.table(t(seqtab.nochim), "dada2-analysis/seqtab-nochim.txt", sep="\t", row.names=TRUE, col.names=NA, quote=FALSE)`

2. **in R**  
`uniquesToFasta(seqtab.nochim, fout='dada2-analysis/rep-seqs.fna', ids=colnames(seqtab.nochim))`

3. **in q2**  
`qiime tools import \`  
` --input-path dada2-analysis/rep-seqs.fna \`  
` --type 'FeatureData[Sequence]' \`  
`--output-path rep-seqs.qza`

4. **in q2**  
`echo -n "#OTU Table" | cat - dada2-analysis/seqtab-nochim.txt > dada2-analysis/biom-table.txt`

5. **in q2**  
`biom convert -i dada2-analysis/biom-table.txt -o dada2-analysis/table.biom --table-type="OTU table" --to-hdf5`

6. **in q2**  
`qiime tools import \`  
` --input-path dada2-analysis/table.biom \`  
` --type 'FeatureTable[Frequency]' \`  
` --source-format BIOMV210Format \`  
` --output-path table.qza`

Once again, thank you @thermokarst and @ebolyen !!

---

<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:** [February 18, 2018, 2:29am UTC](https://forum.qiime2.org/t/exporting-dada2-r-package-results-to-work-with-qiime2/2573/6 "2018-02-18T02:29:25Z")

</div>

Closed on February 18, 2018, 2:29am UTC

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