# extracting amplicon region from alignment

**URL:** <https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276>\
**Category:** Silva\
**Tags:** feature-classifier, silva, taxonomy\
**Created:** [August 1, 2023, 7:23am UTC](https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276 "2023-08-01T07:23:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [August 1, 2023, 1:42pm UTC](https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276/2 "2023-08-01T13:42:06Z")

</div>

Hi @leo_gm,

`qiime feature-classifier extract-reads` will only work on unaligned `FeatureData[Sequence]` types. That is, the classifier will only work with unaligned reads.

You have three options, you can:

## 1. degap the sequences

```auto
qiime rescript degap-seqs ...

```

To remove all gaps from the alignment, essentially unaligning the sequences. From here you can proceed to `qiime feature-classifier extract-reads ...` with your primer sequences.

## 2. trim alignment then degap

The second option is to enter in the forward and reverse alignment positions via the `*-position-start` flags of the amplicon region you wish to extract (V4 positions shown as an example). That is you are using the positions in the alignment rather than the primer sequences to extract the amplicon region. You can use the other options for this command to use the primers instead of the positions to extract the amplicon region, but I prefer using the positions directly.

```auto
qiime rescript degap-seqs trim-alignment \
     --p-position-start 13862 \ 
     --p-position-end 23445\
     ...

```

Then degap the sequences, as above, then proceed to the classifier.

## 3. RESCRIPt tutorial

The third option is to simply follow the RESCRIPt tutorial [here](https://forum.qiime2.org/t/processing-filtering-and-evaluating-the-silva-database-and-other-reference-sequence-data-with-rescript/15494/2), to make your own SILVA classifier.

-Cheers!

---

_[View the full topic](https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276)._
