Editing heatmap in Qiime2

Hi everyone,
I am working on generating a heatmap using Qiime 2 in Virtualbox. I would like to show only data at the genus level for 6 samples. Firstly, I used qiime taxa filter-table to retain only features that were at annotated to the genus level. Then, I used ** qiime taxa collapse** to collapse features by their taxonomy at the genus level. Finally, I used ** qiime feature-table heatmap** to generate the heatmap. However, the x-axis still showing other taxa that only can annotate at order or family level. Also, in my output .qzv file, the taxa name is k_bacteria: p bacteroidetes:c sphingobacteria,o_ sphingobacteriales:f_ chitinophagaceae:g_arachidicoccus__, for example. I would like to show up the only genus name (e.g. arachidicoccus). I was wondering if qiime2 have any plugin that has this function. Below is the code I used to generate the heatmap.
qiime taxa filter-table
–i-table table.qza
–i-taxonomy customized-gg-99-taxonomy.qza
–p-include g__
–o-filtered-table table-with-genera.qza
qiime taxa collapse
–i-table table-with-genera.qza
–i-taxonomy customized-gg-99-taxonomy.qza
–p-level 6
–o-collapsed-table genera-taxanomy-table.qza
qiime feature-table heatmap
–i-table genera-taxanomy-table.qza
–m-sample-metadata-file MP_PassaicWWTP.tsv
–m-sample-metadata-column Microparticles
–p-cluster ‘features’
–o-visualization customized-gg-99-genera-heatmap.qzv
This is the picture of the heatmap.


Thank you so much for spending your time reading my post.

1 Like

Hi!
I was searching for the same function and did not find it. But you have some options:

  1. Download heatmap as .svg file and edit with svg editor or script. Worked not very well for me.
  2. Export genera-taxonomy-table.qza as a biom then convert it to .tsv and edit taxa manually or with a script to show only genera, convert to biom and import it back to .qza file and then create a heatmap. Exporting, importing and converting commands can be found on this forum, but feel free to ask for it, I will provide them as soon as I will be able to reach my working PC.
2 Likes

Hi Timanix,
Thank you so much for your help. I will try with the second option :grinning:. I would very appreciate if you could send me the commands for exporting, importing and converting.
Have a nice day.

1 Like

Export and convert

mkdir Biom

qiime tools export \
    --input-path table.qza \
    --output-path Biom/

biom convert -i Biom/feature-table.biom -o Biom/feature-table.tsv --to-tsv

Here you will have a .tsv table that you can edit manually or with script, after it import back

biom convert -i Biom/feature-table.tsv -o Biom/feature-table.biom --table-type="OTU table" --to-hdf5

qiime tools import \
    --input-path Biom/feature-table.biom \
    --type 'FeatureTable[Frequency]' \
    --input-format BIOMV210Format \
    --output-path genera_table.qza
2 Likes

Those taxa are actually classified at genus level, but the database annotation only consists of “g__” (i.e., unknown genus). So you are in fact getting what you are telling QIIME 2 to do — select all taxa classified at genus level.

In your qiime taxa filter-table command you could use `–p-exclude ‘f__;g__’ to exclude any classifications with unknown family and genus.

You could then use qiime taxa filter-table a second time with --p-mode exact and then indicate specific taxa that you want to exclude that are not filtered out with that first filter.

2 Likes

Thank you so much :grinning: . I tried based on your suggestion and I could get the desired heat map.

2 Likes

Hi Nicholas_Bokulich,
Thank you so much for your suggestion. I will try the command you mentioned.
Have a nice day.

2 Likes