# Understanding pcoa exported file

**URL:** <https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418>\
**Category:** User Support\
**Tags:** pcoa\
**Created:** [October 12, 2022, 7:40am UTC](https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418 "2022-10-12T07:40:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kam](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/k/ee7513/32.png) [@kam](https://forum.qiime2.org/u/kam)\
**Post date:** [October 12, 2022, 7:40am UTC](https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418/1 "2022-10-12T07:40:09Z")

</div>

Hi!

I have exported pcoa.qza file, hoping I will find the value for axis in my ordination.

The output has a line with Eigvals for top 15 axis, proportion explained for top 15 axis, and a "matrix" with sample as the first coulmn (labeld Site) and additional 15 coulmns, all filled with values. my guess would be that the second coulmn (first after Site coulmn) stands for PC1 values for each sample, coulmn 3 stands for PC2, etc.

couple of quests:

- is there a way to get a user-specified number of axis output?
- In this topic ([How to download the axis values of weighted/unweighted unifrac analysis graph generated by qiime in qiime2view? - #3 by Mashuk](https://forum.qiime2.org/t/how-to-download-the-axis-values-of-weighted-unweighted-unifrac-analysis-graph-generated-by-qiime-in-qiime2view/15771/3)) @Mehrbod_Estaki have said it is not possible to download PC axis values. what is the matrix stand for than?

Thanks!

---

<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:** [October 13, 2022, 4:20am UTC](https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418/2 "2022-10-13T04:20:12Z")

</div>

Hi @kam ,  
The issue is that QIIME 2 stores the pcoa results on disk as [scikit-bio OrdinationResults format](http://scikit-bio.org/docs/0.5.4/generated/generated/skbio.stats.ordination.OrdinationResults.html#skbio.stats.ordination.OrdinationResults). So the file contains various information, not only the ordination values.

It is easier to view and interact with these data in python:

```auto
>>> import qiime2 as q2, pandas as pd
>>> from skbio import OrdinationResults
>>> pcs = q2.Artifact.load('jaccard_pcoa_results.qza')
>>> pcs = pcs.view(OrdinationResults)
>>> pcs.samples.iloc[:2,:3]
                                           0 1 2
1928.SRS015121.SRX020555.SRR045717 0.153000 -0.149544 0.078728
1928.SRS064354.SRX020689.SRR048775 -0.202465 0.024489 -0.120242

```

> [@kam](#):
>
> is there a way to get a user-specified number of axis output?

Yes, see the last line of the python example above. I am selecting the first 2 rows and first 3 columns of the dataframe. You could instead write `pcs.samples.iloc[:,:3]` to select all rows and only the first 3 axes.

Good luck!

---

<div class="post-metadata">

**Author:** ![kam](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/k/ee7513/32.png) [@kam](https://forum.qiime2.org/u/kam)\
**Post date:** [October 13, 2022, 9:23am UTC](https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418/3 "2022-10-13T09:23:07Z")

</div>

Thanks @Nicholas_Bokulich!

> Yes, see the last line of the python example above. I am selecting the first 2 rows and first 3 columns of the dataframe. You could instead write `pcs.samples.iloc[:,:3]` to select all rows and only the first 3 axes.

Yes, this is displaying the selected rows based on pandas indexing. I was referring to the data itself - is it possible to get more than values for 15 lines as I received from my data?

> The issue is that QIIME 2 stores the pcoa results on disk as [scikit-bio OrdinationResults format](http://scikit-bio.org/docs/0.5.4/generated/generated/skbio.stats.ordination.OrdinationResults.html#skbio.stats.ordination.OrdinationResults). So the file contains various information, not only the ordination values.

Unfortunately I am having an issue with scikit-bio package at the moment, so I will post a photo from the top left of an excel file( 😐) of the exported Jaccard pcoa results from the Moving Pictures tutorial to make sure I got your point:

 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/b/b71998bcdac2ca8e2a3795c6c1e9fd4a33a9c948.png)

If I am understanding correctly, the green cell is the PC1 value of L1S105 sample, and the blue cell is the PC3 value of L1S208 sample?

---

<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:** [October 13, 2022, 10:59am UTC](https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418/4 "2022-10-13T10:59:39Z")

</div>

> [@kam](#):
>
> Yes, this is displaying the selected rows based on pandas indexing. I was referring to the data itself - is it possible to get more than values for 15 lines as I received from my data?

Yes, you can have however many rows as you have samples.

> [@kam](#):
>
> If I am understanding correctly, the green cell is the PC1 value of L1S105 sample, and the blue cell is the PC3 value of L1S208 sample?

Yes

---

<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:** [November 13, 2022, 5:00pm UTC](https://forum.qiime2.org/t/understanding-pcoa-exported-file/24418/5 "2022-11-13T17:00:08Z")

</div>

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