R/heatmaps-taxAnnotation.R
anno_tax_prev.Rd
Use this as an argument to taxAnnotation(), which itself is used by cor_heatmap and comp_heatmap as tax_anno argument.
the value above which taxa are classed as detected/present in a sample
try to retrieve counts from data object?
width or height as a grid unit object
baseline of bars. The value should be "min" or "max", or a numeric value. It is enforced to be zero for stacked barplots.
Wether draw borders of the annotation region?
Relative width of the bars. The value should be smaller than one.
Graphic parameters for bars. The length of each graphic parameter can be 1, length of x
if x
is a vector, or number of columns of x
is x
is a matrix.
Data ranges. By default it is range(x)
if x
is a vector, or range(rowSums(x))
if x
is a matrix.
The extension to both side of ylim
. The value is a percent value corresponding to ylim[2] - ylim[1]
.
Whether to add axis?
Arguments passed on to ComplexHeatmap::anno_barplot
axis_param
parameters for controlling axis. See default_axis_param
for all possible settings and default parameters.
OPTIONAL phyloseq or psExtra, only set this to override use of same data as in heatmap
OPTIONAL selection vector of taxa (names, numbers or logical), only set this if providing data argument to override default
OPTIONAL indicating if it is a 'column' or a 'row' annotation, only set this if providing data argument to override default
function or ComplexHeatmap AnnotationFunction object
library("ComplexHeatmap")
data("ibd", package = "microViz")
psq <- tax_filter(ibd, min_prevalence = 5)
psq <- tax_mutate(psq, Species = NULL)
psq <- tax_fix(psq)
psq <- tax_agg(psq, rank = "Family")
taxa <- tax_top(psq, n = 15, rank = "Family")
# makes a function that takes data, taxa and which (at minimum)
fun <- anno_tax_prev()
# manually specify the prevalence barplot function by giving it data etc.
heatmapAnnoFunction <- fun(data = psq, which = "row", taxa = taxa)
# draw the barplot without a heatmap, you will never normally do this!
vp <- viewport(width = 0.75, height = 0.75)
grid::grid.newpage()
pushViewport(vp)
draw(heatmapAnnoFunction)
# let's change some style options and specify the data up front
grid::grid.newpage()
pushViewport(vp)
anno_tax_prev(
data = psq, taxa = taxa, which = "column",
gp = grid::gpar(fill = "red", lwd = 3, alpha = 0.5),
border = FALSE, bar_width = 1
) %>%
draw()
# clear drawings
grid::grid.newpage()