Skip to content

Commit 5d0ea09

Browse files
authored
Merge pull request #86 from vallenderlab/dev-master
Dev master to master.
2 parents 095a03c + 0743abc commit 5d0ea09

File tree

198 files changed

+4193
-1688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+4193
-1688
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
^\.travis\.yml$
66
^.*\.Rproj$
77
^\.Rproj\.user$
8+
CNAME
9+
^pkgdown$

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ branches:
1010
only:
1111
- master
1212
- dev-master
13-
- build-fixes
14-
1513

1614
env:
1715
global:
1816
- _R_CHECK_FORCE_SUGGESTS_=false
1917
- R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
18+
- CODECOV_TOKEN=2ff74b01-00e8-4e2f-9cc7-1f90ca17e480
2019

2120
r:
21+
- oldrel
2222
- release
2323
- devel
2424

DESCRIPTION

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Package: MicrobiomeR
22
Title: Analyze Microbiome Data
3-
Version: 0.4.1
3+
Version: 0.5.1
44
Authors@R: c(
55
person("Robert", "Gilmore", email = "rgilmore@umc.edu", role = "cre"),
66
person("Shaurita", "Hutchins", email = "shutchins2@umc.edu", role = "aut"))
7+
Maintainer: Rob Gilmore <rgilmore@umc.edu>
78
License: MIT + file LICENSE
89
biocViews: Metagenomics, Microbiome, Sequencing, SystemsBiology
910
Description: An R package for microbiome analysis combining functions from phyloseq, metacodeR,
@@ -16,48 +17,50 @@ Remotes:
1617
github::grunwaldlab/metacoder,
1718
github::joey711/phyloseq,
1819
github::microbiome/microbiome,
20+
github::r-lib/covr,
1921
github::jonclayden/shades
2022
Imports:
2123
ape,
24+
biomformat,
25+
crayon,
2226
DT,
2327
data.table,
2428
diptest,
2529
dplyr,
26-
rlang,
30+
forcats,
31+
ggplot2,
32+
ggpubr,
33+
ggthemes,
34+
ggrepel,
2735
glue,
36+
htmlwidgets,
37+
htmltools,
38+
leaflet,
39+
magrittr,
2840
metacoder,
29-
modes,
3041
microbiome (>= 1.5.27),
42+
modes,
3143
openxlsx,
3244
phyloseq,
3345
plotly,
3446
purrr,
47+
rlang,
48+
rstudioapi,
49+
scales,
3550
scico,
51+
shades,
52+
stringr,
3653
taxa,
3754
tibble,
3855
tidyr,
39-
viridis,
40-
yaml,
41-
ggplot2,
42-
stringr,
43-
rstudioapi,
44-
magrittr,
45-
ggpubr,
46-
ggthemes,
47-
crayon,
48-
biomformat,
49-
forcats,
50-
ggrepel,
51-
scales,
5256
vegan,
53-
leaflet,
54-
htmlwidgets,
55-
shades
57+
viridis,
58+
yaml
5659
Suggests:
60+
covr,
5761
knitr,
58-
testthat,
5962
rmarkdown,
60-
covr
63+
testthat
6164
Additional_repositories:
6265
http://bioconductor.org/packages/release/bioc/,
6366
http://bioconductor.org/packages/release/data/annotation,
@@ -66,6 +69,6 @@ Additional_repositories:
6669
Encoding: UTF-8
6770
LazyData: true
6871
RoxygenNote: 6.1.1
69-
URL: https://github.com/vallenderlab/MicrobiomeR
72+
URL: https://github.com/vallenderlab/MicrobiomeR, https://microbiomer.vallenderlab.science/
7073
BugReports: https://github.com/vallenderlab/MicrobiomeR/issues
7174
VignetteBuilder: knitr

NAMESPACE

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export("%>%")
4-
export(agglomerate_metacoder)
4+
export(agglomerate_taxmap)
55
export(alpha_diversity_measures)
66
export(alpha_diversity_plot)
77
export(as_MicrobiomeR_format)
@@ -15,9 +15,9 @@ export(correlation_data)
1515
export(correlation_plot)
1616
export(correlation_plots)
1717
export(cov_filter)
18-
export(create_metacoder)
1918
export(create_phyloseq)
2019
export(create_pub_table)
20+
export(create_taxmap)
2121
export(get_color_palette)
2222
export(heat_tree_parameters)
2323
export(heat_tree_plots)
@@ -59,7 +59,6 @@ export(viridis_magma_palette)
5959
export(viridis_palette)
6060
export(vlookup)
6161
export(which_format)
62-
import(scales)
6362
import(vegan)
6463
importFrom(ape,Ntip)
6564
importFrom(ape,is.rooted)
@@ -155,6 +154,8 @@ importFrom(purrr,modify_at)
155154
importFrom(rlang,enquos)
156155
importFrom(rlang,eval_tidy)
157156
importFrom(rlang,is_quosure)
157+
importFrom(scales,percent)
158+
importFrom(scales,pretty_breaks)
158159
importFrom(scico,scico)
159160
importFrom(shades,saturation)
160161
importFrom(shades,scalefac)

