tax_stack_clust: Plotting cluster tree + stackplot of taxonomy samples and...

View source: R/tax_stack_cluster.R

tax_stack_clustR Documentation

Plotting cluster tree + stackplot of taxonomy samples and groups

Description

Combine sample clustering tree and drawing stacked barplot of taxonomic composition

Usage

tax_stack_clust(
  otu = NULL,
  map = NULL,
  tax = NULL,
  dist = "bray",
  Group = "Group",
  j = "Phylum",
  rep = 6,
  Top = 10,
  tran = TRUE,
  hcluter_method = "complete",
  cuttree = 3
)

Arguments

otu

OTU/ASV table;

map

Sample metadata;

tax

taxonomy table

Group

column name for groupID in map table.

rep

Number of sample replicates measured in each group

Top

Number of Top N abundance taxa in all samples

hcluter_method

hcluster method

cuttree

cut number

Details

hclust method is same an function hclust

Value

list contain ggplot object and table.

Author(s)

Contact: Tao Wen 2018203048@njau.edu.cn, Yong-Xin Liu yxliu@genetics.ac.cn

References

Yong-Xin Liu, Yuan Qin, Tong Chen, Meiping Lu, Xubo Qian, Xiaoxuan Guo & Yang Bai. A practical guide to amplicon and metagenomic analysis of microbiome data. Protein Cell, 2020(41), 1-16, DOI: https://doi.org/10.1007/s13238-020-00724-8

Examples

# Input is OTU table, metadata and taxonomy
result = tax_stack_clust (otutab, metadata, taxonomy)
# Results: 1 sample tree, 2 sample tree + stackplot, 3 group gree, 4 group tree + stackplot, 5 data table; Such show result 2
result[2]
# Data form files
metadata=read.table("http://210.75.224.110/github/EasyAmplicon/data/metadata.tsv", header=T, row.names=1, sep="\t", comment.char="", stringsAsFactors=F)
otutab=read.table("http://210.75.224.110/github/EasyAmplicon/data/otutab.txt", header=T, row.names=1, sep="\t", comment.char="", stringsAsFactors=F)
taxonomy=read.table("http://210.75.224.110/github/EasyAmplicon/data/taxonomy.txt", header=T, row.names=1, sep="\t", comment.char="", stringsAsFactors=F)
# Full parameters: cluster distance metric (dist as bray, jaccard, manhattan...), Group column (Group), taxonomic level (j as Phylum, Class, Order...), TopN (Top)
result <-  tax_stack_clust (otu=otutab, map=metadata, tax=taxonomy,
   dist="bray", Group="Group", j="Phylum", Top=10, rep=6,
   tran=TRUE, hcluter_method="complete", cuttree=3)

microbiota/amplicon documentation built on April 30, 2023, 1:48 p.m.