knitr::opts_chunk$set(fig.width=8, fig.height=4, cache = TRUE)
library(phylosmith)
data(soil_column)

Examples used in this vignette will use the GlobalPatterns dataset from phyloseq.

library(phyloseq)
data(GlobalPatterns)


Normalization Methods


library_size

Performs a library-size normalization on the phyloseq-object


Usage

library_size(phyloseq_obj)


Arguments

Call | Description -------------------- | ------------------------------------------------------------ phyloseq_obj | A phyloseq-class object.

Examples

phyloseq::sample_sums(GlobalPatterns)
normalized_obj <- library_size(GlobalPatterns)
phyloseq::sample_sums(normalized_obj)




relative_abundance

Transforms the the otu_table count data to relative abundance. Relative abundance sets the count sums for each sample to 1, and then assigns each taxa an abundance equal to its proportion on the total sum (very low abundance taxa may ).


Usage

relative_abundance(phyloseq_obj)


Arguments

Call | Description -------------------- | ------------------------------------------------------------ phyloseq_obj | A phyloseq-class object that contains otu_table count data.

Examples

phyloseq::sample_sums(relative_abundance(GlobalPatterns, 10))




Taxa


common_taxa

Used to identify which entries in the taxa_table are shared among treatment-groups. It will return a vector of taxa names that are all seen in n groups.


Usage

common_taxa(phyloseq_obj, treatment = NULL, subset = NULL, n = 'all')


Arguments

Call | Description -------------------- | ------------------------------------------------------------ phyloseq_obj | A phyloseq-class object. treatment | Column name as a string, or vector of, in the sample_data. subset | A factor within the treatment. This will remove any samples that to not contain this factor. This can be a vector of multiple factors to subset on. n | Number of treatment groups that need to share the taxa to be considered a common taxa.

Examples

common_taxa(GlobalPatterns, treatment = 'SampleType', 
  subset = 'Tongue', n = 'all')[1:35]



taxa_core

Filter taxa in phyloseq-object to only include core taxa

Usage

taxa_core(phyloseq_obj, treatment = NULL, subset = NULL, frequency = 0.5, abundance_threshold = 0.01)


Arguments

Call | Description -------------------- | ------------------------------------------------------------ phyloseq_obj | A phyloseq-class object. treatment | Column name as a string, or vector of, in the sample_data. subset | A factor within the treatment. This will remove any samples that to not contain this factor. This can be a vector of multiple factors to subset on. frequency | The proportion of samples the taxa is found in. abundance_threshold | The minimum relative abundance the taxa is found in for each sample.

Examples The soil_column data has 18,441 OTUs listed in its taxa_table.

taxa_core(GlobalPatterns, frequency = 0.2, abundance_threshold = 0.01)



taxa_proportions

Computes the proportion of a taxa classification. This can be done by treatment, sample, or across the dataset.

Usage

taxa_proportions(phyloseq_obj, classification, treatment = NA)


Arguments

Call | Description -------------------- | ------------------------------------------------------------ phyloseq_obj | phyloseq_obj | A phyloseq-class object. classification | Column name as a string or numeric in the tax_table for the prportions to be reported on. treatment | Column name as a string, or vector of, in the sample_data.

Examples

taxa_proportions(GlobalPatterns, 'Phylum', treatment = "SampleType")
taxa_proportions(GlobalPatterns, 'Phylum', treatment = 'Sample')
taxa_proportions(GlobalPatterns, 'Phylum', treatment = NULL)




unique_taxa

Identify which taxa are unique to a specific treatment-group. It will return a list of vectors of taxa-names that are only seen in each group.


Usage

unique_taxa(phyloseq_obj, treatment, subset = NULL)


Arguments

Call | Description -------------------- | ------------------------------------------------------------ phyloseq_obj | A phyloseq-class object. treatment | Column name as a string, or vector of, in the sample_data. subset | A factor within the treatment. This will remove any samples that to not contain this factor. This can be a vector of multiple factors to subset on.

Examples

uniques <- unique_taxa(GlobalPatterns, treatment = "SampleType")
data.frame(lapply(uniques, "length<-", max(lengths(uniques))))





schuyler-smith/phyloschuyler documentation built on March 27, 2024, 4:29 p.m.