pcoa biplot at family level

Hello,

I would like to create a pcoa biplot at the family level. Would it be possible to do that? I would also like to show the taxonomic name on the arrow instead of featureID. I tried to use qiime taxa collapse as previously suggested, but It didn't work. Any suggestion? Thanks in advance for the help

Hello!

What exactly did you try?
You can create a collapsed table at desired taxonomy level, then run core-metrics plugin, create a table with relative abundances using rarefied table from core-metrics output and use those files to create biplots.

Hi Timur,

Thank you so much for your quick reply. Yes, I tried to do that. Please find below the commands that I have used:

For the relative frequency table:

qiime feature-table rarefy
--i-table Active-table-main-BP.qza
--p-sampling-depth 7000
--o-rarefied-table Active-table-main-BP-rarefied-table.qza

qiime taxa collapse
--i-table Active-table-main-BP-rarefied-table.qza
--i-taxonomy taxonomy_silva.qza
--o-collapsed-table Active-table-main-BP-rarefied-table-l5.qza
--p-level 5

qiime feature-table relative-frequency
--i-table Active-table-main-BP-rarefied-table-l5.qza
--o-relative-frequency-table Active-table-main-BP-rarefied-table-l5-relative.qza

Then I run the metrics plugin

qiime diversity core-metrics-phylogenetic
--i-table Active-table-main-BP-rarefied-table.qza
--i-phylogeny insertion-tree-silva.qza
--m-metadata-file Metadata_CCE2_Merged.tsv
--p-sampling-depth 7000
--output-dir core-metrics-results_activemainBP

And then I tried the biplot

qiime diversity pcoa-biplot
--i-pcoa weighted_unifrac_pcoa_results_activemainBP.qza
--i-features Active-table-main-BP-rarefied-table-l5-relative.qza
--o-biplot biplot_matrix_weighted_unifrac_activemainBP.qza

qiime emperor biplot
--i-biplot biplot_matrix_weighted_unifrac_activemainBP.qza
--m-sample-metadata-file Metadata_CCE2_Merged.tsv
--m-feature-metadata-file rep-seqs.qza
--p-ignore-missing-samples
--o-visualization weighted_unifrac_emperor_biplot_activemainBP.qzv

But in this last step, It didn't work. If I don't collapse the table, it works.

Thanks for the details.
Could you also provide the error you are getting from the last command?
I remember that I was able to get biplots with collapsed tables, but it was many Qiime2 versions ago.

Just noticed, that this PCoA artifact is located not in the core-metrics results that you got with collapsed table.

Could you try to rerun it with PCoA artifact, created with collapsed core-metrics?

Do you mean to run the qiime diversity core-metrics-phylogenetic using the rarefied collapsed table (Active-table-main-BP-rarefied-table-l5.qza) instead of the rarefied one?

Step 1. Collapse unrarefied table to level 5.
Step 2. Run core-metrics command on collapsed table (note that you should choose a new sampling depth since number of features will decrease after collapse to certain taxonomy level).
Step 3. Convert rarefied table (in core-metrics output) to relative abundances.
Step 4. Create a biplots based on the pcoa files from core-metrics output.
Step 5. Create visualization.

In your command that I cited a comment ago you pointed a pcoa file that was not located in core-metrics output, that you got with collapsed table. Also, you rarefied a table, collapsed and then used core-metrics with the same sampling depth (incorrect) as in first ratefaction command. It would be better to rerun all commands in order above to see if it will solve the problem.

1 Like

Hi Timur,

Very good point. I didn't realise that I was using the rarefied table in the core-metrics. I collapsed the unrarefied table and then run the qiime diversity core-metrics-phylogenetic command and the following error appeared:
Plugin error from diversity:

The table does not appear to be completely represented by the phylogeny.

Debug info has been saved to /var/folders/kg/61tr5gk96nn27myl063_7mqc9wr7b0/T/qiime2-q2cli-err-6rt8057o.log

You are right. To run core-metrics phylogenetic you need a rooted tree. I am not aware if there is an option to create one for collapsed by taxonomy table (hi mods, let me know if I missed it!) in Qiime2.
The workaround will be to use core-metrics non-phylogenetic version of the plugin. That will create only jaccard and bray-Curtis pcoa files since unifracs requirea rooted tree.

PS.
One also can run core-metrics phylogenetic command with uncollapsed table then create biplots with taxonomy artifact as in this tutorial (take a look on the part where they creating biplots).

Hi Timur,

Thank you very much for the suggestions. I also exported the images and edited the labels.