alpha diversity index/metrics

qiime diversity core-metrics-phylogenetic
–i-phylogeny rooted-tree.qza
–i-table table.qza
–p-sampling-depth 1103
–m-metadata-file sample-metadata.tsv
–output-dir core-metrics-results
This script will produce 4 alpha diversity index/metrics(Shannon’s diversity index \Observed Features\Faith’s Phylogenetic Diversity\Evenness).
How could I GET others? Such as simpson、chao1、ACE,etc.

Hi! Check the documentation here


See also the overview tutorial for a flowchart depicting what core-metrics is doing behind the scenes and how you can replicate that pipeline with other metrics:

(it may be slightly out of date with the introduction of diversity-lib but should give you an idea of the workflow, cc: @ChrisKeefe)

1 Like

Though the Methods in diversity-lib will absolutely do what you need, I’d recommend using q2-diversity for diversity calculations whenever possible, as it provides a simpler user interface.

q2_diversity.alpha will compute all of the other indices you mentioned, @gaolei, and there are similar Pipelines for beta and beta_phylogenetic calculations.

@timanix, the q2-diversity-lib plugin “implements” diversity calculations in a way that lets us support more FeatureTable subtypes for appropriate methods, method-specific citations, etc. The alpha, beta, etc. pipelines in q2-diversity dispatch to these diversity-lib methods, so users get the benefits of diversity-lib without having to use diversity-lib directly.

@Nicholas_Bokulich, thanks for sharing that flowchart. You’re exactly right that it’s no longer literally accurate, but the general idea is still spot on: rarefy, calculate diversity metrics, then visualize them. Changes made recently are mostly transparent to users who want to build their own pipelines. The added layer of indirection where the alpha, beta, etc. pipelines call methods from diversity-lib will happen without users having to think about it.


[email protected],I have found q2_diversity.alpha is a more available way to count diversity metrics. But, if there is a effective method to get several diversity metrics by setting --p-metric? How can I to do that? Now, I just can get diversity metrics one by one. Such as the following script:
qiime diversity alpha --i-table table.qza --p-metric observed_otus --o-alpha-diversity alpha-diversity-metrics/observed_otus.qza
qiime diversity alpha --i-table table.qza --p-metric ace --o-alpha-diversity ace.qza
qiime diversity alpha --i-table table.qza --p-metric simpson --o-alpha-diversity alpha-diversity-metrics/simpson.qza
qiime diversity alpha --i-table table.qza --p-metric shannon --o-alpha-diversity alpha-diversity-metrics/shannon.qza
qiime diversity alpha --i-table table.qza --p-metric chao1 --o-alpha-diversity alpha-diversity-metrics/chao1.qza
qiime diversity alpha --i-table table.qza --p-metric pielou_e --o-alpha-diversity alpha-diversity-metrics/pielou_e.qza
qiime diversity alpha --i-table table.qza --p-metric goods_coverage --o-alpha-diversity alpha-diversity-metrics/goods_coverage.qza

Having a QIIME 2 Method produce an arbitrary number of Results based on what parameters we pass it isn’t possible yet, but there are a few different ways you could tackle this. Feel free to use whatever approach makes the most sense to you.

  1. Copy-paste BASH script:
    Often, once I’ve completed an analysis I might want to repeat, I’ll just copy-paste the commands into a BASH script. Next time you need it, you can just align the input names and re-run.

  2. Smarter BASH script:
    It’s pretty easy to clean up what you’re doing here with simple iteration. This code is just a sketch and hasn’t been tested, but it should give you the idea. NOTE: you’ll probably want to use a rarefied feature table as the input here. If you run core-metrics-phylogenetic first, that will handle some of your calculations, and will also output the rarefied table it used to perform them.

for METRIC in  observed_otus ace simpson shannon chao1 pieloue_e goods_coverage
qiime diversity alpha \
--i-table table.qza \
--p-metric $METRIC \
--o-alpha-diversity alpha-diversity-metrics/${METRIC}.qza
  1. If you’re familiar with Python, you could also use the Artifact API to compose a workflow of your own. It could take inspiration from the flowchart @Nicholas_Bokulich shared above, but running your preferred metrics instead.

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