micro_heatmap: Create heatmaps of estiamted coefficients from negative...

Description Usage Arguments Details Value Examples

View source: R/micro_heatmap.R

Description

A function to create heatmaps of estimated beta coeffients from each model fit by nb_mods

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
micro_heatmap(
  modsum,
  low_grad,
  high_grad,
  mid_grad,
  midpoint = 0,
  top_taxa = 10,
  low_lim,
  high_lim,
  mute_cols = T,
  alpha = 0.05,
  dot_size = 2,
  dot_shape = 8,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  subtitle = NULL,
  xaxis = NULL,
  legend_title = NULL,
  caption = NULL
)

Arguments

modsum

The output from nb_mods

low_grad

The low gradient colors for the coefficient magnitude. Will be fed into scale_fill_gradient

high_grad

The high gradient colors for the coefficient magnitude. Will be fed into scale_fill_gradient

mid_grad

The medium gradient colors for the coefficient magnitude. Will be fed into scale_fill_gradient

midpoint

Midpoint for coefficient magnitude in legend

top_taxa

Only plot X taxa with the largest magnitude beta coefficients

low_lim

Lower limits of the fill gradient. Will default to the largest magnitude effect size

high_lim

Upper limits of the fill gradient. Will default to the largest magnitude effect size

mute_cols

Mute the colors of the fill gradients

alpha

Mark beta coefficient cells with p-values below this cutoff

dot_size

size of marker in cells

dot_shape

shape of marker in cells

main

Plot title

xlab

x-axis label

ylab

y-axis label

subtitle

Plot label

xaxis

Labels for the x-axis ticks

legend_title

Title of figure legend

caption

plot caption to be displayed at the bottom of plot

Details

The output will give gray columns if there are missing values in the supplied continuous variable

Value

Returns a ggplot that you can add geoms to if you'd like

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(bpd_phy); data(bpd_cla); data(bpd_ord); data(bpd_fam); data(bpd_clin)

otu_tabs <- list(Phylum = bpd_phy, Class = bpd_cla,
Order = bpd_ord, Family = bpd_fam)
set <- tidy_micro(otu_tabs = otu_tabs, clinical = bpd_clin) %>%
filter(day == 7) ## Only including the first week

## Creating negative binomial models on filtered tidy_micro set
nb_fam <- set %>%
mutate(bpd1 = factor(bpd1)) %>% ## making bpd1 a factor
otu_filter(ra_cutoff = 0.1, exclude_taxa = c("Unclassified", "Bacteria")) %>%
nb_mods(table = "Family", bpd1)

nb_fam %>% micro_heatmap

tidyMicro documentation built on Jan. 13, 2021, 6:18 a.m.