# Code Review: Custom QIIME 2

**URL:** https://forum.qiime2.org/t/code-review-custom-qiime-2/32568
**Category:** General Discussion
**Created:** [February 18, 2025, 9:44pm UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568 "2025-02-18T21:44:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Sujan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sujan](https://forum.qiime2.org/u/Sujan)
#### Post date: [February 18, 2025, 9:44pm UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568/1 "2025-02-18T21:44:57Z")

</div>

We previously used the following code with the Greengenes 13.8 database. Now, we would like to use the latest version of the database. Which parts of the code need to be modified to accommodate this update?

#Activation  
conda activate qiime2-amplicon-2024.10

1. Importing data (“Fastq manifest” formats)

1.1 import

qiime tools import   
--type 'SampleData[PairedEndSequencesWithQuality]'   
--input-path manifest   
--output-path 1\_1\_demux.qza   
--input-format PairedEndFastqManifestPhred33V2

#Single end read  
#--type 'SampleData[SequencesWithQuality]'  
#--input-format SingleEndFastqManifestPhred33V2  
#--input-format SingleEndFastqManifestPhred64V2

#Paired end read  
#--type 'SampleData[PairedEndSequencesWithQuality]'  
#--input-format PairedEndFastqManifestPhred33V2  
#--input-format PairedEndFastqManifestPhred64V2

1.2 Joining paired end reads

qiime vsearch merge-pairs   
--i-demultiplexed-seqs 1\_1\_demux.qza   
--o-merged-sequences 1\_2\_demux-joined.qza   
--o-unmerged-sequences 1\_2\_ummerged.qza

##summary  
qiime demux summarize   
--i-data 1\_2\_demux-joined.qza   
--o-visualization 1\_2\_demux-joined.qzv

##View  
qiime tools view 1\_2\_demux-joined.qzv #score dekhbo for denosing value setting

1.3 Quality filter

qiime quality-filter q-score   
--i-demux 1\_2\_demux-joined.qza   
--p-min-quality 20   
--o-filtered-sequences 1\_3\_demux-joined-filtered.qza   
--o-filter-stats 1\_3\_demux-joined-filter-stats.qza

##summary  
qiime demux summarize   
--i-data 1\_3\_demux-joined-filtered.qza   
--o-visualization 1\_3\_demux-joined-filtered.qzv

##View  
qiime tools view 1\_3\_demux-joined-filtered.qzv

##status filter

qiime metadata tabulate   
--m-input-file 1\_3\_demux-joined-filter-stats.qza   
--o-visualization 1\_3\_demux-joined-filter-stats.qzv

##View  
qiime tools view 1\_3\_demux-joined-filter-stats.qzv

1.4 Dereplicate-sequences

qiime vsearch dereplicate-sequences   
--i-sequences 1\_2\_demux-joined.qza   
--o-dereplicated-table 1\_4\_table.qza   
--o-dereplicated-sequences 1\_4\_rep-seqs.qza

1.5 De novo clustering

qiime vsearch cluster-features-de-novo   
--i-table 1\_4\_table.qza   
--i-sequences 1\_4\_rep-seqs.qza   
--p-perc-identity 0.99   
--p-threads 36   
--o-clustered-table 1\_5\_table-dn-99.qza   
--o-clustered-sequences 1\_5\_rep-seqs-dn-99.qza

1.6 de novo chimera checking

qiime vsearch uchime-denovo   
--i-table 1\_5\_table-dn-99.qza   
--i-sequences 1\_5\_rep-seqs-dn-99.qza   
--output-dir 1\_6\_uchime-dn-out

1.7 Exclude chimeras and “borderline chimeras”

a.  
qiime feature-table filter-features   
--i-table 1\_5\_table-dn-99.qza   
--m-metadata-file 1\_6\_uchime-dn-out/nonchimeras.qza   
--o-filtered-table 1\_7a\_table-dn-99.qza

b.  
qiime feature-table filter-seqs   
--i-data 1\_5\_rep-seqs-dn-99.qza   
--m-metadata-file 1\_6\_uchime-dn-out/nonchimeras.qza   
--o-filtered-data 1\_7b\_rep-seqs-dn-99.qza

c.  
qiime feature-table summarize   
--i-table 1\_7a\_table-dn-99.qza   
--o-visualization 1\_7a\_table-dn-99.qzv

d.  
qiime tools view 1\_7a\_table-dn-99.qzv

2.1 Generate a tree for phylogenetic diversity analyses

qiime phylogeny align-to-tree-mafft-fasttree   
--i-sequences 1\_7b\_rep-seqs-dn-99.qza   
--p-n-threads 34   
--o-alignment 2.1\_aligned-rep-seqs.qza   
--o-masked-alignment 2.1\_masked-aligned-rep-seqs.qza   
--o-tree 2.1\_unrooted-tree.qza   
--o-rooted-tree 2.1\_rooted-tree.qza

1. Taxonomic assaignment

3.1 Obtaining reference data sets

[Link: [QIIME](http://qiime.org/home_static/dataFiles.html)]

wget [ftp://greengenes.microbio.me/greengenes\_release/gg\_13\_5/gg\_13\_8\_otus.tar.gz](ftp://greengenes.microbio.me/greengenes_release/gg_13_5/gg_13_8_otus.tar.gz)

[Note: unzip the file and copy 99\_otus.fasta and 99\_otu\_taxonomy.txt files]

#######################################################

3.2 Importing reference data sets to qiime  
(a)

qiime tools import   
--type 'FeatureData[Sequence]'   
--input-path 99\_otus.fasta   
--output-path 3\_2a\_ref-99\_otus.qza

(b)

qiime tools import   
--type 'FeatureData[Taxonomy]'   
--input-format HeaderlessTSVTaxonomyFormat   
--input-path 99\_otu\_taxonomy.txt   
--output-path 3\_2b\_ref-99\_taxonomy.qza

3.3 Extract reference reads  
#time consuming  
Forward primer = CCTACGGGNGGCWGCAG  
Reverse Primer = GACTACHVGGGTATCTAATCC

qiime feature-classifier extract-reads   
--i-sequences 3\_2a\_ref-99\_otus.qza   
--p-f-primer CCTACGGGNGGCWGCAG   
--p-r-primer GACTACHVGGGTATCTAATCC   
--p-min-length 300   
--p-max-length 500   
--o-reads 3\_3\_ref-seqs.qza

3.4 Train the classifier

qiime feature-classifier fit-classifier-naive-bayes   
--i-reference-reads 3\_3\_ref-seqs.qza   
--i-reference-taxonomy 3\_2b\_ref-99\_taxonomy.qza   
--o-classifier 3\_4\_classifier.qza

################################################################

3.5 Taxonomic analysis

(a) classification

qiime feature-classifier classify-sklearn   
--i-classifier 3\_4\_classifier.qza   
--i-reads 1\_7b\_rep-seqs-dn-99.qza   
--o-classification 3\_5a\_taxonomy.qza

(b) summary

qiime metadata tabulate   
--m-input-file 3\_5a\_taxonomy.qza   
--o-visualization 3\_5b\_taxonomy.qzv

(c) view

qiime tools view 3\_5b\_taxonomy.qzv

3.6 Bar plot

qiime taxa barplot   
--i-table 1\_7a\_table-dn-99.qza   
--i-taxonomy 3\_5a\_taxonomy.qza   
--m-metadata-file metadata.tsv   
--o-visualization 3\_6\_taxa-bar-plots.qzv

3.7 Final visualization

qiime tools view 3\_6\_taxa-bar-plots.qzv

---

<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: [February 19, 2025, 7:45am UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568/2 "2025-02-19T07:45:08Z")

</div>

Hi @Sujan ,  
Thanks for your question. I recommend checking out the tutorials on [https://docs.qiime2.org](https://docs.qiime2.org) and in the "Community Contributions/Tutorials" section of this forum, where various other database options and usage examples are shown. You can look to find the option that is right for you.

Good luck!

---

<div class="post-metadata">

### Author: ![Sujan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sujan](https://forum.qiime2.org/u/Sujan)
#### Post date: [February 19, 2025, 9:30am UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568/3 "2025-02-19T09:30:53Z")

</div>

I couldn’t find tutorials for the Greengenes 2022 database. Do we only need to modify the code in sections 3.2 and 3.3, or are changes required in the earlier sections as well?

---

<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: [February 19, 2025, 4:36pm UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568/4 "2025-02-19T16:36:35Z")

</div>

Upstream should be the same, as taxonomy database is (mostly) independent of the denoising process.

Unless you want to change the upstream pipeline because

> **[Exact sequence variants should replace operational taxonomic units in...](https://pmc.ncbi.nlm.nih.gov/articles/PMC5702726/)**
>
> Recent advances have made it possible to analyze high-throughput marker-gene sequencing data without resorting to the customary construction of molecular operational taxonomic units (OTUs): clusters of sequencing reads that differ by less than a ...

---

<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: [February 19, 2025, 5:21pm UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568/5 "2025-02-19T17:21:43Z")

</div>

Hi @Sujan,

Have you worked through the [Greengenes2 tutorial](https://forum.qiime2.org/t/introducing-greengenes2-2022-10/25291)? Additional, information can be found [here](https://forum.qiime2.org/t/greengenes2-2024-09/31606) too, with ftp links to some useful files.

---

<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: [March 22, 2025, 11:22pm UTC](https://forum.qiime2.org/t/code-review-custom-qiime-2/32568/6 "2025-03-22T23:22:36Z")

</div>

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