Learn R Programming

OmicFlow (version 1.5.1)

metagenomics: Sub-class metagenomics

Description

This is a sub-class that is compatible to data obtained from either 16S rRNA marker-gene sequencing or shot-gun metagenomics sequencing. It inherits all methods from the abstract class omics and only adapts the initialize function. It supports BIOM format data (v2.1.0 from http://biom-format.org/) in both HDF5 and JSON format, also pre-existing data structures can be used or text files. When omics data is very large, data loading becomes very expensive. It is therefore recommended to use the reset() method to reset your changes. Every omics class creates an internal memory efficient back-up of the data, the resetting of changes is an instant process.

Arguments

Super class

OmicFlow::omics -> metagenomics

Active bindings

treeData

A "phylo" class, see as.phylo.

Methods

Inherited methods


Method new()

Initializes the metagenomics class object with metagenomics$new()

Usage

metagenomics$new(
  countData = NULL,
  metaData = NULL,
  featureData = NULL,
  treeData = NULL,
  biomData = NULL,
  feature_names = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species")
)

Arguments

countData

A path to an existing file or a dense/sparse Matrix format.

metaData

A path to an existing file, data.table or data.frame.

featureData

A path to an existing file, data.table or data.frame.

treeData

A path to an existing newick file or class "phylo", see read.tree.

biomData

A path to an existing biom file, version 2.1.0 (http://biom-format.org/), see h5read.

feature_names

A character vector to name the feature names that fit the supplied featureData.

Returns

A new metagenomics object.


Method write_biom()

Creates a BIOM file in HDF5 format of the loaded items via 'new()', which is compatible to the python biom-format version 2.1, see http://biom-format.org.

Usage

metagenomics$write_biom(filename)

Arguments

filename

A character variable of either the full path of filename of the biom file (e.g. output.biom)

Examples

library("OmicFlow")

metadata_file <- system.file("extdata", "metadata.tsv", package = "OmicFlow") counts_file <- system.file("extdata", "counts.tsv", package = "OmicFlow") features_file <- system.file("extdata", "features.tsv", package = "OmicFlow") tree_file <- system.file("extdata", "tree.newick", package = "OmicFlow")

taxa <- metagenomics$new( metaData = metadata_file, countData = counts_file, featureData = features_file, treeData = tree_file )

taxa$write_biom(filename = "output.biom") file.remove("output.biom")


Method clone()

The objects of this class are cloneable with this method.

Usage

metagenomics$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

omics

Examples

Run this code

## ------------------------------------------------
## Method `metagenomics$write_biom`
## ------------------------------------------------

library("OmicFlow")

metadata_file <- system.file("extdata", "metadata.tsv", package = "OmicFlow")
counts_file <- system.file("extdata", "counts.tsv", package = "OmicFlow")
features_file <- system.file("extdata", "features.tsv", package = "OmicFlow")
tree_file <- system.file("extdata", "tree.newick", package = "OmicFlow")

taxa <- metagenomics$new(
 metaData = metadata_file,
 countData = counts_file,
 featureData = features_file,
 treeData = tree_file
)

taxa$write_biom(filename = "output.biom")
file.remove("output.biom")

Run the code above in your browser using DataLab