# feature-classifier extract-reads v3 v4

**URL:** <https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408>\
**Category:** General Discussion\
**Tags:** greengenes2\
**Created:** [November 24, 2023, 3:03pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408 "2023-11-24T15:03:27Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Linda\_Abenaim](https://forum.qiime2.org/user_avatar/forum.qiime2.org/linda_abenaim/32/17111_2.png) [@Linda\_Abenaim](https://forum.qiime2.org/u/Linda_Abenaim)\
**Post date:** [November 24, 2023, 3:03pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/1 "2023-11-24T15:03:27Z")

</div>

Hello 😀

I'm trying to train NB classifier with Greengenes2 in the V3 V4 region.

What p min length and p max length do you recommend inserting?  
Are these parameters mandatory?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![buzic](https://forum.qiime2.org/user_avatar/forum.qiime2.org/buzic/32/16494_2.png) [@buzic](https://forum.qiime2.org/u/buzic)\
**Post date:** [November 24, 2023, 4:22pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/2 "2023-11-24T16:22:54Z")

</div>

Hi @Linda_Abenaim 🙂

There is a lot of advice on the forum about training databases (see [here](https://forum.qiime2.org/t/v3-v4-region-training-a-classifier-parameters/28118) and [here](https://forum.qiime2.org/t/training-classifier-on-v3-v4-region/10467/2)). The [Qiime2 tutorial documents](https://docs.qiime2.org/2023.9/tutorials/feature-classifier/) also have some useful information in the **notes** sections to get you thinking about your own sequences and how to make an informed decision.

Regarding what inputs are mandatory or not, you can look at the documentation and it will tell you which parameters are required or not. For example the [feature-classifier extract-reads](https://docs.qiime2.org/2023.9/plugins/available/feature-classifier/extract-reads/) document describes the inputs (I've only pasted the top part here):

```auto
Inputs:
  --i-sequences ARTIFACT FeatureData[Sequence] [required]
Parameters:
  --p-f-primer TEXT forward primer sequence (5' -> 3'). [required]
  --p-r-primer TEXT reverse primer sequence (5' -> 3'). 
                      Do not use reverse-complemented primer sequence. [required]

```

These inputs are **required** , meaning they are **mandatory** and if you scroll further down on that document page, you'll see the output is also required as well (makes sense, you need to output the data 😆) .

So have a deeper look about and if you are still stuck after looking through these, post again and someone can help 👍

best,

Vic

---

<div class="post-metadata">

**Author:** ![Mehrbod\_Estaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/mehrbod_estaki/32/4001_2.png) [@Mehrbod\_Estaki](https://forum.qiime2.org/u/Mehrbod_Estaki)\
**Post date:** [November 25, 2023, 2:06am UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/3 "2023-11-25T02:06:11Z")

</div>

Just wanted to mention that Greengenes 2 is a bit different than the other reference database with regards to how it is constructed and so, in case you haven't already seen this, I would recommend starting [here](https://forum.qiime2.org/t/introducing-greengenes2-2022-10/25291#if-you-have-non-v4-data-5) with the developer's recommendations for non-V4 data.

---

<div class="post-metadata">

**Author:** ![Linda\_Abenaim](https://forum.qiime2.org/user_avatar/forum.qiime2.org/linda_abenaim/32/17111_2.png) [@Linda\_Abenaim](https://forum.qiime2.org/u/Linda_Abenaim)\
**Post date:** [November 25, 2023, 9:50am UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/4 "2023-11-25T09:50:04Z")

</div>

Thank you so much, I will try!  
But then can I always classifier with NB?

Another question I don’t understand the differences between Silva and Greengenes2.  
What do you suggest for my region v3-v4?

---

<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:** [November 25, 2023, 3:33pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/5 "2023-11-25T15:33:25Z")

</div>

Hello Linda,

Looks like we may be continuing the discussion started here.

> [@Training classifier for taxonomic analysis](https://forum.qiime2.org/t/training-classifier-for-taxonomic-analysis/28354/2):
>
> Hello Linda, This sounds like a great project! beetle green_salad microbe Have you tried using Greengenes2 with non-v4-16s, as shown in the main tutorial? EDIT: This does not make ASVs from your data like other pipelines. Instead, it directly compares your reads against the GG2 database entries, which already have a taxonomy. Simply counting database hits is also known as 'closed-ref-clustering'. This has very different tradeoffs than denoising -\> taxonomy inference. [https://forum.…](https://forum.qiime2.org/t/introducing-greengenes2-2022-10/25291)

> [@Linda\_Abenaim](#):
>
> What do you suggest for my region v3-v4?

Mehrbod and I both suggested the GreenGenes 2 database and `qiime greengenes2 non-v4-16s`, which does not require an 'extract-reads' step.

What's best for your data depends on what's _in_ your data.

(If you included positive controls on your run with known composition, these can help you evaluate what methods work well.)

Try these out, see what works, and report back! 🔬 🔭

---

<div class="post-metadata">

**Author:** ![Linda\_Abenaim](https://forum.qiime2.org/user_avatar/forum.qiime2.org/linda_abenaim/32/17111_2.png) [@Linda\_Abenaim](https://forum.qiime2.org/u/Linda_Abenaim)\
**Post date:** [November 25, 2023, 3:59pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/6 "2023-11-25T15:59:56Z")

</div>

thank you so much for your suggestion, Colin! So if I use Greengenes2 non-v4- 16 s it is not necessary the command extract reads and can I pass to the qiime feature classifier fit classifier naive bayes? Right?

Another question, what is the difference between greengenes fna.qza and nb.qza? If I use naive bayes do you suggest to download nb. qza? And what taxonomy between these I have to download?  
Thank you in advance for your help 🙏

 ![IMG_7811](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/0/b/0b5be90507bb1e003f57ab034b5cb208656f13cd.jpeg)

---

<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:** [November 25, 2023, 5:09pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/7 "2023-11-25T17:09:43Z")

</div>

> [@Linda\_Abenaim](#):
>
> thank you so much for your suggestion, Colin! So if I use Greengenes2 non-v4- 16 s it is not necessary the command extract reads and can I pass to the qiime feature classifier fit classifier naive bayes? Right?

Correct!

> [@Linda\_Abenaim](#):
>
> Another question, what is the difference between greengenes fna.qza and nb.qza? If I use naive bayes do you suggest to download nb. qza? And what taxonomy between these I have to download?

.fna are the fasta sequences  
.nb is the trained Naive Bayes classifier  
.tax is the taxonomy file for this backbone

(Qiime2 has some safeguards built in and will alert you to some common errors. Try it and see!)

(And you can inspect these files for yourself with [https://view.qiime2.org](https://view.qiime2.org) )

---

<div class="post-metadata">

**Author:** ![Linda\_Abenaim](https://forum.qiime2.org/user_avatar/forum.qiime2.org/linda_abenaim/32/17111_2.png) [@Linda\_Abenaim](https://forum.qiime2.org/u/Linda_Abenaim)\
**Post date:** [November 26, 2023, 5:05pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/8 "2023-11-26T17:05:55Z")

</div>

thank you so much for your suggestion!  
I'm so sorry.. I'm trying to use greengenes2 non V4-16s, i don't understand if instead of icu.biom.qza   
and icu.fna.qza \ in the command qiime greengenes2 non-v4-16s i have to put my table and rep-seqs or not. With greengenes2 non V4-16s i can jump to "feature-classifier classify-sklearn" step and as classifier put 2022.10.backbone.full-length.nb.qza directly, right?  
Did I well understand?

thanks

---

<div class="post-metadata">

**Author:** ![gregcaporaso](https://forum.qiime2.org/user_avatar/forum.qiime2.org/gregcaporaso/32/17769_2.png) [@gregcaporaso](https://forum.qiime2.org/u/gregcaporaso)\
**Post date:** [November 27, 2023, 8:30pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/10 "2023-11-27T20:30:05Z")

</div>



---

<div class="post-metadata">

**Author:** ![Mehrbod\_Estaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/mehrbod_estaki/32/4001_2.png) [@Mehrbod\_Estaki](https://forum.qiime2.org/u/Mehrbod_Estaki)\
**Post date:** [November 27, 2023, 8:55pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/12 "2023-11-27T20:55:46Z")

</div>

Hi @Linda_Abenaim,

If you look at the example from the tutorial I linked above, it shows that the ICU table and representative sequence file were the actual user created feature-table and rep-seqs. So for example if you ran DADA2, then you would have both these files generated at the end of that.

With non-V4 data, based on the example in the tutorial:

```python
$ qiime greengenes2 non-v4-16s \
    --i-table icu.biom.qza \ #your own biom table
    --i-sequences icu.fna.qza \ #your own rep-seqs file
    --i-backbone 2022.10.backbone.full-length.fna.qza \ #you download this
    --o-mapped-table icu.gg2.biom.qza \ #this is new gg2-filtered feature-table you use downstream
    --o-representatives icu.gg2.fna.qza #this is new gg2-fitlered rep-seqs file used downstream.

```

In the background, this command is using OTU clustering on your V3-V4 reads and then it inserts those into a background tree.

Once you have these files, you can simply get your taxonomy file

```python
$ qiime greengenes2 taxonomy-from-table \
--i-reference-taxonomy 2022.10.taxonomy.asv.nwk.qza \ #download from gg2
--i-table icu.gg2.biom.qza \ #table from last step
--o-classification icu.gg2.taxonomy.qza #new taxonomy file to use downstream

```

So, technically you don't need to do any of the Naive Bayes classification steps, and in fact if you look at the bottom of the tutorial in [this](https://forum.qiime2.org/t/introducing-greengenes2-2022-10/25291#can-i-still-use-naive-bayes-for-taxonomy-classification-8) section it recommends against using it. But, if you did want to use it anyways for some reason, you can download the full-length pre-trained classifier they provide in that page and follow the usual steps you would for your NB workflow.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Mehrbod\_Estaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/mehrbod_estaki/32/4001_2.png) [@Mehrbod\_Estaki](https://forum.qiime2.org/u/Mehrbod_Estaki)\
**Post date:** [November 27, 2023, 8:55pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/13 "2023-11-27T20:55:54Z")

</div>



---

<div class="post-metadata">

**Author:** ![Linda\_Abenaim](https://forum.qiime2.org/user_avatar/forum.qiime2.org/linda_abenaim/32/17111_2.png) [@Linda\_Abenaim](https://forum.qiime2.org/u/Linda_Abenaim)\
**Post date:** [November 28, 2023, 9:55am UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/14 "2023-11-28T09:55:45Z")

</div>

> [@Mehrbod\_Estaki](#):
>
> ```auto
> qiime greengenes2 taxonomy-from-table \
> --i-reference-taxonomy 2022.10.taxonomy.asv.nwk.qza \ #download from gg2
> --i-table icu.gg2.biom.qza \ #table from last step
> --o-classification icu.gg2.taxonomy.qza #new taxonomy file to use downstream
> 
> ```

I don't understand why I have this error:

Usage: qiime greengenes2 taxonomy-from-table [OPTIONS]

Pull lineage information for each feature off thereference phylogey

Inputs:  
--i-reference-taxonomy ARTIFACT  
Phylogeny[Rooted] The reference taxonomy to derive from. Note that this  
input corresponds to the .nwk reference artifact  
[required]  
--i-table ARTIFACT FeatureTable[Frequency]  
The feature table to classify [required]  
Outputs:  
--o-classification ARTIFACT FeatureData[Taxonomy]  
The resulting classifications [required]  
Miscellaneous:  
--output-dir PATH Output unspecified results to a directory  
--verbose / --quiet Display verbose output to stdout and/or stderr during  
execution of this action. Or silence output if  
execution is successful (silence is golden).  
--example-data PATH Write example data and exit.  
--citations Show citations and exit.  
--help Show this message and exit.

```
              There were some problems with the command:                  

```

(1/2) Missing option '--o-classification'. ("--output-dir" may also be used)  
(2/2) Got unexpected extra argument ( )  
/var/spool/slurmd/job6216383/slurm\_script: line 22: --output-dir: command not found

this is my command:  
qiime greengenes2 taxonomy-from-table   
--i-reference-taxonomy taxonomygg22.2/2022.10.taxonomy.asv.nwk.qza   
--i-table taxonomygg22.2/gg2filtered-table.qza \   
--o-classification taxonomygg22.2/gg2-taxonomy.qza

---

<div class="post-metadata">

**Author:** ![wasade](https://forum.qiime2.org/user_avatar/forum.qiime2.org/wasade/32/2317_2.png) [@wasade](https://forum.qiime2.org/u/wasade)\
**Post date:** [November 28, 2023, 4:57pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/15 "2023-11-28T16:57:15Z")

</div>

Hi @Linda_Abenaim,

I suspect the comments (e.g., what follows after `#`) are not working correct with the line breaks (`\`). Can you remove the comments, and any whitespace which follows the slash, and rerun?

All the best,  
Daniel

---

<div class="post-metadata">

**Author:** ![Linda\_Abenaim](https://forum.qiime2.org/user_avatar/forum.qiime2.org/linda_abenaim/32/17111_2.png) [@Linda\_Abenaim](https://forum.qiime2.org/u/Linda_Abenaim)\
**Post date:** [November 28, 2023, 7:22pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/16 "2023-11-28T19:22:14Z")

</div>

Thanks @wasade Now it works.  
I followed the command that @Mehrbod_Estaki suggested but i noted that in the taxonomy.qzv in feature ID I don't have the feature that I found in my feature table.

What is the problem?  
[gg2-taxonomy.qzv](https://forum.qiime2.org/uploads/short-url/rycs6XODslQFCz73CCT8bCOcFmV.qzv) (1.2 MB)

Also the taxa bar plot of gg2 taxonomy is very different from gg13\_8.  
[taxa-bar-plots-gg2.qzv](https://forum.qiime2.org/uploads/short-url/q23cE9fOYSYZrk39VPZfba7OX1A.qzv) (357.9 KB)  
[taxa-bar-plots-bsf.qzv](https://forum.qiime2.org/uploads/short-url/oUedsCp0fx6RZzeUZd8MMPUU3WW.qzv) (377.9 KB)

---

<div class="post-metadata">

**Author:** ![wasade](https://forum.qiime2.org/user_avatar/forum.qiime2.org/wasade/32/2317_2.png) [@wasade](https://forum.qiime2.org/u/wasade)\
**Post date:** [December 19, 2023, 4:50pm UTC](https://forum.qiime2.org/t/feature-classifier-extract-reads-v3-v4/28408/19 "2023-12-19T16:50:57Z")

</div>

Hi @Linda_Abenaim,

Sorry for the delay, I inadvertently missed the reply here. Do you have an example of a feature ID in your resulting taxonomy output, which was not in your input?

There are significant differences in the taxonomy between 2022.10 and 13\_8, in part as the nomenclature itself has changed quite a bit. I would anticipate though that unweighted and weighted UniFrac, using SEPP insertion via q2-fragment-placement for 13\_8, would exhibit a high Mantel correlation with 2022.10

Best,  
Daniel
