Abundances of taxa by group

Dear all,

I am trying to create a table with the abundances (or relative abundances) of taxa at different taxonomic levels (phylum, family, genus) from my feature table, where the abundances are given not by sample, rather by a category from my metadata file, for example by Sample type. Is this possible or do I need to do it manually summing up the abundances of each sample for that category?
I know that I can use qiime taxa collapse first to collapse at the level I want, but then I don’t know what to do.

A question related to this one is: do you advise to present in a publication the taxonomic barplots and the type of tables I would like to generate which are built from the rarefied feature table or from the complete table?

Thanks a lot in advance

Best wishes

Niccolò

Hey there @alfanon!

You're in luck! Check out feature-table group for a way to regroup your feature table based on sample or feature metadata.:qiime2: :t_rex:

Hi @thermokarst,
thank you for your answer. Great! it worked with that command.
So I first collapse my table at the taxonomic level I am interested, then use “feature-table group” (options: --p-axis sample --m-metadata-file metadata.tsv --m-metadata-column Sampletype --p-mode sum) and then I am able to export the table I wanted.
Now, I tried to create an abundance heatmap from that grouped table in order to have the sample type instead of the samples on one axis. I used the following command:
qiime feature-table heatmap
–i-table table_collapsed_bysampletype.qza
–m-metadata-file metadata.tsv
–m-metadata-column Sampletype --p-normalize --p-metric braycurtis
–p-cluster features --o-visualization table_collapsed_bysampletype_heatmap.qzv
It gives me an error saying that “The following IDs are not present in the metadata:” listing the sample types of my metadata. What am I doing wrong?

Thank you very much
Best wishes

Niccolò

Hello @alfanon!

Well, since you have grouped on new values - you have all new Sample IDs, right?

Run feature-table summarize on the new table (table_collapsed_bysampletype.qza) to see what I mean! :mag:

Thank you @thermokarst! I think I have got it. I simply solved it by using the command qiime feature-table heatmap without the –m-metadata-file and –m-metadata-column options.
Sorry to bother you with another question about this topic. I tried to generate a heatmap based on relative frequencies (so I collapsed the table at the level I wanted, then converted to relative frequencies and then used qiime feature-table heatmap). I get the following error:
“Argument to parameter ‘table’ is not a subtype of FeatureTable[Frequency]”
Is it possible to do what I am trying or the heatmap command already automatically convert itself into relative frequencies?

Thank you
Best
Niccolo

Perfecto!

Oh c'mon, no need to apologize - that is what we are here for! :heart: :smiley:

This viz is designed to accept a FeatureTable[Frequency] Artifact, not FeatureTable[RelativeFrequency]. That is because the action provides its own normalization via the --p-normalize / --p-no-normalize parameters:

  --p-normalize / --p-no-normalize
                                  Normalize the feature table by adding a
                                  psuedocount of 1 and then taking the log10
                                  of the table.  [default: True]

So if I am understanding you correctly, skip the conversion to FeatureTable[RelativeFrequency] after you collapse the table and just go straight to the heatmap.

:qiime2: :t_rex:

1 Like

Nice from you!
All clear now, thanks a lot :slight_smile:

2 Likes

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