View on
Florent Angly > Bio-Community > Bio::Community::IO::Driver::biom



Annotate this POD


View/Report Bugs


Bio::Community::IO::Driver::biom - Driver to read and write files in the sparse BIOM format


   # Reading
   my $in = Bio::Community::IO->new(
      -file   => 'biom_communities.txt',
      -format => 'biom'
   my $type = $in->get_matrix_type; # either dense or sparse

   # Writing
   my $out = Bio::Community::IO->new(
      -file        => 'biom_communities.txt',
      -format      => 'biom',
      -matrix_type => 'sparse', # default matrix type

   # See Bio::Community::IO for more information


This Bio::Community::IO::Driver::biom driver reads and writes files in the BIOM format version 1.0 described at Multiple communities and additional metadata can be recorded in a BIOM file. Here is an example of minimal sparse BIOM file:

      "format": "Biological Observation Matrix 0.9.1-dev",
      "format_url": "",
      "type": "OTU table",
       "generated_by": "QIIME revision 1.4.0-dev",
      "date": "2011-12-19T19:00:00",
              {"id":"GG_OTU_1", "metadata":null},
              {"id":"GG_OTU_2", "metadata":null},
              {"id":"GG_OTU_3", "metadata":null},
              {"id":"GG_OTU_4", "metadata":null},
              {"id":"GG_OTU_5", "metadata":null}
      "columns": [
              {"id":"Sample1", "metadata":null},
              {"id":"Sample2", "metadata":null},
              {"id":"Sample3", "metadata":null},
              {"id":"Sample4", "metadata":null},
              {"id":"Sample5", "metadata":null},
              {"id":"Sample6", "metadata":null}
      "matrix_type": "sparse",
      "matrix_element_type": "int",
      "shape": [5, 6],

Columns (i.e. communities) can be expressed in a richer way, e.g.:

  {"id":"Sample1", "metadata":{
                           "Description":"human gut"}},

The 'id' can be recovered from the name() method of the resulting Bio::Community. Metadata fields are not recorded at this time, but will be in a future release.

Rows (i.e. community members) can also be expressed in a richer form:

  {"id":"GG_OTU_1", "metadata":{"taxonomy":["k__Bacteria", "p__Proteobacteria", "c__Gammaproteobacteria", "o__Enterobacteriales", "f__Enterobacteriaceae", "g__Escherichia", "s__"]}},

For each Bio::Community::Member generated, the id() method contains the 'id' and desc() holds a concatenated version of the 'taxonomy' field. Note that you can omit members entirely from a biom file and simply have community names and metadata.

The 'comment' field of biom files is not recorded and simply ignored.


See Bio::Community::IO.


Florent Angly


User feedback is an integral part of the evolution of this and other Bioperl modules. Please direct usage questions or support issues to the mailing list,, rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

If you have found a bug, please report it on the BioPerl bug tracking system to help us keep track the bugs and their resolution:


Copyright 2011-2014 by Florent Angly <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: