# Multiple metrics in a single command (qiime diversity alpha)

**URL:** https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508
**Category:** User Support
**Tags:** diversity
**Created:** [February 6, 2020, 12:19pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508 "2020-02-06T12:19:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![thedam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/thedam/32/5854_2.png) [@thedam](https://forum.qiime2.org/u/thedam)
#### Post date: [February 6, 2020, 12:19pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/1 "2020-02-06T12:19:26Z")

</div>

Hi, is it possible to run several metrics at once? for example something like:

> ```
> qiime diversity alpha \
> --i-table table.qza \
> --p-metric shannon,observed_otus,goods_coverage \
> --o-alpha-diversity metrics.qza
> 
> ```

above doesn't work 🙂  
thanks!

---

<div class="post-metadata">

### Author: ![lca123](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@lca123](https://forum.qiime2.org/u/lca123)
#### Post date: [February 6, 2020, 1:20pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/2 "2020-02-06T13:20:15Z")

</div>

As the following also doesn't work,

```
qiime diversity alpha \
        --i-table table.qza \
        --p-metric shannon \
        --p-metric pielou_e \
        --o-alpha-diversity out

```

what I do is a simple bash for loop:  
for i in shannon pielou\_e  
do  
qiime diversity alpha   
--i-table table.qza   
--p-metric "$i"   
--o-alpha-diversity out."$i"  
done

---

<div class="post-metadata">

### Author: ![thedam](https://forum.qiime2.org/user_avatar/forum.qiime2.org/thedam/32/5854_2.png) [@thedam](https://forum.qiime2.org/u/thedam)
#### Post date: [February 6, 2020, 1:22pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/3 "2020-02-06T13:22:28Z")

</div>

and then we need to merge output .tsvs to merged.tsv bleeee, 🙂

---

<div class="post-metadata">

### Author: ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)
#### Post date: [February 6, 2020, 1:25pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/4 "2020-02-06T13:25:30Z")

</div>

I am using Jupyter lab to combine with Python (I don't know bash commands)

```
variants = ['All', 'Root-Gall', 'Infected']
for variant in variants:
    core = 'Data/Core-metrics_analysis/%s_Core-metrics' % variant
    outdir = 'Results/Core-metrics_analysis/%s_Core-metrics' % variant

#Alpha diversity comparisons¶    
    alpha_diversity = ['shannon', 'faith_pd', 'evenness', 'observed_otus']
    for alpha in alpha_diversity:
        vector = core+'/%s_vector.qza' % alpha
        ags_qzv = outdir+'/%s_vector_alpha-group-sign.qzv' % alpha
        
        !qiime diversity alpha-group-significance \
            --i-alpha-diversity $vector \
            --m-metadata-file Metadata/metadata.tsv \
            --o-visualization $ags_qzv

```

> [@thedam](#):
>
> and then we need to merge output .tsvs to merged.tsv bleeee, 🙂

Yeah, after I use more Python to unpack the outputs, merge tables and plot figures.  
I learned a lot of Python because of it.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [February 6, 2020, 1:43pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/5 "2020-02-06T13:43:28Z")

</div>

> [@timanix](#):
>
> I am using Jupyter lab to combine with Python (I don’t know bash commands)

Hey @timanix, I suggest you check out the Artifact API, it will provide a much more convenient way for working with QIIME 2 in a python environment:

[https://docs.qiime2.org/2019.10/interfaces/artifact-api/](https://docs.qiime2.org/2019.10/interfaces/artifact-api/)

> [@Moving Pictures Python API tutorial (QIIME2 2018.4)](https://forum.qiime2.org/t/moving-pictures-python-api-tutorial-qiime2-2018-4/4112):
>
> I rewrote the ["Moving Pictures" tutorial using QIIME2 Python API](https://gist.github.com/tkosciol/29de5198a4be81559a075756c2490fde). The original QIIME2 CLI "Moving Pictures" tutorial can be accessed [here](https://docs.qiime2.org/2018.4/tutorials/moving-pictures/). It takes advantage of the latest QIIME2 2018.4 functionalities, especially displaying visualizations in the notebook. You can also [view it in nbviewer](http://nbviewer.jupyter.org/gist/tkosciol/29de5198a4be81559a075756c2490fde). This notebook should be treated as experimental and its goal is to provide a starting point for the users in going from the CLI to Python API. t.

---

<div class="post-metadata">

### Author: ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)
#### Post date: [February 6, 2020, 2:07pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/6 "2020-02-06T14:07:55Z")

</div>

> [@thermokarst](#):
>
> Hey @timanix, I suggest you check out the Artifact API, it will provide a much more convenient way for working with QIIME 2 in a python environment

Thanks! I will try it

---

<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 8, 2020, 8:07pm UTC](https://forum.qiime2.org/t/multiple-metrics-in-a-single-command-qiime-diversity-alpha/13508/7 "2020-03-08T20:07:58Z")

</div>

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