Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
944d9cb
Initial commit of joss paper files.
grabear Jan 24, 2019
4f5a590
Changed create_metacoder to create_taxmap.
grabear Jan 28, 2019
46ccb94
Fixed any reference of "metacoder object" to "taxmap object".
grabear Jan 28, 2019
ad9c474
Changed agglomerate_metacoder to agglomerate_taxmap.
grabear Jan 28, 2019
b4161ab
Changed melt_metacoder to melt_taxmap.
grabear Jan 28, 2019
5472835
Bumped the version and added NEWS.
grabear Jan 28, 2019
7c103f3
Added a tab for the paper.
grabear Feb 4, 2019
bcba410
Added references to the bib file (phyloseq, metacoder, taxa, qiime, s…
grabear Feb 4, 2019
0dda527
Removed unnecessary dependency.
grabear Feb 8, 2019
da893ab
Created a tab in the pkgdown navbar for the publication.
grabear Feb 8, 2019
883eda5
Fixed a bug in the output_dir function.
grabear Feb 8, 2019
1e46d99
Removed bg color/dotted lines, and added a transformation parameter t…
grabear Feb 13, 2019
c08ed3a
Added functionality to edit title including the title parameter
grabear Feb 13, 2019
98a8b58
Fixed bug where treatments are placed in the wrong axis. Added line …
grabear Feb 18, 2019
bdbd73e
Fixed output message for heat-tree plots
grabear Feb 18, 2019
6578f20
Updated version and added correlation plot changes and bugs.
grabear Feb 19, 2019
921c4c2
Updated the paper and related documents.
grabear Feb 19, 2019
da4f3df
Added a draft of the publication to the vignettes.
grabear Feb 19, 2019
8cef5b3
Changed Reference tab to Functions tab.
grabear Feb 19, 2019
14181b7
Updated package/pkgdown after build and install
grabear Feb 19, 2019
26bbc4b
Updated news line.
grabear Feb 19, 2019
b7ae2f0
Merge branch 'dev-master' into joss-branch
grabear Feb 19, 2019
f8e385b
Added pkgdown and CNAME to .Rbuildignore to prevent build-check NOTES.
grabear Feb 20, 2019
814e2ac
Updated DESCRIPTION file for build-checks and CRAN
grabear Feb 20, 2019
73ddd83
Added URL to pkdown.yml to get pkgdown link to be used in other pkgdo…
grabear Feb 20, 2019
59fe322
Fixed build check for alpha_diversity_plot function.
grabear Feb 20, 2019
4ef9fb1
Fixed build-check for melt_taxmap, convert_proportions, and stacked_b…
grabear Feb 20, 2019
039bb53
Fixed build-check for correlation_plot function.
grabear Feb 20, 2019
43e427e
Fixed build-check for otu_id_filter function.
grabear Feb 20, 2019
075b67e
Fixed build-check for ordination_plots function.
grabear Feb 20, 2019
eaaafd1
Fixed build-check for combination_palette function.
grabear Feb 20, 2019
f8ae2ac
Fixed build-check for phyloseq functions.
grabear Feb 20, 2019
5639d1b
Fixed build-check for output_dir function.
grabear Feb 20, 2019
17f8dbb
Added publication files to vignette folder.
grabear Feb 20, 2019
242f0d8
Fixed build-check for about vignette.
grabear Feb 20, 2019
9e8c5a6
Fixed build-check for vignette/.gitignore.
grabear Feb 20, 2019
f4d47e3
Fixed test for output_dir.
grabear Feb 20, 2019
6519b7a
Started fix for global variables during build-check.
grabear Feb 20, 2019
ffd3ed4
Updated package after build-check and fixes
grabear Feb 20, 2019
6bff22f
Updated pkgdown docs
grabear Feb 20, 2019
67b85e2
Updated NEWS
grabear Feb 20, 2019
9ae1404
Potential travis-ci fix.
grabear Feb 20, 2019
b937108
Updated namespace after package build.
grabear Feb 20, 2019
6843324
Updated travis config
grabear Feb 21, 2019
b03d9c5
Fixed duplicate vignette index.
grabear Feb 21, 2019
1e245fd
Update .travis.yml
grabear Feb 21, 2019
18dd2d6
Updated node labeling for heat trees
grabear Feb 22, 2019
a627c35
Merge branch 'joss-branch' of https://github.com/vallenderlab/Microbi…
grabear Feb 22, 2019
997e668
Updated DESCRIPTION and travis build.
grabear Feb 22, 2019
2070970
Merge branch 'joss-branch' into dev-master
grabear Feb 26, 2019
2c088aa
Updated summary section to JOSS submission.
grabear Feb 26, 2019
420a5b7
Updated Workflow/Utilities sections to JOSS submission and paper vign…
grabear Feb 26, 2019
ba2661e
Updated news for 0.5.1.
grabear Feb 26, 2019
6fcb439
Updated version in DESCRIPTION.
grabear Feb 26, 2019
d3e14cb
Alphabetized dependencies in DESCRIPTION.
grabear Feb 26, 2019
acbbe70
Updated .travis.yml
sdhutchins Feb 27, 2019
93fcce6
Fixed outstanding dplyr bug.
grabear Feb 27, 2019
47a6fb7
Merge branch 'joss-branch2' of https://github.com/vallenderlab/Microb…
grabear Feb 27, 2019
837d20f
Updated travis. Added Codecov token.
grabear Feb 27, 2019
0af34b4
Added Shaurita's ORCiD
grabear Feb 27, 2019
0d55098
Updated pkgdown docs
grabear Feb 27, 2019
a3b631d
Added Xiao's ORCiD.
grabear Feb 27, 2019
f874533
Acknowledge current research.
grabear Feb 27, 2019
443ab9a
Added link to documentation in README.
grabear Feb 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
^\.travis\.yml$
^.*\.Rproj$
^\.Rproj\.user$
CNAME
^pkgdown$
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ branches:
only:
- master
- dev-master
- build-fixes


env:
global:
- _R_CHECK_FORCE_SUGGESTS_=false
- R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
- CODECOV_TOKEN=2ff74b01-00e8-4e2f-9cc7-1f90ca17e480

r:
- oldrel
- release
- devel

Expand Down
47 changes: 25 additions & 22 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Package: MicrobiomeR
Title: Analyze Microbiome Data
Version: 0.4.1
Version: 0.5.1
Authors@R: c(
person("Robert", "Gilmore", email = "rgilmore@umc.edu", role = "cre"),
person("Shaurita", "Hutchins", email = "shutchins2@umc.edu", role = "aut"))
Maintainer: Rob Gilmore <rgilmore@umc.edu>
License: MIT + file LICENSE
biocViews: Metagenomics, Microbiome, Sequencing, SystemsBiology
Description: An R package for microbiome analysis combining functions from phyloseq, metacodeR,
Expand All @@ -16,48 +17,50 @@ Remotes:
github::grunwaldlab/metacoder,
github::joey711/phyloseq,
github::microbiome/microbiome,
github::r-lib/covr,
github::jonclayden/shades
Imports:
ape,
biomformat,
crayon,
DT,
data.table,
diptest,
dplyr,
rlang,
forcats,
ggplot2,
ggpubr,
ggthemes,
ggrepel,
glue,
htmlwidgets,
htmltools,
leaflet,
magrittr,
metacoder,
modes,
microbiome (>= 1.5.27),
modes,
openxlsx,
phyloseq,
plotly,
purrr,
rlang,
rstudioapi,
scales,
scico,
shades,
stringr,
taxa,
tibble,
tidyr,
viridis,
yaml,
ggplot2,
stringr,
rstudioapi,
magrittr,
ggpubr,
ggthemes,
crayon,
biomformat,
forcats,
ggrepel,
scales,
vegan,
leaflet,
htmlwidgets,
shades
viridis,
yaml
Suggests:
covr,
knitr,
testthat,
rmarkdown,
covr
testthat
Additional_repositories:
http://bioconductor.org/packages/release/bioc/,
http://bioconductor.org/packages/release/data/annotation,
Expand All @@ -66,6 +69,6 @@ Additional_repositories:
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
URL: https://github.com/vallenderlab/MicrobiomeR
URL: https://github.com/vallenderlab/MicrobiomeR, https://microbiomer.vallenderlab.science/
BugReports: https://github.com/vallenderlab/MicrobiomeR/issues
VignetteBuilder: knitr
7 changes: 4 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(agglomerate_metacoder)
export(agglomerate_taxmap)
export(alpha_diversity_measures)
export(alpha_diversity_plot)
export(as_MicrobiomeR_format)
Expand All @@ -15,9 +15,9 @@ export(correlation_data)
export(correlation_plot)
export(correlation_plots)
export(cov_filter)
export(create_metacoder)
export(create_phyloseq)
export(create_pub_table)
export(create_taxmap)
export(get_color_palette)
export(heat_tree_parameters)
export(heat_tree_plots)
Expand Down Expand Up @@ -59,7 +59,6 @@ export(viridis_magma_palette)
export(viridis_palette)
export(vlookup)
export(which_format)
import(scales)
import(vegan)
importFrom(ape,Ntip)
importFrom(ape,is.rooted)
Expand Down Expand Up @@ -155,6 +154,8 @@ importFrom(purrr,modify_at)
importFrom(rlang,enquos)
importFrom(rlang,eval_tidy)
importFrom(rlang,is_quosure)
importFrom(scales,percent)
importFrom(scales,pretty_breaks)
importFrom(scico,scico)
importFrom(shades,saturation)
importFrom(shades,scalefac)
Expand Down
31 changes: 30 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# MicrobiomeR 0.5.1
* A specific bug was introduced that prevented local machines and Travis CI servers from building
the package.
* This bug is attributed to a dplyr update (0.7.8 -> 0.8.0.1)
* See [Joss branch #79](https://github.com/vallenderlab/MicrobiomeR/pull/79)
* See [Joss debug branch #82](https://github.com/vallenderlab/MicrobiomeR/pull/82)
* See [dplyr issue #4213](https://github.com/tidyverse/dplyr/issues/4213)
* See [Travis CI forum post](https://travis-ci.community/t/travis-build-ignoring-r-package-version-in-description/2431)
* Updated the paper for submission


# MicrobiomeR 0.5.0

* Added the JOSS paper and draft vignette
* Changed correlation plots
* Removed color from background
* Removed hard coded plot limits
* Added "1:1" line and Average lines
* Added a `trans` parameter to transform the x and y axis
* Changed function names
* From `create_metacoder` to `create_taxmap`
* From `agglomerate_metacoder` to `agglomerate_taxmap`
* From `melt_metacoder` to `melt_taxmap`
* Bugs
* Fixed `output_dir` bug where error should have been a warning
* Fixed correlation plot bug where treatments were on the wrong axis.
* Fixed output message for heat tree plots.
* Fixed build-check Notes and Warnings

# MicrobiomeR 0.4.1

* Fixed wilcoxon pvalue in analysis vignette.
Expand All @@ -8,7 +37,7 @@
## Renamed functions

* `get_alpha_diversity_measures` to `alpha_diversity_measures`

## Added functions

* Added `stacked_barplots`, `alpha_diversity_plots`, `ordination_plots`
Expand Down
14 changes: 8 additions & 6 deletions R/alpha-diversity.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @title Alpha Diveristy Measues
#' @description This function generates various alpha diversity measures include Shannon, Fisher, Coverage, Gini Simpson, and Inverse Simpson.
#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.
#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
#' @param group The "TreatmentGroup" or similar grouping from your metadata to denote sample groups, Default: 'TreatmentGroup'
#' @return Returns a list of alpha diversity measures with metadata.
#' @pretty_print TRUE
Expand All @@ -22,11 +22,11 @@
#' @importFrom utils combn
alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
metacoder_object <- validate_MicrobiomeR_format(
obj = create_metacoder(obj),
obj = create_taxmap(obj),
valid_formats = c("analyzed_format")
)

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

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

#' @title Alpha Diversity Plot
#' @description Plot the alpha diversity using a violin plot. `alpha_diversity_plots` generates plots for all alpha diversity measures.
#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.
#' @param obj An object to be converted to a Taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
#' @param measure Select an alpha diversity measure such as shannon, gini simpson, and inverse simpson, Default: 'shannon'
#' @param group The "TreatmentGroup" or similar grouping or column from your metadata to denote sample groups, Default: 'TreatmentGroup'
#' @param select_otu_table Choose an otu table to analyze, Default: 'otu_proportions'
Expand All @@ -65,7 +65,9 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
#' if (interactive()) {
#' library(MicrobiomeR)
#' data <- analyzed_silva
#' plot <- alpha_diversity_plot(obj = data, measure = "shannon", select_otu_table = "otu_proportions")
#' plot <- alpha_diversity_plot(obj = data,
#' measure = "shannon",
#' select_otu_table = "otu_proportions")
#' plot
#' }
#' }
Expand All @@ -81,7 +83,7 @@ alpha_diversity_measures <- function(obj, group = "TreatmentGroup") {
alpha_diversity_plot <- function(obj, measure = "shannon", group = "TreatmentGroup", select_otu_table = "otu_proportions", title = NULL) {
# Validate data format
metacoder_object <- validate_MicrobiomeR_format(
obj = create_metacoder(obj),
obj = create_taxmap(obj),
valid_formats = c("analyzed_format")
)
metacoder_object$data$sample_data[[measure]] <- vegan::diversity(metacoder_object$data[[select_otu_table]][, metacoder_object$data$sample_data$X.SampleID],
Expand Down
26 changes: 15 additions & 11 deletions R/barplot.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#' @title Melt Taxmap
#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
#' @importFrom dplyr right_join setdiff
#' @importFrom tidyr gather_
#' @family Formatting
#' @rdname stacked_barplot
melt_metacoder <- function(obj) {
#' @rdname melt_taxmap
melt_taxmap <- function(obj) {
sd <- data.frame(obj$data$sample_data)
TT <- data.frame(obj$data$otu_annotations, stringsAsFactors = FALSE)
otu.table <- data.frame(obj$data$otu_proportions, check.names = FALSE, stringsAsFactors = FALSE)
Expand All @@ -13,12 +15,13 @@ melt_metacoder <- function(obj) {
rename(SampleID = `X.SampleID`) %>%
rename(OTU = `otu_id`)
}

#' @title Convert Proportions
#' @param melted_df A "melted" dataframe from the metacoder object's data.
#' @param tax_level The taxonomic level, Default: 'Phylum'
#' @importFrom dplyr filter group_by summarize mutate enquo quo_name
#' @importFrom stats na.omit
#' @family Data Manipulators
#' @rdname stacked_barplot
#' @rdname convert_proportions
convert_proportions <- function(melted_df, tax_level) {
t <- dplyr::enquo(tax_level)
tax_level.abund <- paste0(dplyr::quo_name(t), ".Abundance")
Expand All @@ -34,7 +37,7 @@ convert_proportions <- function(melted_df, tax_level) {
#' @title Stacked Barplot
#' @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.
#' `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.
#' @param obj An object to be converted to a metacoder object with \code{\link[MicrobiomeR]{create_metacoder}}.
#' @param obj An object to be converted to a taxmap object with \code{\link[MicrobiomeR]{create_taxmap}}.
#' @param tax_level The taxonomic level, Default: 'Phylum'
#' @param fill The taxonomic level by which the bars are filled, Default: 'Phylum'
#' @param xlabel The label of the x axis, Default: 'Samples'
Expand All @@ -55,8 +58,8 @@ convert_proportions <- function(melted_df, tax_level) {
#' @importFrom ggplot2 ggplot aes annotate geom_bar ylab element_blank element_rect xlab annotate
#' @importFrom magrittr %>%
#' @importFrom dplyr mutate
#' @importFrom scales pretty_breaks
#' @importFrom shades scalefac saturation
#' @import scales
#' @import vegan
#'
#' @inheritParams convert_proportions
Expand All @@ -66,13 +69,13 @@ convert_proportions <- function(melted_df, tax_level) {
#' @export
stacked_barplot <- function(obj, tax_level = "Phylum", fill = "Phylum", xlabel = "Samples", faceted = FALSE, title = NULL, palette_values = NULL) {
metacoder_object <- validate_MicrobiomeR_format(
obj = create_metacoder(obj),
obj = create_taxmap(obj),
valid_formats = c("analyzed_format")
)

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

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


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