NEWS.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# MicrobiomeR 0.5.1
2+
* A specific bug was introduced that prevented local machines and Travis CI servers from building
3+
the package.
4+
* This bug is attributed to a dplyr update (0.7.8 -> 0.8.0.1)
5+
* See [Joss branch #79](https://github.com/vallenderlab/MicrobiomeR/pull/79)
6+
* See [Joss debug branch #82](https://github.com/vallenderlab/MicrobiomeR/pull/82)
7+
* See [dplyr issue #4213](https://github.com/tidyverse/dplyr/issues/4213)
8+
* See [Travis CI forum post](https://travis-ci.community/t/travis-build-ignoring-r-package-version-in-description/2431)
9+
* Updated the paper for submission
10+
11+
12+
# MicrobiomeR 0.5.0
13+
14+
* Added the JOSS paper and draft vignette
15+
* Changed correlation plots
16+
* Removed color from background
17+
* Removed hard coded plot limits
18+
* Added "1:1" line and Average lines
19+
* Added a `trans` parameter to transform the x and y axis
20+
* Changed function names
21+
* From `create_metacoder` to `create_taxmap`
22+
* From `agglomerate_metacoder` to `agglomerate_taxmap`
23+
* From `melt_metacoder` to `melt_taxmap`
24+
* Bugs
25+
* Fixed `output_dir` bug where error should have been a warning
26+
* Fixed correlation plot bug where treatments were on the wrong axis.
27+
* Fixed output message for heat tree plots.
28+
* Fixed build-check Notes and Warnings
29+
130
# MicrobiomeR 0.4.1
231

332
* Fixed wilcoxon pvalue in analysis vignette.
@@ -8,7 +37,7 @@
837
## Renamed functions
938

1039
* `get_alpha_diversity_measures` to `alpha_diversity_measures`
11-
40+
1241
## Added functions
1342

1443
* Added `stacked_barplots`, `alpha_diversity_plots`, `ordination_plots`

R/alpha-diversity.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' @title Alpha Diveristy Measues
22
#' @description This function generates various alpha diversity measures include Shannon, Fisher, Coverage, Gini Simpson, and Inverse Simpson.
3-
#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.
3+
#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
44
#' @param group The "TreatmentGroup" or similar grouping from your metadata to denote sample groups, Default: 'TreatmentGroup'
55
#' @return Returns a list of alpha diversity measures with metadata.
66
#' @pretty_print TRUE
@@ -22,11 +22,11 @@
2222
#' @importFrom utils combn
2323
alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
2424
metacoder_object <- validate_MicrobiomeR_format(
25-
obj = create_metacoder(obj),
25+
obj = create_taxmap(obj),
2626
valid_formats = c("analyzed_format")
2727
)
2828

29-
# Convert metacoder object to a phyloseq object.
29+
# Convert Taxmap object to a phyloseq object.
3030
phyloseq_object <- metacoder::as_phyloseq(metacoder_object, otu_table = "otu_abundance", phy_tree = "phy_tree")
3131

3232
# Get all of the diversities.
@@ -52,7 +52,7 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
5252

5353
#' @title Alpha Diversity Plot
5454
#' @description Plot the alpha diversity using a violin plot. `alpha_diversity_plots` generates plots for all alpha diversity measures.
55-
#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.
55+
#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
5656
#' @param measure Select an alpha diversity measure such as shannon, gini simpson, and inverse simpson, Default: 'shannon'
5757
#' @param group The "TreatmentGroup" or similar grouping or column from your metadata to denote sample groups, Default: 'TreatmentGroup'
5858
#' @param select_otu_table Choose an otu table to analyze, Default: 'otu_proportions'
@@ -65,7 +65,9 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
6565
#' if (interactive()) {
6666
#' library(MicrobiomeR)
6767
#' data <- analyzed_silva
68-
#' plot <- alpha_diversity_plot(obj = data, measure = "shannon", select_otu_table = "otu_proportions")
68+
#' plot <- alpha_diversity_plot(obj = data,
69+
#' measure = "shannon",
70+
#' select_otu_table = "otu_proportions")
6971
#' plot
7072
#' }
7173
#' }
@@ -81,7 +83,7 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
8183
alpha_diversity_plot <- function(obj, measure = "shannon", group = "TreatmentGroup", select_otu_table = "otu_proportions", title = NULL) {
8284
# Validate data format
8385
metacoder_object <- validate_MicrobiomeR_format(
84-
obj = create_metacoder(obj),
86+
obj = create_taxmap(obj),
8587
valid_formats = c("analyzed_format")
8688
)
8789
metacoder_object$data$sample_data[[measure]] <- vegan::diversity(metacoder_object$data[[select_otu_table]][, metacoder_object$data$sample_data$X.SampleID],

R/barplot.R

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#' @title Melt Taxmap
2+
#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
13
#' @importFrom dplyr right_join setdiff
24
#' @importFrom tidyr gather_
35
#' @family Formatting
4-
#' @rdname stacked_barplot
5-
melt_metacoder <- function(obj) {
6+
#' @rdname melt_taxmap
7+
melt_taxmap <- function(obj) {
68
sd <- data.frame(obj$data$sample_data)
79
TT <- data.frame(obj$data$otu_annotations, stringsAsFactors = FALSE)
810
otu.table <- data.frame(obj$data$otu_proportions, check.names = FALSE, stringsAsFactors = FALSE)
@@ -13,12 +15,13 @@ melt_metacoder <- function(obj) {
1315
rename(SampleID = `X.SampleID`) %>%
1416
rename(OTU = `otu_id`)
1517
}
16-
18+
#' @title Convert Proportions
1719
#' @param melted_df A "melted" dataframe from the metacoder object's data.
20+
#' @param tax_level The taxonomic level, Default: 'Phylum'
1821
#' @importFrom dplyr filter group_by summarize mutate enquo quo_name
1922
#' @importFrom stats na.omit
2023
#' @family Data Manipulators
21-
#' @rdname stacked_barplot
24+
#' @rdname convert_proportions
2225
convert_proportions <- function(melted_df, tax_level) {
2326
t <- dplyr::enquo(tax_level)
2427
tax_level.abund <- paste0(dplyr::quo_name(t), ".Abundance")
@@ -34,7 +37,7 @@ convert_proportions <- function(melted_df, tax_level) {
3437
#' @title Stacked Barplot
3538
#' @description Create a stacked barplot to show relative abundance of taxa. `convert_proportions` converts the dataframe abundance values to percent 100 and returns a transformed dataframe.
3639
#' `melt_metacoder` melts the metacoder or phyloseq tables into a dataframe and returns a melted dataframe. `stacked_barplots` creates a stacked barplots for multiple taxonomic levels and returns a list of stacked barplots.
37-
#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.
40+
#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
3841
#' @param tax_level The taxonomic level, Default: 'Phylum'
3942
#' @param fill The taxonomic level by which the bars are filled, Default: 'Phylum'
4043
#' @param xlabel The label of the x axis, Default: 'Samples'
@@ -55,8 +58,8 @@ convert_proportions <- function(melted_df, tax_level) {
5558
#' @importFrom ggplot2 ggplot aes annotate geom_bar ylab element_blank element_rect xlab annotate
5659
#' @importFrom magrittr %>%
5760
#' @importFrom dplyr mutate
61+
#' @importFrom scales pretty_breaks
5862
#' @importFrom shades scalefac saturation
59-
#' @import scales
6063
#' @import vegan
6164
#'
6265
#' @inheritParams convert_proportions
@@ -66,13 +69,13 @@ convert_proportions <- function(melted_df, tax_level) {
6669
#' @export
6770
stacked_barplot <- function(obj, tax_level = "Phylum", fill = "Phylum", xlabel = "Samples", faceted = FALSE, title = NULL, palette_values = NULL) {
6871
metacoder_object <- validate_MicrobiomeR_format(
69-
obj = create_metacoder(obj),
72+
obj = create_taxmap(obj),
7073
valid_formats = c("analyzed_format")
7174
)
7275

7376
# Start by melting the data in the "standard" way using psmelt.
7477
# Also, transform the abundance data to relative abundance
75-
mdf <- convert_proportions(melt_metacoder(metacoder_object), tax_level)
78+
mdf <- convert_proportions(melt_taxmap(metacoder_object), tax_level)
7679
mdf <- dplyr::mutate(mdf, !!sym(tax_level) := factor(!!sym(tax_level), levels = unique(mdf[[tax_level]])))
7780

7881
# Build the plot data structure
@@ -116,12 +119,13 @@ stacked_barplot <- function(obj, tax_level = "Phylum", fill = "Phylum", xlabel =
116119
return(p)
117120
}
118121

119-
122+
#' @title Stacked Barplots
120123
#' @param tax_levels The taxonomic levels, Default: 'c("Phylum", "Class", "Order")'
124+
#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
121125
#' @family Visualizations
122-
#' @rdname stacked_barplot
126+
#' @rdname stacked_barplots
123127
#' @export
124-
stacked_barplots <- function(obj, tax_levels = c("Phylum", "Class", "Order"), group = "TreatmentGroup", select_otu_table = "otu_proportions") {
128+
stacked_barplots <- function(obj, tax_levels = c("Phylum", "Class", "Order")) {
125129
if (is.null(tax_levels)) {
126130
tax_levels <- c("Phylum", "Class", "Order")
127131
} else if (length(tax_levels) < 2) {

0 commit comments

Comments
 (0)