parsePhyloseq: parsePhyloseq

Description Usage Arguments Value Author(s) See Also Examples

View source: R/parser.R

Description

This function takes a phyloseq-class and parse it to a treedata object, that can be further visualized by the tree.backbone function. The tax_table slot must not be empty in the phyloseq object.

Usage

1
2
3
4
5
6
parsePhyloseq(
  physeq,
  use_abundance = TRUE,
  node.size.scale = 1,
  node.size.offset = 1
)

Arguments

physeq

A phyloseq object. The tax_table slot must not be empty.

use_abundance

Boolean variable whether to set node sizes according to abundance. If FALSE, all nodes will have the same size.

node.size.scale

the parameter 'a' controlling node size: nodeSize=a*log(relative_abundance)+b

node.size.offset

the parameter 'b' controlling node size: nodeSize=a*log(relative_abundance)+b

Value

a treeio::treedata object

Author(s)

Chenghao Zhu, Chenhao Li, Guangchuang Yu

See Also

tree.backbone, parseMetaphlanTSV, phyloseq-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data("GlobalPatterns")
GP = GlobalPatterns
otu_table = otu_table(GP)
tax_table = tax_table(GP)

# Use the OTUs that make up 99% of the total
lib_size = colSums(otu_table)
mat = sapply(1:ncol(otu_table), function(i)
    otu_table[,i]/lib_size[i] >= 0.01)
ind = rowSums(mat)>=1

otu_table = otu_table[ind,]
tax_table = tax_table[ind,]

physeq = phyloseq(otu_table, tax_table) %>%
    fix_duplicate_tax()

tr = parsePhyloseq(physeq, use_abundance = F)
p = tree.backbone(tr, size=1)

lch14forever/microbiomeViz documentation built on Sept. 7, 2020, 4:34 p.m.