Merged abundance table to biom format

Hi community!!!
I want to import metaphlan output of 60 samples to phyloseq. For that, I want to import the biom format of merged abundance table output from merge_metaphlan_tables.py. Can anyone please tell me how can I convert this merged table into biom file so that I can import it into phyloseq?

Thanks,
DC7

There’s no need to convert to biom, you can load the table with the merged profiles as an otu_table object. There’s a full and exhaustive tutorial on the phyloseq github page

1 Like

Thanks a lot @fbeghini. I am following the tutorial and successfully imported it in phyloseq.
But I am facing one important “ERROR” there which says the abundance proportion is not accepted their. They accepts read count. Have you ever tried phyloseq and encountered such error? Do you have any other way to do the analysis within phyloseq bypassing this problem? Here is the error message:

My code:

alpha_meas = c(“Observed”, “Chao1”, “ACE”, “Shannon”, “Simpson”, “InvSimpson”)
p ← plot_richness(physeq1, “type”, measures=alpha_meas, color=“time”)

ERROR returned:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 't': function accepts only integers (counts)
In addition: Warning message:
In estimate_richness(physeq, split = TRUE, measures = measures) :
  The data you have provided does not have
any singletons. This is highly suspicious. Results of richness
estimates (for example) are probably unreliable, or wrong, if you have already
trimmed low-abundance taxa from the data.

We recommended that you find the un-trimmed data and retry.

Thanks and regards,
DC7

It may be possible that the column type is not a numeric and a string/factor instead.
You should cast the numeric values in the otu table to numeric with as.numeric.

This is a support page for the BioBakery tools, for issues with other tools like phyloseq, I suggest you to post in their specific support page

1 Like

Hello researcher and developer @fbeghini.

It’s my first time to analyse shotgun and I have difficulties to communicate metaphlan output to phyloseq.

I have used merge_metaphlan_tables.py but in absolute counts (code available from https://forum.biobakery.org/t/merge-metaphlan-tables-py-with-absolute-abundance/1839) but when I tried to construct the otu table I obtained the following output:

I have all the taxonomic ranks mixed in the first column. Therefore, I understand that I cannot do tax_glomf function in phyloseq R package.

Therefore it will be interesting to construct 7 independent OTU tables (one for each taxonomic rank) and construct 7 phyloseq objects?

Thanks for your help,

Kind regards,

Magí.

Hello!
As I understood (I am not from the team, just passing by), you need to filter your merged table first, before converting it to biom. You can use ‘k__’, ‘s__’ and other substrings to get tables collapsed to certain taxonomy rank (as you already noticed, in the Metaphlan3 output all ranks are mixed).

It depends on the questions you are going to address in your study. You can choose 1 taxonomy level, 2 or all 7 levels.

Thank you @timyerg for your hints!

Magi.

Hello @timyerg @D11 @DEEPCHANDA7,

Kindly do you have the script for creating a phyloseq object for a Metaphlan 4 merged output to perform the downstream analysis?

thank you in advance

Hello, unfortunately, I don’t have that kind of script. Probably, creating new topic will be a faster way to get respond on that.

1 Like

thanks @timyerg for your reply and suggestion

You may want to use metaphlan_to_phyloseq: Create a phyloseq object from Metaphlan profiles in g-antonello/gautils2: Wrapper of my functions to wrangle mostly microbiome data. This function helped me import MetaPhlAn output quite easily.

1 Like

Hi @Herve
Thanks a lot for your suggestion,
actually I used mia package to create a tse object then converted to phyloseq one, in case anyone needs to do the same.

regards!