plotTree | R Documentation |
Based on the stored data in a TreeSummarizedExperiment
a tree can
be plotted. From the rowData
, the assays
as well as the
colData
information can be taken for enriching the tree plots with
additional information.
plotRowTree(x, ...)
plotColTree(x, ...)
## S4 method for signature 'TreeSummarizedExperiment'
plotColTree(
x,
tree.name = tree_name,
tree_name = "phylo",
relabel.tree = relabel_tree,
relabel_tree = FALSE,
order.tree = order_tree,
order_tree = FALSE,
levels.rm = remove_levels,
remove_levels = FALSE,
show.label = show_label,
show_label = FALSE,
show.highlights = show_highlights,
show_highlights = FALSE,
show.highlight.label = show_highlight_label,
show_highlight_label = FALSE,
abbr.label = abbr_label,
abbr_label = FALSE,
add.legend = add_legend,
add_legend = TRUE,
layout = "circular",
edge.colour.by = edge.colour.by,
edge_colour_by = NULL,
edge.size.by = edge_size_by,
edge_size_by = NULL,
tip.colour.by = tip_colour_by,
tip_colour_by = NULL,
tip.shape.by = tip_shape_by,
tip_shape_by = NULL,
tip.size.by = tip_size_by,
tip_size_by = NULL,
node.colour.by = node_colour_by,
node_colour_by = NULL,
node.shape.by = node_shape_by,
node_shape_by = NULL,
node.size.by = node_size_by,
node_size_by = NULL,
colour.highlights.by = colour_highlights_by,
colour_highlights_by = NULL,
assay.type = by_exprs_values,
by_exprs_values = "counts",
other.fields = other_fields,
other_fields = list(),
...
)
## S4 method for signature 'TreeSummarizedExperiment'
plotRowTree(
x,
tree.name = tree_name,
tree_name = "phylo",
relabel.tree = relabel_tree,
relabel_tree = FALSE,
order.tree = order_tree,
order_tree = FALSE,
levels.rm = remove_levels,
remove_levels = FALSE,
show.label = show_label,
show_label = FALSE,
show.highlights = show_highlights,
show_highlights = FALSE,
show.highlight.label = show_highlight_label,
show_highlight_label = FALSE,
abbr.label = abbr_label,
abbr_label = FALSE,
add.legend = add_legend,
add_legend = TRUE,
layout = "circular",
edge.colour.by = edge_colour_by,
edge_colour_by = NULL,
edge.size.by = edge_size_by,
edge_size_by = NULL,
tip.colour.by = tip_colour_by,
tip_colour_by = NULL,
tip.shape.by = tip_shape_by,
tip_shape_by = NULL,
tip.size.by = tip_size_by,
tip_size_by = NULL,
node.colour.by = node_colour_by,
node_colour_by = NULL,
node.shape.by = node_shape_by,
node_shape_by = NULL,
node.size.by = node_size_by,
node_size_by = NULL,
colour.highlights.by = colour_highlights_by,
colour_highlights_by = NULL,
assay.type = by_exprs_values,
by_exprs_values = "counts",
other.fields = other_fields,
other_fields = list(),
...
)
x |
a
|
... |
additional arguments for plotting. See
|
tree.name |
|
tree_name |
Deprecated. Use |
relabel.tree |
|
relabel_tree |
Deprecated. Use |
order.tree |
|
order_tree |
Deprecated. Use |
levels.rm |
|
remove_levels |
Deprecated. Use |
show.label , show.highlights , show.highlight.label , abbr.label |
|
show_label , show_highlights , show_highlight_label , abbr_label |
Deprecated.
Use |
add.legend |
|
add_legend |
Deprecated. Use |
layout |
layout for the plotted tree. See
|
edge.colour.by |
|
edge_colour_by |
Deprecated. Use |
edge.size.by |
|
edge_size_by |
Deprecated. Use |
tip.colour.by |
|
tip_colour_by |
Deprecated. Use |
tip.shape.by |
|
tip_shape_by |
Deprecated. Use |
tip.size.by |
|
tip_size_by |
Deprecated. Use |
node.colour.by |
|
node_colour_by |
Deprecated. Use |
node.shape.by |
|
node_shape_by |
Deprecated. Use |
node.size.by |
|
node_size_by |
Deprecated. Use |
colour.highlights.by |
|
colour_highlights_by |
Deprecated. Use |
assay.type |
|
by_exprs_values |
Deprecated. Use |
other.fields |
|
other_fields |
Deprecated. Use |
If show.label
or show.highlight.label
have the same length
as the number of nodes, the vector will be used to relabel the nodes.
a ggtree
plot
agglomerateByRanks
library(scater)
library(mia)
# preparation of some data
data(GlobalPatterns)
GlobalPatterns <- agglomerateByRanks(GlobalPatterns)
altExp(GlobalPatterns,"Genus") <- addPerFeatureQC(altExp(GlobalPatterns,"Genus"))
rowData(altExp(GlobalPatterns,"Genus"))$log_mean <-
log(rowData(altExp(GlobalPatterns,"Genus"))$mean)
rowData(altExp(GlobalPatterns,"Genus"))$detected <-
rowData(altExp(GlobalPatterns,"Genus"))$detected / 100
top_genus <- getTop(altExp(GlobalPatterns,"Genus"),
method="mean",
top=100L,
assay.type="counts")
#
x <- altExp(GlobalPatterns,"Genus")
plotRowTree(x[rownames(x) %in% top_genus,],
tip.colour.by = "log_mean",
tip.size.by = "detected")
# plot with tip labels
plotRowTree(x[rownames(x) %in% top_genus,],
tip.colour.by = "log_mean",
tip.size.by = "detected",
show.label = TRUE)
# plot with selected labels
labels <- c("Genus:Providencia", "Genus:Morganella", "0.961.60")
plotRowTree(x[rownames(x) %in% top_genus,],
tip.colour.by = "log_mean",
tip.size.by = "detected",
show.label = labels,
layout="rectangular")
# plot with labeled edges
plotRowTree(x[rownames(x) %in% top_genus,],
edge.colour.by = "Phylum",
tip.colour.by = "log_mean")
# if edges are sized, colours might disappear depending on plotting device
plotRowTree(x[rownames(x) %in% top_genus,],
edge.colour.by = "Phylum",
edge.size.by = "detected",
tip.colour.by = "log_mean")
# aggregating data over the taxonomic levels for plotting a taxonomic tree
# please note that the original tree of GlobalPatterns is dropped by
# unsplitByRanks
altExps(GlobalPatterns) <- splitByRanks(GlobalPatterns)
top_phyla <- getTop(altExp(GlobalPatterns,"Phylum"),
method="mean",
top=10L,
assay.type="counts")
altExps(GlobalPatterns) <- lapply(altExps(GlobalPatterns), addPerFeatureQC)
altExps(GlobalPatterns) <-
lapply(altExps(GlobalPatterns),
function(y){
rowData(y)$log_mean <- log(rowData(y)$mean)
rowData(y)$detected <- rowData(y)$detected / 100
y
})
x <- unsplitByRanks(GlobalPatterns)
x <- addHierarchyTree(x)
highlights <- c("Phylum:Firmicutes","Phylum:Bacteroidetes",
"Family:Pseudomonadaceae","Order:Bifidobacteriales")
plotRowTree(x[rowData(x)$Phylum %in% top_phyla,],
tip.colour.by = "log_mean",
node.colour.by = "log_mean",
show.highlights = highlights,
show.highlight.label = highlights,
colour.highlights.by = "Phylum")
plotRowTree(x[rowData(x)$Phylum %in% top_phyla,],
edge.colour.by = "Phylum",
edge.size.by = "detected",
tip.colour.by = "log_mean",
node.colour.by = "log_mean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.