micro_forest: Create forest plots from negative binomial taxa models

Description Usage Arguments Value Examples

View source: R/micro_forest.R

Description

Create forest plots for specified coefficients in negative binomial taxa models. Plots estimated beta coefficients and confidence intervals

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
micro_forest(
  modsum,
  ...,
  main,
  ylab,
  xlab,
  subtitle,
  legend_title,
  legend_labs
)

Arguments

modsum

The output from nb_mods

...

The covariate you'd like to plot. Must be in the models created by nb_mods

main

The title for your plot

ylab

The label for the y-axis; default is "Taxa"

xlab

The label for the x-axis; default is output from function "TeX"

subtitle

The plot subtitle

legend_title

The title of the plot's legend

legend_labs

The names of the elements within the legend

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 tidi_micro set
nb_fam <- set %>%
otu_filter(prev_cutoff = 5, ra_cutoff = 0.1,
exclude_taxa = c("Unclassified", "Bacteria")) %>%
nb_mods(table = "Family", bpd1)

nb_fam %>% micro_forest(bpd1)

Example output

Loading required package: tidyverse
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
✔ ggplot2 3.3.2purrr   0.3.4tibble  3.0.4dplyr   1.0.2tidyr   1.1.2stringr 1.4.0readr   1.4.0forcats 0.5.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()dplyr::lag()    masks stats::lag()
Contains 74 libraries from OTU files.

Summary of sequencing depth:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   8851   24938   33314   36650   43590   97408 
Filter for Class counts


Found 'Unclassified' category in input data.

Created new 'Other' category.

Found 'Bacteria' category in input data.

Found 34 OTUs.

Collapsed 2 OTUs into 'Other' in OTU table.

Converted 61662 counts to 'Other' otu category.

Remaining OTUs: 33 (Including 'Other').


Prevalence cutoff: 5% (i.e., at least 5% of libaries must be represented to keep OTU)

Found 33 OTUs.

Found 'Other' category in input data.

Collapsed 13 OTUs into 'Other' in OTU table.

Converted 1 counts to 'Other' in otu category.

Remaining OTUs: 20 (Including 'Other').


Relative abundance cutoff: 0.1% (i.e., at least one library must have RA > 0.1% to keep OTU).

Found 20 OTUs.

Found 'Other' category in input data.

Collapsed 11 OTUs into 'Other' in OTU table.

Converted 336 counts to 'Other' otu category.

Remaining OTUs: 9 (Including 'Other').


Filter for Family counts


Found 'Unclassified' category in input data.

Created new 'Other' category.

Found 'Bacteria' category in input data.

Found 116 OTUs.

Collapsed 2 OTUs into 'Other' in OTU table.

Converted 61662 counts to 'Other' otu category.

Remaining OTUs: 115 (Including 'Other').


Prevalence cutoff: 5% (i.e., at least 5% of libaries must be represented to keep OTU)

Found 115 OTUs.

Found 'Other' category in input data.

Collapsed 59 OTUs into 'Other' in OTU table.

Converted 24 counts to 'Other' in otu category.

Remaining OTUs: 56 (Including 'Other').


Relative abundance cutoff: 0.1% (i.e., at least one library must have RA > 0.1% to keep OTU).

Found 56 OTUs.

Found 'Other' category in input data.

Collapsed 36 OTUs into 'Other' in OTU table.

Converted 727 counts to 'Other' otu category.

Remaining OTUs: 20 (Including 'Other').


Filter for Order counts


Found 'Unclassified' category in input data.

Created new 'Other' category.

Found 'Bacteria' category in input data.

Found 62 OTUs.

Collapsed 2 OTUs into 'Other' in OTU table.

Converted 61662 counts to 'Other' otu category.

Remaining OTUs: 61 (Including 'Other').


Prevalence cutoff: 5% (i.e., at least 5% of libaries must be represented to keep OTU)

Found 61 OTUs.

Found 'Other' category in input data.

Collapsed 25 OTUs into 'Other' in OTU table.

Converted 10 counts to 'Other' in otu category.

Remaining OTUs: 36 (Including 'Other').


Relative abundance cutoff: 0.1% (i.e., at least one library must have RA > 0.1% to keep OTU).

Found 36 OTUs.

Found 'Other' category in input data.

Collapsed 20 OTUs into 'Other' in OTU table.

Converted 515 counts to 'Other' otu category.

Remaining OTUs: 16 (Including 'Other').


Filter for Phylum counts


Found 'Unclassified' category in input data.

Created new 'Other' category.

Found 'Bacteria' category in input data.

Found 15 OTUs.

Collapsed 2 OTUs into 'Other' in OTU table.

Converted 61662 counts to 'Other' otu category.

Remaining OTUs: 14 (Including 'Other').


Prevalence cutoff: 5% (i.e., at least 5% of libaries must be represented to keep OTU)

Found 14 OTUs.

Found 'Other' category in input data.

Collapsed 3 OTUs into 'Other' in OTU table.

Converted 0 counts to 'Other' in otu category.

Remaining OTUs: 11 (Including 'Other').


Relative abundance cutoff: 0.1% (i.e., at least one library must have RA > 0.1% to keep OTU).

Found 11 OTUs.

Found 'Other' category in input data.

Collapsed 4 OTUs into 'Other' in OTU table.

Converted 50 counts to 'Other' otu category.

Remaining OTUs: 7 (Including 'Other').


Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...
Waiting for profiling to be done...

18 taxa converged.
2 taxa did not converge.
There were 50 or more warnings (use warnings() to see the first 50)
Warning message:
In micro_forest(., bpd1) :
  At least one Confidence interval width is over 10. These estimates may be unstable.

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