# Sequence extraction and Classifier training for Ion Torrent data

**URL:** https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097
**Category:** User Support
**Tags:** feature-classifier
**Created:** [March 17, 2020, 7:34pm UTC](https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097 "2020-03-17T19:34:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![KMaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/kmaki/32/7740_2.png) [@KMaki](https://forum.qiime2.org/u/KMaki)
#### Post date: [March 17, 2020, 7:34pm UTC](https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097/1 "2020-03-17T19:34:37Z")

</div>

Hello,  
I am working with Ion Torrent data with @Jen_S and am trying to create a DADA2 workflow using QIIME2 to compare with our previous QIIME1 pipeline. Some of our previous workflow issues have been resolved already in this forum (thanks @Nicholas_Bokulich !) but we are getting stuck at the point where we want to train our classifier. 🤯

We have datasets using IonTorrent data that have mixed orientation reads and single end sequencing amplicons targeting two different V regions (4 primers total). The data has ATCC mock sequences that were run with other samples. There are 2 mocks (1 even, 1 staggered) per run with a total of 14 runs (28 mock samples)

Here is the workflow:  
• Data import into QIIME2 as .qza  
• Cutadapt performed for 2 forward and 2 reverse regions on demultiplexed files  
• Run DADA2 for each run and each primer  
Note, we just found out about qiime dada2 denoise-pyro in here, which we plan to  
use instead of what we were previously using ( qiime dada2 denoise-single )  
•Then we merged all of our forward and reverse reads for each V region using qiime feature-table merge with the --p-overlap-method sum flag to get merged\_v2\_table.qza and merged\_v2\_rep\_seqs.qza

**Next we want to train our classifier—we are just running into a couple of issues/questions:**

We read that sk-learn does not perform well on mixed orientation reads so were thinking about using qiime feature-classifier classify-consensus-vsearch  
In the feature classifier tutorial, there is a sequence extraction step from Greengenes (what we plan on using). We were able to get import the otus fasta into 99\_otus.qza along with the reference taxonomy, but are stuck at the “extract reads” step below

qiime feature-classifier extract-reads   
--i-sequences 99\_otus.qza   
--p-f-primer \*_XXXXXXXXXX\*_  
--p-r-primer \*_XXXXXXXXXX \*_  
--p-trunc-len \*_250 \*_  
--p-min-length 100   
--p-max-length 400   
--o-reads \*\*v2\_\*\*ref-seqs.qza

I bolded the parts that we would adjust above based on our primers. Can we input both our forward and reverse primers since we are using the merged table, even if we aren’t working with paired-end sequences? In DADA2 our trunc-lenth was 250 so want to keep that consistent.

Then we train our classifier using classify-consensus-vsearch. Do you recommend that we use the defaults to start like the tutorial does? I put in the classifier training/testing commands with my understanding of the data we need in parentheses below each command)

