View source: R/phyloseq_num_shared_otus.R
phyloseq_num_shared_otus | R Documentation |
This function counts the number of OTUs that are common (shared) and distinct (non-shared) between a pair of samples. All pairwise sample combinations are considered, and the output is stored as a matrix.
phyloseq_num_shared_otus(physeq, use_Matrix = TRUE)
physeq |
A phyloseq-class object |
use_Matrix |
Logical, use sparse matrix class to perform the analysis (default, TRUE) |
This function uses the sparse matrix class implemented in the package
Matrix
to improve computational speed and
decrease memory footprint.
The function's output is a list containing three matrices (rows and columns correspond to samples):
"shared" - The number of shared OTUs between the samples
"nonshared_total" - The number of non-shared OTUs between the samples. This matrix contains the total number of non-shared OTUs between the two samples. The matrix is symmetric, meaning that the values in the matrix are equal on both sides of the diagonal.
"nonshared_asymmetric" - The number of non-shared OTUs between the samples. The matrix is asymmetric, with the upper and lower triangular parts of the matrix representing the number of unique OTUs present only in one of the two samples.
phyloseq_extract_shared_otus
,
phyloseq_extract_non_shared_otus
data(esophagus)
# Count number of shared and non-shared OTUs
ps <- phyloseq_num_shared_otus(esophagus)
ps
# The same, but using base-R matrix class (not recommended for large data)
ps <- phyloseq_num_shared_otus(esophagus, use_Matrix = FALSE)
ps
# To obtain a list of shared or non-shared OTUs between a pair of samples, use
phyloseq_extract_shared_otus(x = esophagus, samp_names = c("B", "C"))
phyloseq_extract_non_shared_otus(x = esophagus, samp_names = c("B", "C"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.