Learn R Programming

rbiom (version 2.2.0)

read_biom: Parse counts, metadata, taxonomy, and phylogeny from a BIOM file.

Description

Parse counts, metadata, taxonomy, and phylogeny from a BIOM file.

Usage

read_biom(src, ...)

Value

An rbiom object.

Arguments

src

Input data as either a file path, URL, or JSON string. BIOM files can be formatted according to version 1.0 (JSON) or 2.1 (HDF5) specifications, or as classical tabular format. URLs must begin with http://, https://, ftp://, or ftps://. JSON files must have { as their first character. Compressed (gzip or bzip2) BIOM files are also supported. NOTE: to read HDF5 formatted BIOM files, the BioConductor R package rhdf5 must be installed.

...

Properties to set in the new rbiom object, for example, metadata, id, comment, or tree.

See Also

as_rbiom()

Examples

Run this code
    library(rbiom)

    infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
    biom <- read_biom(infile)

    print(biom)

    # Taxa Abundances
    biom$counts[1:4,1:10] %>% as.matrix()
    
    biom$taxonomy %>% head()

    # Metadata
    biom$metadata %>% head()
    
    table(biom$metadata$Sex, biom$metadata$`Body Site`)
    
    sprintf("Mean age: %.1f", mean(biom$metadata$Age))

    # Phylogenetic tree
    biom$tree %>%
      tree_subset(1:10) %>%
      plot()

Run the code above in your browser using DataLab