# Sliding windows and quality filtering

**URL:** https://forum.qiime2.org/t/sliding-windows-and-quality-filtering/28980
**Category:** Ideas and Suggestions
**Tags:** dada2
**Created:** [January 19, 2024, 9:43pm UTC](https://forum.qiime2.org/t/sliding-windows-and-quality-filtering/28980 "2024-01-19T21:43:44Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [January 20, 2024, 11:52am UTC](https://forum.qiime2.org/t/sliding-windows-and-quality-filtering/28980/3 "2024-01-20T11:52:49Z")

</div>

Hi @Aaron_DeVries hi @colinbrislawn

The QIIME 2 plugin q2-quality-filter also already has such an action. It does not use an average across a sliding window, but you can set a window size for the number of low-quality nucleotides that must occur in a row for trimming to be done at that position.

See `qiime quality-filter q-score --help` for more details.

So it should be possible to trim with this and then pass to q2-dada2. However, note that dada2 can experience lowered performance when amplicons are of different lengths, as this can impact the error modeling step, so this is possible but you should closely check the results. Some relevant posts about this:

> [@Cutadapt prior to dada2 denoise-paired](https://forum.qiime2.org/t/cutadapt-prior-to-dada2-denoise-paired/14570/5):
>
> During denoising sequences that differ solely by variation in length will be grouped together. Pure length variation is not part of the error model. However, quality control that introduces artefactual length variation (e.g. by trimming when quality drops below some threshold) does tend to reduce the sensitivity of denoising, and thus is not recommended. Instead truncating at a fixed length cutoff is typically the better approach.

> [@DADA2, truncation lengths and features number](https://forum.qiime2.org/t/dada2-truncation-lengths-and-features-number/1940/6):
>
> It is important to understand that DADA2 (actually, all currently known ASV methods I believe) is using repeated observations of the true biological sequence to distinguish real sequences from errors. Thus, for sequence variants to be detected, there must be at least 2 error-free reads from that sequence in the dataset, and the sensitivity of these methods to rare variants is constrained by the fraction of error-free reads in the data. I haven't seen your data, but I am going to make the assum…

---

_[View the full topic](https://forum.qiime2.org/t/sliding-windows-and-quality-filtering/28980)._
