Nothing
################################################################################
# This function is from package biom https://github.com/joey711/biom, authored by Paul J. McMurdie
################################################################################
#' Read a biom-format file, returning a \code{biom-class}.
#'
#' Import the data from a biom-format file into R, represented as an instance
#' of the \code{\link{biom-class}}; essentially a \code{\link{list}} with
#' special constraints that map to \href{http://biom-format.org/documentation/biom_format.html}{the biom-format definition}.
#'
#' 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 \href{http://www.earthmicrobiome.org/}{Earth Microbiome Project} and is a \href{http://gensc.org/}{Genomics Standards Consortium} candidate project. Please see \href{http://biom-format.org/}{the biom-format home page} for more details.
#'
#' It is tempting to include an argument identifying the
#' biom-format version number of the data file being imported.
#' However, the biom-format version number is a required
#' field in the biom-format definition.
#' Rather than duplicate this formal specification
#' and allow the possibility of a conflict, the version
#' number of the biom format will be referred to only by
#' the "format" field in the biom formatted data,
#' or its representation in R.
#'
#' @usage read_biom(biom_file)
#'
#' @param biom_file (Required). A character string indicating the
#' file location of the biom formatted file. This is a JSON formatted file
#' specific to biological datasets.
#' The format is formally defined at \href{http://biom-format.org/documentation/biom_format.html}{the biom-format definition}
#'
#' @return An instance of the \code{biom-class}.
#'
#' @seealso
#'
#' Function to create a biom object from R data,
#' \code{\link{make_biom}}.
#'
#' Definition of the
#' \code{\link{biom-class}}.
#'
#' Function to write a biom format file from a biom object,
#' \code{\link{write_biom}}
#'
#' Accessor functions like \code{\link{header}}.
#'
#' @references \url{http://biom-format.org/}
#'
#' @importFrom RJSONIO fromJSON
#' @export
#' @examples
#' # # # import with default parameters, specify a file
#' biom_file <- system.file("extdata", "rich_sparse_otu_table.biom", package = "biom")
#' biom_file
#' read_biom(biom_file)
#' biom_file <- system.file("extdata", "min_sparse_otu_table.biom", package = "biom")
#' biom_file
#' read_biom(biom_file)
#' ## The previous examples use system.file() because of constraints in specifying a fixed
#' ## path within a reproducible example in a package.
#' ## In practice, however, you can simply provide "hard-link"
#' ## character string path to your file:
#' # mybiomfile <- "path/to/my/biomfile.biom"
#' # read_biom(mybiomfile)
read_biom <- function(biom_file){
# Read the file, storing as a list
# generated by RJSONIO w/ default JSON parsing params
x = fromJSON(biom_file)
# Use the biom() constructor function to
# instantiate a biom-class, perform validity checks. Return.
return( biom(x) )
}
################################################################################
#' Write a biom-format file, returning a \code{biom-class}.
#'
#' @param x (Required). A biom object that is going to be written to file
#' as a proper biom formatted file, adhering to
#' \href{http://biom-format.org/documentation/biom_format.html}{the biom-format definition}.
#'
#' @param biom_file (Required). A character string indicating the
#' file location of the biom formatted file. This is a JSON formatted file
#' specific to biological datasets.
#' The format is formally defined at
#' \href{http://biom-format.org/documentation/biom_format.html}{the biom-format definition}
#'
#' @return Nothing. The first argument, \code{x}, is written to a file.
#'
#' @seealso
#'
#' Function to create a biom object from R data,
#' \code{\link{make_biom}}.
#'
#' Definition of the
#' \code{\link{biom-class}}.
#'
#' The \code{\link{read_biom}} import function.
#'
#' Accessor functions like \code{\link{header}}.
#'
#' @references \url{http://biom-format.org/}
#'
#' @export
#' @importFrom RJSONIO toJSON
#' @examples
#' biom_file <- system.file("extdata", "rich_sparse_otu_table.biom", package = "biom")
#' x = read_biom(biom_file)
#' outfile = tempfile()
#' write_biom(x, outfile)
#' y = read_biom(outfile)
#' identical(x, y)
write_biom <- function(x, biom_file){
cat(toJSON(x), file=biom_file)
}
################################################################################
################################################################################
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.