Issue with using summarize_otu_distributions.py (from Earth Microbiome Project) on biom table exported from Qiime2

Hi all,

I am trying to run a python script from Earth Microbiome Project (EMP), summarize_otu_distributions.py, to produce otu distribution data from a biom table exported from Qiime2 (2021.2) feature table artifact (dada2 pipeline with --p-no-hashed-feature-ids option). I got the follow error messages:

Traceback (most recent call last):
  File "summarize_otu_distributions.py", line 61, in <module>
    make_otu_summary(path_table, path_otu_summary)
  File "summarize_otu_distributions.py", line 21, in make_otu_summary
    otu_tax = {i: '; '.join(md['taxonomy']) for v, i, md in table.iter(axis='observation')}
  File "summarize_otu_distributions.py", line 21, in <dictcomp>
    otu_tax = {i: '; '.join(md['taxonomy']) for v, i, md in table.iter(axis='observation')}
TypeError: 'NoneType' object is not subscriptable

I tried one EMP project biom table and it worked fine. I also compared my biom table and EMP biom table with biom head and they appear to have same data structure:

My biom table - 
    # Constructed from biom file
    #OTU ID	Amb_M_cam_g287-1	Amb_M_cam_g287-2	Amb_M_cam_g287-3	Amb_M_obe_g166-2	Dol_T_alb_k324-2
    TACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCGTAAAGAGTACGTAGGTGGCTTATTAAGTCAGATGTGAAATCCCTGAGCTCAACTTAGGAACTGCATTTGAAACTGATAATGCTAGAGTTTCGTAGAGGGGGGTAGAATTCCAGGTGTAGCGGTGAAATGCGTAGAGATCTGGAGGAATACCAGTGGCGAAGGCGGCCCCCTGGACGAAAACTGACACTCAGGTACGAAAGCATGGGGAGCAAACAGG	0.0	0.0	0.0	0.0	0.0
    TACGAAGGGGGCGAGCGTTGCTCGGAATGACTGGGCGTAAAGGGCGTGTAGGCGGTTTAATGCTGTCAGATGTGAAATTTTTGGGCTTAACCTGAAACGTGCATTTGAAACGGTTAGACTAGAGTTCGAGAGAGGATAGCGGAATTCCCAGTGTAGAGGTGAAATTCGTAGATATTGGGAAGAACACCGGTTGCGAAGGCGGCTATCTGGCTCGACACTGACGCTGAGGCGCGAAAGCGTGGGGAGCAAACAGG	0.0	0.0	0.0	0.0	0.0
    TACGAAGGGGGCAAGCGTTGCTCGGAATGACTGGGCGTAAAGGGCGTGCAGGCGGTTTATAGCTGTTGGGTGTGAAATTTTGGGGCTTAACCCTGAAACTGCATTCAAGACGTATAGACTAGAGTATGTGAGAGGATAGTGGAATTCCCAGTGTAGAGGTGAAATTCGTAGATATTGGGAAGAACACCGGTTGCGAAGGCGGCTATCTGGTGCATTACTGACGCTGAGGCGCGAAAGCGTGGGGAGCAAACAGG	0.0	0.0	0.0	0.0	0.0
    TACGAAGGGGGCAAGCGTTGCTCGGAATAACTGGGCGTAAAGGGCGCGTAGGCGGTTAATAGCAGTCAGATGTGAAATCTTCGGGCTTAACCTGAAGCCTGCATTTGATACGTATTAGCTAGAGTATGAGAGAGGATTGTGGAATTCCCAGTGTAGAGGTGAAATTCGTAGATATTGGGAAGAACACCAGTTGCGAAGGCGACAATCTGGCTCATTACTGACGCTGAGGCGCGAAAGCGTGGGGAGCAAACAGG	0.0	0.0	0.0	0.0	0.0
    TACGAAGGGGGCAAGCGTTGCTCGGAATAACTGGGCGTAAAGGGCGCGTAGGCGGTTAATAGCAGTCAGATGTGAAATCTTTGGGCTTAACCTGAAGTCTGCATTTGATACGTATTAGCTAGAGTGTGAGAGAGGATTGTGGAATTCCCAGTGTAGAGGTGAAATTCGTAGATATTGGGAAGAACACCAGTTGCGAAGGCGACAATCTGGCTCATTACTGACGCTGAGGCGCGAAAGCGTGGGGAGCAAACAGG	0.0	0.0	0.0	0.0	0.0

EMP biom table - 
# Constructed from biom file
#OTU ID	1883.2008.269.Crump.Artic.LTREB.main.lane2.NoIndex	1453.45796SDZ4.G4.Pnem.stom	1039.L.Vermelha.SA	1773.Thraupis.gauco3.lgi	1453.45300SDZ4.D7.Pnem.stom
TACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCGTAAAGCGCACGTAGGCGGCTGTTTAAGCTAGCTGTGAAAGCCCCGGGCTTAAC	0.0	0.0	0.0	0.0	0.0
TACGGAGTGTGCAAGCGTTACTCGGAATCACTGGGCATAAAGAGCACGTAGGCGGGTCACCAAGTCAGCCGTGAAAGCCCCCGGCCCAAC	0.0	0.0	0.0	0.0	0.0
TACGAGAGGTCCAAACGTTATTCGGAATTACTGGGCTTAAAGAGTTCGTAGGCGGCTAAGTAAGTGGGATGTGAAAGCCCTCGGCTCAAC	0.0	0.0	0.0	0.0	0.0
TACGTAGGTGGCAAGCGTTATCCGGAATTACTGGGTGTAAAGGGTGTGTAGGCGGGGCAGCAAGTCTGATGTGAAAATTAGAGGCTCAAC	0.0	0.0	0.0	0.0	0.0
TACGGAAGGTCCGGGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGTAGGCGGGCTGTCAAGTCAGCGGTAAAATCGTGCGGCTCAAC	0.0	0.0	0.0	0.0	0.0

I'd very appreciate any help and advice!
Best, Ding

EMP biom table
summarize_otu_distributions.py (2.9 KB)

Ok, an update.

I've looked into my biom file and realized that I do not have (of course) taxonomy classification. Now the question became: how do I merge my taxonomy artifact to my feature table artifact? Then I can export (hopefully) the right format of biom table.

Or, is there a direct way to add taxonomy from my taxonomy artifact to my biom table?

Hi @dinhe878 ,
Here is a link to the instruction how to add taxonomy information to a biom file.

1 Like

Ok I found a previous post that may resolve my problem. I'll post an update later.

Thanks a lot @timanix. Now my issue is resolved :slight_smile:

1 Like