Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sample_metadata-methods

Access meta data from biom-class.


Description

Retrieve and organize meta data from biom-class, represented as a data.frame (if possible, or a list) with proper index names.

Usage

sample_metadata(x, columns, parallel = FALSE)

## S4 method for signature 'biom,missing'
sample_metadata(x, columns, parallel = FALSE)

## S4 method for signature 'biom,character'
sample_metadata(x, columns, parallel = FALSE)

## S4 method for signature 'biom,numeric'
sample_metadata(x, columns, parallel = FALSE)

Arguments

x

(Required). An instance of the biom-class.

columns

(Optional). The subset of column indices described in the returned object. For large datasets, specifying the column subset here, rather than after creating the whole matrix first, can improve speed/efficiency. Can be vector of index numbers (numeric-class) or index names (character-class).

parallel

(Optional). Logical. Whether to perform the accession parsing using a parallel-computing backend supported by the plyr-package via the foreach-package.

Value

A data.frame or list containing the meta data, with index names. The precise form of the object returned depends on the metadata stored in x. A data.frame is created if possible.

Examples

min_dense_file   = system.file("extdata", "min_dense_otu_table.biom", package = "biomformat")
min_sparse_file  = system.file("extdata", "min_sparse_otu_table.biom", package = "biomformat")
rich_dense_file  = system.file("extdata", "rich_dense_otu_table.biom", package = "biomformat")
rich_sparse_file = system.file("extdata", "rich_sparse_otu_table.biom", package = "biomformat")
min_dense_file   = system.file("extdata", "min_dense_otu_table.biom", package = "biomformat")
rich_dense_char  = system.file("extdata", "rich_dense_char.biom", package = "biomformat")
rich_sparse_char  = system.file("extdata", "rich_sparse_char.biom", package = "biomformat")
# Read the biom-format files
x1 = read_biom(min_dense_file)
x2 = read_biom(min_sparse_file)
x3 = read_biom(rich_dense_file)
x4 = read_biom(rich_sparse_file)
x5 = read_biom(rich_dense_char)
x6 = read_biom(rich_sparse_char)
# Extract metadata
sample_metadata(x1)
sample_metadata(x2)
sample_metadata(x3)
sample_metadata(x3, 1:4)
sample_metadata(x4)
sample_metadata(x5)
sample_metadata(x6)

biomformat

An interface package for the BIOM file format

v1.18.0
GPL-2
Authors
Paul J. McMurdie <mcmurdie@stanford.edu> and Joseph N Paulson <jpaulson@jimmy.harvard.edu>
Initial release
2016-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.