# How cluster ASV with different length in OTU ?

**URL:** https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383
**Category:** Technical Support
**Tags:** vsearch
**Created:** [February 2, 2023, 7:40am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383 "2023-02-02T07:40:39Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![marioncdl](https://forum.qiime2.org/user_avatar/forum.qiime2.org/marioncdl/32/14255_2.png) [@marioncdl](https://forum.qiime2.org/u/marioncdl)
#### Post date: [February 2, 2023, 7:40am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/1 "2023-02-02T07:40:39Z")

</div>

Hi everyone,  
I'm want to work with ASV/OTU 99% from COI primers. I have some little variations in my ASVs lengths after merging and I want to cluster them at 99% of similarity by actually ASV 100% of similarity with different length are considering as several OTU and I would like to merge them. Any idea how I can perform this ?  
Thanks !

---

<div class="post-metadata">

### Author: ![crusher083](https://forum.qiime2.org/user_avatar/forum.qiime2.org/crusher083/32/9597_2.png) [@crusher083](https://forum.qiime2.org/u/crusher083)
#### Post date: [February 2, 2023, 8:31am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/2 "2023-02-02T08:31:13Z")

</div>

Hello,

you need to trim your ASV. Depending on how little is minimal length, you can either trim everything to a minimum (that was the case in the American Gut study) or discard sequences, that are too short.  
In this thread, OP asks similar question about trimming.

> [@Truncate reads before VSEARCH with pyrosequecing/ion torrent data](https://forum.qiime2.org/t/truncate-reads-before-vsearch-with-pyrosequecing-ion-torrent-data/7122):
>
> First, thanks a lot for all the development in qiime2 and the help provided here, you are amazing people! I need to analyze several 454 and ion-torrent datasets. I would like to use clustering-vsearch-otus first, and it would be great to do the whole analysis in qiime2. I know that there is a straightforward tutorial for this already in qiime2: [Clustering sequences into OTUs using q2-vsearch](https://forum.qiime2.org/t/clustering-sequences-into-otus-using-q2-vsearch/1348). BUT the tutorial starts with already quality-control data. Short question: ¿how can I quality-control…

Cheers,  
V

---

<div class="post-metadata">

### Author: ![marioncdl](https://forum.qiime2.org/user_avatar/forum.qiime2.org/marioncdl/32/14255_2.png) [@marioncdl](https://forum.qiime2.org/u/marioncdl)
#### Post date: [February 2, 2023, 10:46am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/3 "2023-02-02T10:46:36Z")

</div>

Thanks Crusher083 for your prompt response !  
I have already filter out too short and too long reads. My target gene normally 313bp and I keep reads \>300 and \<320bp. I think I can't trim my sequences as is, I should probably align my sequences to keep the same portion of genes for all my OTUs?

---

<div class="post-metadata">

### Author: ![crusher083](https://forum.qiime2.org/user_avatar/forum.qiime2.org/crusher083/32/9597_2.png) [@crusher083](https://forum.qiime2.org/u/crusher083)
#### Post date: [February 2, 2023, 11:51am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/4 "2023-02-02T11:51:17Z")

</div>

Yes, exactly. I assumed that you already aligned them from the fact that you know similarity.  
Basically need to you align a bunch of sequences using any MSA software, and then trim poorly aligned ends.

Cheers  
V

---

<div class="post-metadata">

### Author: ![jwdebelius](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jwdebelius/32/9655_2.png) [@jwdebelius](https://forum.qiime2.org/u/jwdebelius)
#### Post date: [February 2, 2023, 2:51pm UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/5 "2023-02-02T14:51:06Z")

</div>

Hi @marioncdl and @crusher083,

Hopefully its okay if I offer another suggestion?

Although I've not used it, you might also look into [dbOTU](https://library.qiime2.org/plugins/q2-dbotu/4/). I've not used it, but the idea is that you keep single nucleotide resolution or length variation when you need it, and cluster when you don't. Its potentially a nice balance between innate biological variation and sequencing mistakes.

Best,  
Justine

---

<div class="post-metadata">

### Author: ![marioncdl](https://forum.qiime2.org/user_avatar/forum.qiime2.org/marioncdl/32/14255_2.png) [@marioncdl](https://forum.qiime2.org/u/marioncdl)
#### Post date: [February 6, 2023, 6:04am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/6 "2023-02-06T06:04:52Z")

</div>

Thanks @jwdebelius for your proposition ! I thinks it's will do what I want ! I tried on subset dataset and it's seems to work. I'm currently trying in my global dataset, but it's running since one full day without output in the writing file .. I just made the request to install the plugin on a server, I hope it will work! 🤞 🤞 🤞

Regards  
Marion

---

<div class="post-metadata">

### Author: ![marioncdl](https://forum.qiime2.org/user_avatar/forum.qiime2.org/marioncdl/32/14255_2.png) [@marioncdl](https://forum.qiime2.org/u/marioncdl)
#### Post date: [February 6, 2023, 6:16am UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/7 "2023-02-06T06:16:28Z")

</div>

Hi @crusher083, I have been looking for a way to do this as mentioned above, but I am stuck...  
I know the similarity of my OTUs because after assigning my OTUs I saw that I have many OTUs assigned 99% to the same sequence. I put some of these sequences in Geneious Prime (I try to use as much freeware as possible but I haven't found an equivalent yet 😕 ) and I saw that my sequences were 99% similar but had small variations in size...  
So I tried to align my sequences with "qiime alignment mafft" but I get sequences with a size of 675bp...  
How can I proceed?  
Thanks for your help ?

Regards  
Marion

---

<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: [February 6, 2023, 5:28pm UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/8 "2023-02-06T17:28:46Z")

</div>

> [@marioncdl](#):
>
> I put some of these sequences in Geneious Prime (I try to use as much freeware as possible but I haven't found an equivalent yet 😕 )

For MSA, try [online MAFFT](https://mafft.cbrc.jp/alignment/server/), with one of their built-in viewers.

 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/0/03221014df6e9e8781cfea28e552c7292df43190.png)  
 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/8/8b7ce8a090a344042df69eda8595e2772835f86f.png)

That online viewer will also let you play with mafft settings to see if you can get an alignment that works for you. MSAs are very sensitive to settings, so you may have to experiment to get a useful MSA, then pass those settings into Qiime2.

(This does not solve your feature creation problem. Let's see how dbOTU works for you!)

---

<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: [March 9, 2023, 11:29pm UTC](https://forum.qiime2.org/t/how-cluster-asv-with-different-length-in-otu/25383/9 "2023-03-09T23:29:30Z")

</div>

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