Description Usage Arguments Details Value References See Also Examples
This function creates a valid instance of the biom-class
from standard base-R objects like
matrix-class
or data.frame
.
This makes it possible to export any contingency table data
represented in R to
the biom-format,
regardless of its source.
The object returned by this function is appropriate for writing to
a .biom
file using the write_biom
function.
The sparse biom-format is not (yet) supported.
1 2 | make_biom(data, sample_metadata = NULL, observation_metadata = NULL,
id = NULL, matrix_element_type = "int")
|
data |
(Required).
|
sample_metadata |
(Optional).
A |
observation_metadata |
(Optional).
A |
id |
(Optional). Character string. Identifier for the project. |
matrix_element_type |
(Optional). Character string. Either 'int' or 'float' |
The BIOM file format (canonically pronounced biome) is designed to be a general-use format for representing biological sample by observation contingency tables. BIOM is a recognized standard for the Earth Microbiome Project and is a Genomics Standards Consortium candidate project. Please see the biom-format home page for more details.
An object of biom-class
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # import with default parameters, specify a file
biomfile = system.file("extdata", "rich_dense_otu_table.biom", package = "biomformat")
x = read_biom(biomfile)
data = biom_data(x)
data
smd = sample_metadata(x)
smd
omd = observation_metadata(x)
omd
# Make a new biom object from component data
y = make_biom(data, smd, omd)
# Won't be identical to x because of header info.
identical(x, y)
# The data components should be, though.
identical(observation_metadata(x), observation_metadata(y))
identical(sample_metadata(x), sample_metadata(y))
identical(biom_data(x), biom_data(y))
## Quickly show that writing and reading still identical.
# Define a temporary directory to write .biom files
tempdir = tempdir()
write_biom(x, biom_file=file.path(tempdir, "x.biom"))
write_biom(y, biom_file=file.path(tempdir, "y.biom"))
x1 = read_biom(file.path(tempdir, "x.biom"))
y1 = read_biom(file.path(tempdir, "y.biom"))
identical(observation_metadata(x1), observation_metadata(y1))
identical(sample_metadata(x1), sample_metadata(y1))
identical(biom_data(x1), biom_data(y1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.