# Passing alternative parameters to DADA2 default plugin

**URL:** https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124
**Category:** Ideas and Suggestions
**Tags:** dada2, pending-development
**Created:** [December 6, 2017, 10:35pm UTC](https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124 "2017-12-06T22:35:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jnesme](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jnesme/32/19988_2.png) [@jnesme](https://forum.qiime2.org/u/jnesme)
#### Post date: [December 6, 2017, 10:35pm UTC](https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124/1 "2017-12-06T22:35:09Z")

</div>

Hi all,

Are you considering a more exhaustive parameters list to the current DADA2 denoise-paired plugin implementation?

Specifically, we're using 16S V3-V4 amplicons, sequenced with MiSeq v2 2x250bp so in average, the overlap region is rather small (i.e. 35bp in E. coli). When trimming low qual last bases, it's quite common then to drop below the 20bp mismatch.

We have however tried to modify scoring of the merger by strongly penalizing mismatch and achieved pretty good results, allowing to lowering min. overlap, using maxMismatch = 0 and still get a decent numbers of reads properly merged. We tested that on a previously published dataset and could verify that indeed this yields much more reads, without errors in the overlap.

This however needs to rewrite mergePair function to increase mismatch penalty to -6. I was wondering the following:  
Could you please confirm me that there is currently no options to pass more arguments to DADA2 R functions in the QIIME2 implementation, especially mergePairs() and more specifically minOverlap?

Also, how easy would it be to modify the parameters set in getDadaOpt() because I could also change "MISMATCH" value there I suppose?...

By default, and even if I agree that throwing shitty reads is better, it also removes a bunch of reads that could otherwise be merged correctly, providing mismatch are heavily penalized during is nwalign()

But maybe I got [all that wrong](http://mibi.galaxy.bio.ku.dk/jnesme/AlternativePairEndingDada2.nb.html)?

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [December 8, 2017, 11:34pm UTC](https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124/3 "2017-12-08T23:34:39Z")

</div>

Hey @jnesme!

> [@jnesme](#):
>
> Are you considering a more exhaustive parameters list to the current DADA2 denoise-paired plugin implementation?

There's been some talk about this on the q2-dada2 [issue tracker](https://github.com/qiime2/q2-dada2/issues). In particular turning the `denoise-*` actions into pipelines that use more granular actions (which would ideally have more parameters). And exposing `minOverlap` from `mergePairs` which has come up before on this forum before.

> [@jnesme](#):
>
> Could you please confirm me that there is currently no options to pass more arguments to DADA2 R functions in the QIIME2 implementation, especially mergePairs() and more specifically minOverlap?

Right now there isn't a way to directly interact with the DADA2 R functions directly. Instead QIIME 2 passes the [options available](https://docs.qiime2.org/2017.11/plugins/available/dada2/denoise-paired/) to [an R script](https://github.com/qiime2/q2-dada2/tree/master/q2_dada2/assets) that @benjjneb very kindly wrote for us which then calls the DADA2 R functions in a pre-determined manner.

> [@jnesme](#):
>
> Also, how easy would it be to modify the parameters set in getDadaOpt() because I could also change “MISMATCH” value there I suppose?..

Looking at the docs, it sounds like you would use `setDadaOpt` for anything that wasn't specifically provided as an argument. However since q2-dada2 calls an R scripts, there's not a great way for you to jump into the R session and override anything. An `.Rprofile` file _might_ make this possible, but you are really much better off using R and DADA2 directly.

---

<div class="post-metadata">

### Author: ![benjjneb](https://forum.qiime2.org/user_avatar/forum.qiime2.org/benjjneb/32/1602_2.png) [@benjjneb](https://forum.qiime2.org/u/benjjneb)
#### Post date: [December 9, 2017, 3:52am UTC](https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124/5 "2017-12-09T03:52:02Z")

</div>

> [@jnesme](#):
>
> We have however tried to modify scoring of the merger by strongly penalizing mismatch and achieved pretty good results, allowing to lowering min. overlap, using maxMismatch = 0 and still get a decent numbers of reads properly merged. We tested that on a previously published dataset and could verify that indeed this yields much more reads, without errors in the overlap.
> 
> This however needs to rewrite mergePair function to increase mismatch penalty to -6.

This doesn't apply to the Q2 plugin right now, but your post is very timely. 3 days ago we checked in essentially the same change to the devel version of the dada2 R package, i.e. higher mismatch and gap penalties and a shorter minOverlap, for the same reason you are describing!

> <https://github.com/benjjneb/dada2/commit/ae200adfb6632659016a81d0267c32c7dbcbbb67>
>
> Lowered the minOvlerap to 12. Also addressed a rare issue that crops up
> when mer…ging on amplicons with repeated elements, by making alignment
> parameters more heavily weight against mismatch/gaps when inside
> mergePairs.

Those new and better defaults will propagate to the Q2 plugin, but perhaps not until they make it into the release version of the R package.

---

<div class="post-metadata">

### Author: ![jnesme](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jnesme/32/19988_2.png) [@jnesme](https://forum.qiime2.org/u/jnesme)
#### Post date: [December 11, 2017, 5:24pm UTC](https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124/6 "2017-12-11T17:24:04Z")

</div>

Great too here!

I tried manipulating run\_dada\_paired.R script and input the modifed function there and it seems to do the trick while waiting for the modification push to Q2 plugin

Thanks for your help and all the great work.

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [December 12, 2017, 2:59am UTC](https://forum.qiime2.org/t/passing-alternative-parameters-to-dada2-default-plugin/2124/8 "2017-12-12T02:59:47Z")

</div>

Hey @jnesme,

Glad to hear you were able to work around this! I just want to make a comment as a kind of informational note.

If you installed (and edited) via the git repo and ran `make dev` you should see a different version number when you type `qiime info` for `q2-dada2`. (Ideally something like `2017.11.0.dev0+0.gce22644.dirty`.) This is also the version which is recorded in provenance, which could be useful to have long-term, in case you ever forget that you used a modified version of `q2-dada2` in your analysis.

If you just edited the file in your environment directly (i.e. some file in `site-packages/`), then the version will still look like `2017.11.0` (or whatever release you might have) and may cause confusion later on as provenance can no longer "reflect" exactly what happened.
