Merge_metaphlan_tables.py gives different header in Metaphlan4

MetaPhlAn4
Hello, I am merging abundance tables from 6 output table.txt using
merge_metaphlan_tables.py profiled_PB1.txt profiled_PB2.txt profiled_PB3.txt profiled_PB4.txt profiled_PB5.txt profiled_PB6.txt > output/LTS_abundance_table.txt
I am getting different header without “#SampleID” but rather with “clade_name”. See below.

Next, when I am trying to extract only species abundance from this table, using command grep -E “(s__)|(^ID)” LTS_abundance_table.txt | grep -v “t__” | sed ‘s/^.*s__//g’ > LTS_abundance_table_species.txt.

I am getting no header at all in the output file (output below). I see there is no ID head in the input file probably that is why this is happening.

can you please help?

I forgot to upload the output of the profiled abundance table. Similar 5 other tables I am using to merge in to a LTS_abundance_table. This to me looks fine.

Hi @rjain1990
Try to change the first grep command to grep -E "s__|clade" instead

1 Like

I have created the table with absolute read counts but need to break them down into various taxa level.

Can someone please write the script to obtain absolute reads counts at phylum, class, family, genus, species (i can see that above) etc.

Many thanks,

Hi @aitor.blancomiguez Thanks for your response.

It worked now, but I have another issue in creating the heatmap. I am using the following command.
hclust2.py
-i LTS_abundance_table_species.txt
-o LTS_abundance_species.png
–ftop 50
–f_dist_f correlation
–s_dist_f braycurtis
–cell_aspect_ratio 9
-s --fperc 99
–flabel_size 4
–metadata_rows 2,3,4,5,6,7
–legend_file LTS_abundance_species.legend.png
–max_flabel_len 100
–metadata_height 0.075
–minv 0.01
–no_slabels
–dpi 300
–slinkage complete

Requesting your help! I also tried this with galaxy server but again I am unsuccessful.

Hi @mars

grep -E “(s__)|(^ID)” filename.txt | grep -v “t__” | sed ‘s/^.*s__//g’ > filename_species.txt

you can replace s__ (species) with p__ (for phylum), c__ (for class), o__ (for order), f__ (for family), g__ (for genus) for different taxa level.

I hope this help.

It seems a problem with the matplotlib version you are using, can you check and let me know the version you have installed?

The version previously I was using was matplotlib 3.6.2 but than I downgraded to 2.2.3. In both cases it didnt work.
Currently, I can also see matplotlib-base 3.6.2 and metplotlib 2.2.3 in the conda list.

You should probably downgrade matplotlib-base too