as_phyloseq: Convert taxmap to phyloseq

View source: R/as_phyloseq.R

as_phyloseqR Documentation

Convert taxmap to phyloseq

Description

Convert a taxmap object to a phyloseq object.

Usage

as_phyloseq(
  obj,
  otu_table = NULL,
  otu_id_col = "otu_id",
  sample_data = NULL,
  sample_id_col = "sample_id",
  phy_tree = NULL
)

Arguments

obj

The taxmap object.

otu_table

The table in 'obj$data' with OTU counts. Must be one of the following:

NULL

Look for a table named "otu_table" in 'obj$data' with taxon IDs, OTU IDs, and OTU counts. If it exists, use it.

character

The name of the table stored in 'obj$data' with taxon IDs, OTU IDs, and OTU counts

data.frame

A table with taxon IDs, OTU IDs, and OTU counts

FALSE

Do not include an OTU table, even if "otu_table" exists in 'obj$data'

otu_id_col

The name of the column storing OTU IDs in the otu table.

sample_data

A table containing sample data with sample IDs matching column names in the OTU table. Must be one of the following:

NULL

Look for a table named "sample_data" in 'obj$data'. If it exists, use it.

character

The name of the table stored in 'obj$data' with sample IDs

data.frame

A table with sample IDs

FALSE

Do not include a sample data table, even if "sample_data" exists in 'obj$data'

sample_id_col

The name of the column storing sample IDs in the sample data table.

phy_tree

A phylogenetic tree of class phylo from the ape package with tip labels matching OTU ids. Must be one of the following:

NULL

Look for a tree named "phy_tree" in 'obj$data' with tip labels matching OTU ids. If it exists, use it.

character

The name of the tree stored in 'obj$data' with tip labels matching OTU ids.

phylo

A tree with tip labels matching OTU ids.

FALSE

Do not include a tree, even if "phy_tree" exists in 'obj$data'

Examples

## Not run: 
# Install phyloseq to get example data
# if (!require("BiocManager", quietly = TRUE))
#   install.packages("BiocManager")
# 
# BiocManager::install("phyloseq")

# Parse example dataset
library(phyloseq)
data(GlobalPatterns)
x <- parse_phyloseq(GlobalPatterns)

# Convert back to a phylseq object
as_phyloseq(x)


## End(Not run)

metacoder documentation built on April 4, 2023, 9:08 a.m.