write_biom {rbiom} | R Documentation |
Save an rbiom object to a file.
Description
Automatically creates directories and adds compression based on file name.
write_biom()
-According to BIOM format specification.
write_xlsx()
-Raw data and summary tables in Excel file format. See details.
write_fasta()
-Sequences only in fasta format.
biom
may also be a named character vector.write_tree()
-Phylogenetic tree only in newick format.
biom
may also be a phylo object.write_counts()
,write_metadata()
,write_taxonomy()
-Tab-separated values.
Usage
write_biom(biom, file, format = "json")
write_metadata(biom, file, quote = FALSE, sep = "\t", ...)
write_counts(biom, file, quote = FALSE, sep = "\t", ...)
write_taxonomy(biom, file, quote = FALSE, sep = "\t", ...)
write_fasta(biom, file = NULL)
write_tree(biom, file = NULL)
write_xlsx(biom, file, depth = 0.1, n = NULL, seed = 0, unc = "singly")
Arguments
biom |
An rbiom object, such as from |
file |
Path to the output file. File names ending in |
format |
Options are |
quote , sep , ... |
Parameters passed on to |
depth , n |
Passed on to |
seed |
Random seed to use in rarefying. See |
unc |
How to handle unclassified, uncultured, and similarly ambiguous taxa names. Options are:
Abbreviations are allowed. Default: |
Details
For write_xlsx()
, attributes(biom)
are saved as additional worksheets if
the attribute is a data frame, matrix, or dist -class object. An attribute
named 'Reads Per Step' is treated specially and merged with the usual 'Reads
Per Sample' tab.
Value
The normalized filepath that was written to (invisibly), unless
file=NULL
(see file
argument above).
Examples
library(rbiom)
write_tree(hmp50) %>% substr(1, 50)
if (FALSE) {
hmp10 <- hmp50$clone()
hmp10$counts <- hmp10$counts[,1:10] %>% rarefy_cols()
attr(hmp10, "Weighted UniFrac") <- bdiv_distmat(hmp10, 'unifrac')
attr(hmp10, "Unweighted Jaccard") <- bdiv_distmat(hmp10, 'jaccard', weighted=FALSE)
outfile <- write_xlsx(hmp10, tempfile(fileext = ".xlsx"))
}