# Using RESCRIPt's 'extract-seq-segments' to extract reference sequences without PCR primer pairs.

**URL:** https://forum.qiime2.org/t/using-rescripts-extract-seq-segments-to-extract-reference-sequences-without-pcr-primer-pairs/23618
**Category:** Tutorials
**Tags:** taxonomy, feature-classifier, trnl, lsu, its, ssu, co1, tutorial, rescript
**Created:** [July 13, 2022, 4:18pm UTC](https://forum.qiime2.org/t/using-rescripts-extract-seq-segments-to-extract-reference-sequences-without-pcr-primer-pairs/23618 "2022-07-13T16:18:36Z")
**Posts on this page:** 1
**Showing post:** 14

<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: [November 14, 2023, 6:40pm UTC](https://forum.qiime2.org/t/using-rescripts-extract-seq-segments-to-extract-reference-sequences-without-pcr-primer-pairs/23618/14 "2023-11-14T18:40:09Z")

</div>

No problem. 🙂

If I remember correctly the rbcL gene is ~ 1400 bp. At least according to [this](https://iopscience.iop.org/article/10.1088/1755-1315/276/1/012061).

Given my explanation above, you are likely starting to extract more full-length rbcL sequences as you iterate. Basically, you are getting leaky length extractions as you iterate. Which might be fine, especially if your manual BLAST confirms the gene and taxonomy assignments.

But if you are hoping to strictly stay within the bounds of your expected amplicon length, then Id simply do more iterations, at a much higher similarity, say 90% then go up.

One thought, you could follow up with a primer-pair search on the last extract sequence segment output. You might be able to extract more of your target amplicons when searching against this smaller pool of ~ 1kb fragments. Perhaps at this stage modify your primer pairs with more IUPAC ambiguity codes at this step?

Alternatively, you can align your extracted sequences with mafft using `qiime alignment mafft ...`, then add your primers to that alignment using `qiime alignment mafft-add --p-addfragments ...`. Then you can export the resulting FASTA file into an alignment viewer of your choice. You'll use the alignment to see which alignment positions your primers are located. Once you make note of these positions, you can use `qiime rescript trim-alignment --p-position-start XX --p-position-end YY ...` to extract that section of the alignment and write it out to file. Then you can use `qiime rescript degap-seqs ...` to remove all the gaps, essentially unaligning the sequences for use in training a classifier.

Here is an [old prototype pipeline](https://github.com/mikerobeson/make_SILVA_db) I put together prior to RESCRIPt, which uses this alignment column extraction philosophy. I think it'll help clarify the approach I just outlined. 🙂

---

_[View the full topic](https://forum.qiime2.org/t/using-rescripts-extract-seq-segments-to-extract-reference-sequences-without-pcr-primer-pairs/23618)._