qiime feature-classifier classify-consensus-vsearch  
--i-query ARTIFACT FeatureData[Sequence] Sequences to classify taxonomically.  
( --i-query merged\_v2\_rep\_seqs.qza #output from DADA2 after table merge)  
--i-reference-reads ARTIFACT FeatureData[Sequence] reference sequences.  
( --i-reference-reads v2\_ref-seqs.qza \ #from extract-reads command)  
--i-reference-taxonomy ARTIFACT FeatureData[Taxonomy] reference taxonomy labels.  
( --i-reference-taxonomy ref-taxonomy.qza \ #import from Greengenes)  
--o-classification ARTIFACT FeatureData[Taxonomy]  
(--o-classifier v2\_classifier.qza )

qiime feature-classifier classify-sklearn   
--i-classifier v2\_classifier.qza \ (#from above)  
--i-reads v2\_rep\_seqs.qza \ (#output from DADA2 after table merge)  
--o-classification v2\_taxonomy.qza

qiime metadata tabulate   
--m-input-file v2\_taxonomy.qza   
--o-visualization v2\_taxonomy.qzv

**Do these commands look correct?**

Finally, while doing research on the above we came across a new pipeline qiime feature-classifier classify-hybrid-vsearch-sklearn [classify-hybrid-vsearch-sklearn: ALPHA Hybrid classifier: VSEARCH exact match + sklearn classifier — QIIME 2 2020.2.0 documentation](https://docs.qiime2.org/2020.2/plugins/available/feature-classifier/classify-hybrid-vsearch-sklearn/)

What is the difference between this and the standard v-search classifier? Can we use this on our mixed orientation reads? If I understand correctly, this pipeline combines the “Train the classifier” and “test the classifier” steps since a pre-trained sklearn classifier used from data resources, correct?

qiime feature-classifier classify-hybrid-vsearch-sklearn  
--i-query ARTIFACT FeatureData[Sequence] Sequences to classify taxonomically.  
( --i-query merged\_v2\_rep\_seqs.qza #output from DADA2 after table merge)  
--i-reference-reads ARTIFACT FeatureData[Sequence] reference sequences.  
( --i-reference-reads v2\_ref-seqs.qza \ #from extract-reads command)  
--i-reference-taxonomy ARTIFACT FeatureData[Taxonomy] reference taxonomy labels.  
--i-reference-taxonomy ref-taxonomy.qza \ #import from Greengenes)  
--i-classifier ARTIFACT TaxonomicClassifier Pre-trained sklearn taxonomic classifier for  
classifying the reads.  
(--i-classifier gg-13-8-99-nb-classifier.qza #from QIIME2 data resources)  
--o-classification ARTIFACT FeatureData[Taxonomy] The resulting taxonomy  
classifications.  
( --o-classification v2\_taxonomy.qza )

qiime metadata tabulate   
--m-input-file v2\_taxonomy.qza   
--o-visualization taxonomy.qzv

Thanks so much for your help, I realize this is a long and multi-part question! 😇

---

<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: [March 17, 2020, 8:00pm UTC](https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097/2 "2020-03-17T20:00:31Z")

</div>

Welcome to the forum @KMaki!

> [@KMaki](#):
>
> We read that sk-learn does not perform well on mixed orientation reads so were thinking about using qiime feature-classifier classify-consensus-vsearch

That's a good call! This is what I've advised elsewhere for ion torrent data.

> [@KMaki](#):
>
> In the feature classifier tutorial, there is a sequence extraction step from Greengenes

Note that that tutorial is for training classifiers for use with `classify-sklearn`. There is no training step if you plan to use `classify-consensus-vsearch` since it just aligns against a reference sequence database. More on this below.

That said, extracting reads is perfectly okay — it will speed up the alignment step if you know the V-region you are classifying. But extracting reads probably will not impact accuracy too much (it's possible! but not too likely)

> [@KMaki](#):
>
> Can we input both our forward and reverse primers since we are using the merged table, even if we aren’t working with paired-end sequences?

Yes that's fine.

Drop the `trunc-len` here, though: since your reads are in mixed orientations those 250 nt could be aligning against any section of the target amplicon, not just the 250 nt at the front end of the amplicon.

> [@KMaki](#):
>
> Do you recommend that we use the defaults to start like the tutorial does?

Yes! The defaults were optimized for 16S and ITS sequences as described in the main publication for the q2-feature-classifier plugin that describes all of the classification methods developed for the plugin: [Optimizing taxonomic classification of marker-gene amplicon sequences with QIIME 2’s q2-feature-classifier plugin | Microbiome | Full Text](https://microbiomejournal.biomedcentral.com/articles/10.1186/s40168-018-0470-z)

But I've added new features since then, like options to use only top hits... fiddle with the parameters a bit, since you have mock communities you have an opportunity to evaluate whether altering the parameters improves your results (and see the q2-quality-control plugin and tutorial for methods to evaluate accuracy).

> [@KMaki](#):
>
> Then we train our classifier using classify-consensus-vsearch

As noted above, there is no classifier training step. `classify-consensus-vsearch` _is the classification step_. This is distinct and separate from `classify-sklearn`, which requires a classifier training step, as it uses different machine learning models to predict taxonomic affiliation based on kmer frequency profiles. `classify-consensus-vsearch` just uses VSEARCH to align against a database, followed by a consensus taxonomy assignment step in q2-feature-classifier. No training required! You can see the overview tutorial at [qiime2.org](http://qiime2.org) for a flowchart depicting the differences between these methods.

In practice it means this:

> [@KMaki](#):
>
> –o-classification ARTIFACT FeatureData[Taxonomy]  
> (–o-classifier v2\_classifier.qza )

This is not a classifier, this _is your taxonomic classification of each input sequence_

> [@KMaki](#):
>
> –i-classifier v2\_classifier.qza \ (#from above)

This will not work, since this is a `FeatureData[Taxonomy]`, not a trained classifier.

> [@KMaki](#):
>
> What is the difference between this and the standard v-search classifier?

This performs an exact match search with classify-consensus-vsearch, and anything that does not 100% match a reference sequence is re-classified with classify-sklearn. It is still a somewhat experimental method.

> [@KMaki](#):
>
> Can we use this on our mixed orientation reads?

In your case, probably not: since the reads are in mixed orientation you have issues orienting for exact match and classify-sklearn. The exact match requires 100% end-to-end exact match, so needs to be trimmed at precisely the same positions, but since your reads are single-end mixed-orientation truncated at 250 nt it sounds like you do not know whether this will align to the front or back end of the reference read simulated amplicons.

But in general yes this could work if paired-end reads are used (whether or not they are in mixed orientation) or single-end reads that are in the same orientation.

**So bottom line for your analysis** : just run `classify-consensus-vsearch` (either on the extracted reads or not) and you are all done!

---

<div class="post-metadata">

### Author: ![KMaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/kmaki/32/7740_2.png) [@KMaki](https://forum.qiime2.org/u/KMaki)
#### Post date: [March 18, 2020, 3:07pm UTC](https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097/3 "2020-03-18T15:07:53Z")

</div>

Thank you so much @Nicholas_Bokulich !  
This helped classify things a lot. Just to make sure I am 100% clear, if I am running vsearch, what artifacts are the inputs 2 & 3 coming from in the qiime feature-classifier classify-consensus-vsearch command:  
qiime feature-classifier classify-consensus-vsearch  
--i-query merged\_v2\_rep\_seqs.qza (this is the representative-sequences artifact from  
DADA2 after all runs are merged)  
--i-reference-reads ARTIFACT FeatureData **where does this come from?**  
--i-reference-taxonomy ARTIFACT FeatureData[Taxonomy] reference taxonomy labels  
**where does this come from?**  
--o-classification v2\_feature\_classification.qza

Thank you!  
Katherine

---

<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: [March 18, 2020, 3:10pm UTC](https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097/4 "2020-03-18T15:10:58Z")

</div>

> [@KMaki](#):
>
> –i-query merged\_v2\_rep\_seqs.qza (this is the representative-sequences artifact from  
> DADA2 after all runs are merged)

Correct

> [@KMaki](#):
>
> –i-reference-reads ARTIFACT FeatureData **where does this come from?**

These are the imported reference sequences (e.g., from Greengenes), optionally after extracting the target amplicon.

> [@KMaki](#):
>
> –i-reference-taxonomy ARTIFACT FeatureData[Taxonomy] reference taxonomy labels  
> **where does this come from?**

Imported reference taxonomy that matches the sequences that you are inputting.

I hope that helps!

---

<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: [April 18, 2020, 9:10pm UTC](https://forum.qiime2.org/t/sequence-extraction-and-classifier-training-for-ion-torrent-data/14097/5 "2020-04-18T21:10:58Z")

</div>

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