# extracting amplicon region from alignment

**URL:** https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276
**Category:** Silva
**Tags:** taxonomy, feature-classifier, silva
**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:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![leo\_gm](https://forum.qiime2.org/user_avatar/forum.qiime2.org/leo_gm/32/16378_2.png) [@leo\_gm](https://forum.qiime2.org/u/leo_gm)
#### Post date: [August 1, 2023, 7:23am UTC](https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276/1 "2023-08-01T07:23:01Z")

</div>

Hi i have a problem using the reverse-transcribe, i have an AllignedRNASequence that i want to pass to DNASequence to do:

qiime feature-classifier extract-reads --i-sequences silva-138.1-fullaling.qza --p-f-primer CCTACGGGNGGCWGCAG --p-r-primer GACTACHVGGGTATCTAATCC --p-min-length 50 --o-reads silva-138.1-fullaling-trained.qza

I already saw the [OPTIONS] of the function but they put the following:  
Inputs:  
--i-rna-sequences ARTIFACT FeatureData[AlignedRNASequence¹ |  
RNASequence²] RNA Sequences to reverse transcribe to DNA. [required]

Outputs:  
--o-dna-sequences ARTIFACT FeatureData[AlignedSequence¹ | Sequence²]  
Reverse-transcribed DNA sequences. [required]

I have problems understanding the requirements of the output, the AlignedSequence | Sequence part

I you have any idea of how can i resolve this, i would be grateful.

---

<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!

---

<div class="post-metadata">

### Author: ![leo\_gm](https://forum.qiime2.org/user_avatar/forum.qiime2.org/leo_gm/32/16378_2.png) [@leo\_gm](https://forum.qiime2.org/u/leo_gm)
#### Post date: [August 2, 2023, 3:39am UTC](https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276/3 "2023-08-02T03:39:02Z")

</div>

Thanks again, i will read the article carefully.

---

<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: [September 2, 2023, 9:39am UTC](https://forum.qiime2.org/t/extracting-amplicon-region-from-alignment/27276/4 "2023-09-02T09:39:22Z")

</div>

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