Title: | Microbiome Exploration App |
---|---|
Description: | The MicrobiomeExplorer R package is designed to facilitate the analysis and visualization of marker-gene survey feature data. It allows a user to perform and visualize typical microbiome analytical workflows either through the command line or an interactive Shiny application included with the package. In addition to applying common analytical workflows the application enables automated analysis report generation. |
Authors: | Joseph Paulson [aut], Janina Reeder [aut, cre], Mo Huang [aut], Genentech [cph, fnd] |
Maintainer: | Janina Reeder <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.17.0 |
Built: | 2024-11-29 06:57:25 UTC |
Source: | https://github.com/bioc/microbiomeExplorer |
Abundance Heatmap module - server
abundanceHeatmap( input, output, session, aggDat, featLevel, colorOptions, levelOpts, hmSort, hmFeatList, reset )
abundanceHeatmap( input, output, session, aggDat, featLevel, colorOptions, levelOpts, hmSort, hmFeatList, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
colorOptions |
reactive storing filters selected via data input |
levelOpts |
all available level choices for this dataset |
hmSort |
reactive storing sorting method for heatmap |
hmFeatList |
reactive storing list of features to include in heatmap |
reset |
boolean reactive which resets the module if TRUE |
R code needed to generate the heatmap
Janina Reeder
Abundance Heatmap module - UI
abundanceHeatmapUI(id)
abundanceHeatmapUI(id)
id |
namespace identifier |
box holding the UI code
Janina Reeder
Adds a config call based on plotly::config
add_plotly_config(.data)
add_plotly_config(.data)
.data |
plotly data object to apply the config call to |
plotly::config call
Adds a layout call based on plotly::layout
add_plotly_layout(.data, plotTitle, xaxis_text, ylab)
add_plotly_layout(.data, plotTitle, xaxis_text, ylab)
.data |
plotly data object to apply the layout call to |
plotTitle |
plot title to use |
xaxis_text |
x axis label to use |
ylab |
y axis label to use |
plotly::layout call
This function adds feature data to the featureData slot in an MRexperiment object.
addFeatData(MRobj, featdata = NULL)
addFeatData(MRobj, featdata = NULL)
MRobj |
An MRexperiment object. |
featdata |
Feature data frame or file path. |
An updated MRexperiment object.
This function adds phenotype data to the phenoData slot in an MRexperiment object.
addPhenoData(MRobj, phenodata = NULL)
addPhenoData(MRobj, phenodata = NULL)
MRobj |
An MRexperiment object. |
phenodata |
Phenotype data frame or file path. |
An updated MRexperiment object.
This function aggregates counts by a level specified in the featureData slot of the MRexperiment object.
aggFeatures(MRobj, level = NULL, sort = TRUE)
aggFeatures(MRobj, level = NULL, sort = TRUE)
MRobj |
An MRexperiment object. |
level |
Level to aggregate over. If NULL, no aggregation occurs. |
sort |
boolean determining if resulting aggregated MRexperiment should be sorted based on rowSums; default is TRUE |
Aggregated MRexperiment object or matrix depending on out
.
data("mouseData", package = "metagenomeSeq") aggFeatures(mouseData, level = "genus")
data("mouseData", package = "metagenomeSeq") aggFeatures(mouseData, level = "genus")
Aggregation module server function
aggregationTab( input, output, session, resetInput, levelOpts, chosenLevel, meData )
aggregationTab( input, output, session, resetInput, levelOpts, chosenLevel, meData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
resetInput |
boolean updated to TRUE if new data is available |
levelOpts |
available levels to aggregate on (depends on input data) |
chosenLevel |
previously selected level (passed from different instance) |
meData |
the main MRexperiment object |
reactive list holding aggregated object, aggregation code and boolean on normalization
Janina Reeder
Aggregation module ui function
aggregationTabUI(id)
aggregationTabUI(id)
id |
namespace identifier |
box holding aggregation input elements
Janina Reeder
aggregationTabUI("atu_id")
aggregationTabUI("atu_id")
Alpha Diversity module - server
alphaDiversity( input, output, session, aggDat, featLevel, intraSettings, colorOptions, reset )
alphaDiversity( input, output, session, aggDat, featLevel, intraSettings, colorOptions, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
intraSettings |
analysis settings as passed over from analysis input module |
colorOptions |
phenotype selections: used for color choices |
reset |
boolean reactive which resets the module if TRUE |
R code used to make the alpha diversity plot
Janina Reeder
Alpha Diversity module - UI
alphaDiversityUI(id)
alphaDiversityUI(id)
id |
namespace identifier |
box holding the UI code
Janina Reeder
Relative abundance plot module - server
avgAbundance( input, output, session, aggDat, featLevel, featureSettings, normalizedData, reset )
avgAbundance( input, output, session, aggDat, featLevel, featureSettings, normalizedData, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
featureSettings |
analysis input settings passed over to this module |
normalizedData |
boolean indicating whether data has been normalized |
reset |
boolean reactive which resets the module if TRUE |
list storing plot clicks and number of features displayed (passed to feature plot module) as well as the R code to make plot
Relative abundance plot module - UI
avgAbundanceUI(id)
avgAbundanceUI(id)
id |
namespace identifier |
box containing the ui code
Janina Reeder
Beta Diversity module - server
betaDiversity( input, output, session, aggDat, aggLevel, colorOptions, shapeOptions, betadistance, betaSettings, reset )
betaDiversity( input, output, session, aggDat, aggLevel, colorOptions, shapeOptions, betadistance, betaSettings, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
MRExperiment storing data |
aggLevel |
aggregation level |
colorOptions |
phenotype selection options for color |
shapeOptions |
phenotype selection options for shape |
betadistance |
distance measured used for beta diversity analysis |
betaSettings |
input choices for beta diversity |
reset |
boolean reactive which resets the module if TRUE |
R code needed to generate the beta diversity plot
Janina Reeder
Beta Diversity module - UI
betaDiversityUI(id)
betaDiversityUI(id)
id |
namespace identifier |
box holding the ui code
Janina Reeder
Server side for the analysis input module handling analysis control
betaInput(input, output, session, meData, adonisOptions, reset)
betaInput(input, output, session, meData, adonisOptions, reset)
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment object storing all data |
adonisOptions |
phenodata colums ready for adonis analysis |
reset |
reactive boolean determining if all inputs should be reset |
list holding all chosen values and the selected feature
Janina Reeder
Main beta analysis input module. Set up to handle all analysis tabs in the app depending on given parameters
betaInputUI(id)
betaInputUI(id)
id |
element identifier - namespace |
box containing ui element
Janina Reeder
Creates an empty plotly plot using the given labels on the x and y axis
buildEmptyPlotlyPlot(xaxis_text, ylab)
buildEmptyPlotlyPlot(xaxis_text, ylab)
xaxis_text |
x axis label |
ylab |
y axis label |
call to plotly_empty
Sets up a dataframe used by several plotting functions by joining the required data with relevant phenotype data
buildPlottingDF( df, phenoTable, x_var = NULL, facet1 = NULL, facet2 = NULL, col_by = NULL, col_name = col_by, id_var = NULL )
buildPlottingDF( df, phenoTable, x_var = NULL, facet1 = NULL, facet2 = NULL, col_by = NULL, col_name = col_by, id_var = NULL )
df |
dataframe storing plotting data values |
phenoTable |
pData of the MRexperiment; all following parameters must be a column of the phenoTable |
x_var |
main plotting variable |
facet1 |
column-based faceting (can be NULL) |
facet2 |
row-based faceting (can be NULL) |
col_by |
coloring factor (can be NULL) |
col_name |
character to be used as name for col_by |
id_var |
variable used to connect samples longitudinally (can be NULL) |
dataframe obtained by joining df and relevant columns of phenoTable
Function to compute the PCAs for a given distance matrix
calculatePCAs(distmat, pcas)
calculatePCAs(distmat, pcas)
distmat |
the distance matrix |
pcas |
2-element vector of PCAs to include in results |
the x slot limited to pcas after calling stats::prcomp on distmat
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") distmat <- computeDistMat(aggdat, dist_method = "bray") calculatePCAs(distmat, c(1,2))
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") distmat <- computeDistMat(aggdat, dist_method = "bray") calculatePCAs(distmat, c(1,2))
Helper function to calculate the confidence interval for a cor.test
computeCI_Interval(num, mS, method)
computeCI_Interval(num, mS, method)
num |
number of samples |
mS |
results of cor.test |
method |
statistical method used for cor.test |
named vector holding lower and upper thresholds
Function to compute the distance matrix using vegdist from the vegan package
computeDistMat(aggdat, dist_method, log = TRUE, nfeatures = nrow(aggmat))
computeDistMat(aggdat, dist_method, log = TRUE, nfeatures = nrow(aggmat))
aggdat |
aggregated MRExperiment |
dist_method |
distance method from vegan package (See ?vegan::vegdist for details) |
log |
transform count matrix to log2; default is TRUE |
nfeatures |
number of features to use; default is all |
distance as dist
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") computeDistMat(aggdat, dist_method = "bray")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") computeDistMat(aggdat, dist_method = "bray")
corr Analysis Module - server
corrAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData )
corrAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
data |
the main data object returned from data_input_module |
levelOpts |
available levels to aggregate on (depends on input data) |
chosenLevel |
previously selected level (passed from different instance) |
resetInput |
reactive boolean determining if reset is required |
aggData |
the aggregated MRExperiment object |
reactive holding code to be used in reports
corr Analysis Module - UI
corrAnalysisUI(id)
corrAnalysisUI(id)
id |
namespace identifier |
fluidRow containing the ui code
Janina Reeder
corrAnalysisUI("coranalysis_id")
corrAnalysisUI("coranalysis_id")
This function plots a scatterplot of two features along with sample correlation statistics.
corrFeature( aggdat, feat1, feat2, log = TRUE, method = c("spearman", "pearson", "kendall"), addRegression = TRUE, col_by = NULL, facet1 = NULL, facet2 = NULL, plotTitle = "", xlab = NULL, ylab = NULL, allowWebGL = TRUE, pwidth = 550, pheight = 200 )
corrFeature( aggdat, feat1, feat2, log = TRUE, method = c("spearman", "pearson", "kendall"), addRegression = TRUE, col_by = NULL, facet1 = NULL, facet2 = NULL, plotTitle = "", xlab = NULL, ylab = NULL, allowWebGL = TRUE, pwidth = 550, pheight = 200 )
aggdat |
aggregated MRExperiment |
feat1 |
Feature 1. |
feat2 |
Feature 2. |
log |
Log2 transform data. Default is TRUE. |
method |
Correlation coefficient. One of "spearman" (default), "pearson", or "kendall". |
addRegression |
boolean parameter indicating whether linear regression line should be drawn; default: TRUE |
col_by |
Phenotype for coloring. |
facet1 |
Phenotype for facet 1. |
facet2 |
Phenotype for facet 2. |
plotTitle |
Plot title. Default is no title. |
xlab |
X-axis label. Default is |
ylab |
Y-axis label. Default is |
allowWebGL |
boolean indicating if WebGL should be used for large data |
pwidth |
overall plot width; default is 550 |
pheight |
overall plot height; default is 200 |
list holding plotly plot and lm fit
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") corrFeature(aggdat, feat1 = "Bacteroides", feat2 = "Prevotella")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") corrFeature(aggdat, feat1 = "Bacteroides", feat2 = "Prevotella")
Server side for the analysis input module handling analysis control
corrInput( input, output, session, type, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
corrInput( input, output, session, type, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
input |
shiny input |
output |
shiny output |
session |
shiny session |
type |
of the correlation (feature vs phenotype) |
meData |
MRExperiment object storing all data |
facetOptions |
named vector of available facet choices |
reset |
reactive boolean determining if all inputs should be reset |
aggDat |
aggregated MRExperiment object (default is NULL) |
list holding all chosen values and the selected feature
Janina Reeder
Main correlation analysis input module. Handles correlation analysis tab in the app
corrInputUI(id, type)
corrInputUI(id, type)
id |
element identifier - namespace |
type |
determines if 'feature' or 'pheno' correlation |
box containing ui element
Janina Reeder
This function plots a scatterplot of a feature and a phenotype along with sample correlation statistics.
corrPhenotype( aggdat, feature, phenotype, log = TRUE, method = c("spearman", "pearson", "kendall"), addRegression = TRUE, col_by = NULL, facet1 = NULL, facet2 = NULL, plotTitle = "", xlab = NULL, ylab = NULL, allowWebGL = TRUE, pwidth = 550, pheight = 200 )
corrPhenotype( aggdat, feature, phenotype, log = TRUE, method = c("spearman", "pearson", "kendall"), addRegression = TRUE, col_by = NULL, facet1 = NULL, facet2 = NULL, plotTitle = "", xlab = NULL, ylab = NULL, allowWebGL = TRUE, pwidth = 550, pheight = 200 )
aggdat |
aggregated MRExperiment |
feature |
Feature input. |
phenotype |
Phenotype input (must be numeric) |
log |
Log2 transform data. Default is TRUE. |
method |
Correlation coefficient. One of "spearman" (default), "pearson", or "kendall". |
addRegression |
boolean parameter indicating whether linear regression line should be drawn; default: TRUE |
col_by |
Phenotype for coloring. |
facet1 |
Phenotype for facet 1. |
facet2 |
Phenotype for facet 2. (WIP/TODO) |
plotTitle |
Plot title. Default is no title. |
xlab |
X-axis label. Default is |
ylab |
Y-axis label. Default is |
allowWebGL |
boolean indicating if WebGL should be used for large data |
pwidth |
overall plot width; default is 550 |
pheight |
overall plot height; default is 200 |
list holding plotly plot and lm fit
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") corrPhenotype(aggdat, feature = "Bacteroides", phenotype = "relativeTime")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") corrPhenotype(aggdat, feature = "Bacteroides", phenotype = "relativeTime")
This function makes the header for the report R script to be rendered by knitr into Rmarkdown and rendered into HTML, PDF, or Word.
createHeader( title = "MicrobiomeExplorer Report", author = "", date = "", data.source = "", output = getOption("me.reportformat"), toc = TRUE )
createHeader( title = "MicrobiomeExplorer Report", author = "", date = "", data.source = "", output = getOption("me.reportformat"), toc = TRUE )
title |
Title of the report. |
author |
Author of the report. |
date |
Date of the report. |
data.source |
R code used to obtain the dataset |
output |
Output of Rmarkdown file. |
toc |
Table of contents. Default is TRUE. |
This was adapted from https://yihui.name/knitr/demo/stitch/
A character vector where each element is a line in the R script.
Main Data input server where the user selects files to upload to the app or connects to database
dataInput( input, output, session, dataSource, dataFilterRep, qcRep, addPheno, resetReports )
dataInput( input, output, session, dataSource, dataFilterRep, qcRep, addPheno, resetReports )
input |
module input |
output |
module output |
session |
app session |
dataSource |
reactive Value storing commands for loading data |
dataFilterRep |
reactive Value storing commands for filtering data |
qcRep |
reactive Value storing commands for producing qc plots |
addPheno |
reactive boolean keeping track of phenodata changes |
resetReports |
reactive boolean indicating whether reports need to be reset |
list of reactives containing the uploaded and filtered data as well as the filterChoices on phenotypes
Janina Reeder
Main Data input UI where the user selects files to upload to the app or connects to database
dataInputUI(id)
dataInputUI(id)
id |
module identifier |
fluidRow holding UI interface
Janina Reeder
dataInputUI("datainput_id")
dataInputUI("datainput_id")
This function takes in the levels of a factor phenotype and outputs a design matrix of all pairwise comparisons.
designPairs(levels)
designPairs(levels)
levels |
Character vector of the levels of a factor phenotype |
A model matrix
diff Analysis Module - server
diffAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData, normalizedData )
diffAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData, normalizedData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
data |
the main data object returned from data_input_module |
levelOpts |
available levels to aggregate on (depends on input data) |
chosenLevel |
previously selected level (passed from different instance) |
resetInput |
reactive boolean determining if reset is required |
aggData |
the aggregated MRExperiment object |
normalizedData |
boolean indicating if normalization was done |
reactive holding code to be used in reports
Janina Reeder
Diff Analysis Module - UI
diffAnalysisUI(id)
diffAnalysisUI(id)
id |
namespace identifier |
fluidRow containing the ui code
Janina Reeder
diffAnalysisUI("diffanalysis_id")
diffAnalysisUI("diffanalysis_id")
Server side for the analysis input module handling analysis control
diffInput(input, output, session, meData, facetOptions = NULL, reset)
diffInput(input, output, session, meData, facetOptions = NULL, reset)
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment object storing all data |
facetOptions |
named vector of available facet choices |
reset |
reactive boolean determining if all inputs should be reset |
list holding all chosen values and the selected feature
Janina Reeder
Main diffanalysis input module. Set up to handle diff analysis tabs in the app depending on given parameters
diffInputUI(id)
diffInputUI(id)
id |
element identifier - namespace |
box containing ui element
Janina Reeder
Differential analysis module server code
diffTable( input, output, session, aggDat, featLevel, diffSettings, reset, normalized )
diffTable( input, output, session, aggDat, featLevel, diffSettings, reset, normalized )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
diffSettings |
reactive storing values selected in analysis input interface |
reset |
boolean reactive which resets the module if TRUE |
normalized |
boolean reactive indicating if data has been normalized |
list containing R code for analysis and for feature plots
Janina Reeder
Differential Analysis module UI
diffTableUI(id)
diffTableUI(id)
id |
namespace identifier |
row containing the UI elements
Janina Reeder
This function adds phenotype data to the phenoData slot in an MRexperiment object.
extendPhenoData(MRobj, phenodata = NULL)
extendPhenoData(MRobj, phenodata = NULL)
MRobj |
An MRexperiment object. |
phenodata |
Phenotype data frame or file path. |
An updated MRexperiment object.
Feature plot module - server
featAbundance( input, output, session, aggDat, featLevel, intraSettings, selectedFeat, featName, numOfFeats, ylabMode, normalizedData, reset )
featAbundance( input, output, session, aggDat, featLevel, intraSettings, selectedFeat, featName, numOfFeats, ylabMode, normalizedData, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
intraSettings |
analysis settings passed over from analysis input module |
selectedFeat |
feature selected via drop down element of analysis input |
featName |
plotly click event passed via relative abundance |
numOfFeats |
number of features shown in relative abundance plot (affects plotly click data) |
ylabMode |
character indication if raw \"Reads\" or \"Percentage\" should be shown |
normalizedData |
boolean indicating whether data has been normalized |
reset |
boolean reactive which resets the module if TRUE |
R code needed to build the feature plot
Janina Reeder
Feature plot module - UI
featAbundanceUI(id)
featAbundanceUI(id)
id |
namespace identifier |
box holding the UI code
feature Analysis Module - server
featureAnalysis( input, output, session, data, resetInput, aggData, normalizedData )
featureAnalysis( input, output, session, data, resetInput, aggData, normalizedData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
data |
the main data object returned from data_input_module |
resetInput |
reactive boolean determining if reset is required |
aggData |
the aggregated MRExperiment object |
normalizedData |
boolean indicating if normalization was done |
reactive holding code to be used in reports
Janina Reeder
feature Analysis Module - UI
featureAnalysisUI(id)
featureAnalysisUI(id)
id |
namespace identifier |
fluidRow containing the ui code
Janina Reeder
featureAnalysisUI("featureanalysis_id")
featureAnalysisUI("featureanalysis_id")
Feature correlation analysis server module
featureCorr( input, output, session, aggDat, colorOptions, corFeatBase, corFeat2, corFacet1, corFacet2, corMethod, reset )
featureCorr( input, output, session, aggDat, colorOptions, corFeatBase, corFeat2, corFacet1, corFacet2, corMethod, reset )
input |
module input |
output |
module output |
session |
app session |
aggDat |
aggregated MRExperiment |
colorOptions |
reactive storing filters available via data input |
corFeatBase |
first correlation feature |
corFeat2 |
second correlation feature |
corFacet1 |
first correlation facet |
corFacet2 |
second correlation facet |
corMethod |
correlation method to use |
reset |
boolean reactive which resets the module if TRUE |
R code used to do the correlation analysis (character)
Janina Reeder
Feature correlation analysis module UI
featureCorrUI(id)
featureCorrUI(id)
id |
namespace identifier |
box containing the UI elements
Janina Reeder
Server side for the feature analysis input module
featureInput( input, output, session, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
featureInput( input, output, session, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment object storing all data |
facetOptions |
named vector of available facet choices |
reset |
reactive boolean determining if all inputs should be reset |
aggDat |
aggregated MRExperiment object (default is NULL) |
list holding all chosen values and the selected feature
Janina Reeder
Main feature analysis input module. Set up to handle all analysis tabs in the app depending on given parameters
featureInputUI(id)
featureInputUI(id)
id |
element identifier - namespace |
box containing ui element
Janina Reeder
Feature table module server code
featureTable(input, output, session, meData, featureModRep)
featureTable(input, output, session, meData, featureModRep)
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment storing the data |
featureModRep |
reactiveValue storing modifications performed on fData |
feature table server fragment - no return value
Janina Reeder
Feature table UI module
featureTableUI(id)
featureTableUI(id)
id |
namespace identifier |
fluidRow containing the UI code for feature tables
Janina Reeder
featureTableUI("feature_id")
featureTableUI("feature_id")
Module handling file upload for the application: server
fileUpload( input, output, session, meData, meName, initializeData, addPheno, dataSource, resetFile = reactive(NULL) )
fileUpload( input, output, session, meData, meName, initializeData, addPheno, dataSource, resetFile = reactive(NULL) )
input |
module input |
output |
module output |
session |
app session |
meData |
main reactive storing the MRexperiment data |
meName |
main reactive storing the filename uploaded |
initializeData |
reactiveVal keeping track of new uploads to reset data |
addPheno |
reactiveVal keeping track of phenodata changes |
dataSource |
reactive Value storing commands for loading data |
resetFile |
indicating if module should be reset |
boolean denoting successful upload of a file
Janina Reeder
Module handling file upload for the application: UI In a deployed version this module should be replaced with database access
fileUploadUI(id)
fileUploadUI(id)
id |
module identifier |
div holding ui elements
Janina Reeder
Function to filter the MRexperiment by certain phenotype values
filterByPheno(MRobj, rm_phenovalues)
filterByPheno(MRobj, rm_phenovalues)
MRobj |
the MRexperiment to subset |
rm_phenovalues |
list of named vectors with names corresponding to column names in pData and values representing phenotypes within the column |
the filtered MRobj
Janina Reeder
data("mouseData", package = "metagenomeSeq") filterByPheno(MRobj = mouseData, rm_phenovalues = list("diet" = c("BK"),"mouseID" = c("PM1","PM10")))
data("mouseData", package = "metagenomeSeq") filterByPheno(MRobj = mouseData, rm_phenovalues = list("diet" = c("BK"),"mouseID" = c("PM1","PM10")))
Function to filter the MRexperiment data by numerical parameters
filterMEData(MRobj, minpresence = 1, minfeats = 2, minreads = 2)
filterMEData(MRobj, minpresence = 1, minfeats = 2, minreads = 2)
MRobj |
MRExperiment object to filter |
minpresence |
minimum sample presence per feature |
minfeats |
minimum number of features per sample |
minreads |
minimum number of reads per sample |
the filtered MRobj
Janina Reeder
data("mouseData", package = "metagenomeSeq") filterMEData(MRobj = mouseData, minpresence = 4, minfeats = 300)
data("mouseData", package = "metagenomeSeq") filterMEData(MRobj = mouseData, minpresence = 4, minfeats = 300)
This function generates the pieces of the report, which includes the R script, Rmarkdown file, and any Rmarkdown outputs.
generateReport( rcode, filename = "report", dir = "out", title = "MicrobiomeExplorer Report", author = "", date = "`r format(Sys.time(), '%d %B, %Y')`", data.source = "", output = c("html_document"), toc = TRUE, intro_text = NULL )
generateReport( rcode, filename = "report", dir = "out", title = "MicrobiomeExplorer Report", author = "", date = "`r format(Sys.time(), '%d %B, %Y')`", data.source = "", output = c("html_document"), toc = TRUE, intro_text = NULL )
rcode |
A named list where each element corresponds to a different analysis (Alpha diversity, Beta diversity). The name of the list is used to denote the first part of the code chunks in each analysis section (alpha, beta). Each element is itself a list of R commands corresponding to a code chunk. |
filename |
Name of output files. Default is "report". |
dir |
Directory of output. Default is "out". |
title |
Title of the report. |
author |
Author of the report. |
date |
Date of the report. |
data.source |
R code used to obtain the dataset |
output |
Output of Rmarkdown file. Options defined in global.R |
toc |
Table of contents. Default is TRUE. |
intro_text |
Introductory text to include with the report (optional) |
Adapted from https://yihui.name/knitr/demo/stitch/
A character vector where each element is a line in the R script.
Helper function returning the fData modifications as strings for report generation
getFeatModCode(featureanno)
getFeatModCode(featureanno)
featureanno |
type of feature annotation; values are "Mark unknown" or "Roll down" |
String containing R code performing the modification
Helper function returning the fData modifications as strings for report generation
getFeatSplitCode(splittaxonomy)
getFeatSplitCode(splittaxonomy)
splittaxonomy |
name of column to split on |
String containing R code performing the modification
Helper function assigning different file extensions to specific short texts identifying the types
getFileType(fileext)
getFileType(fileext)
fileext |
the file extension found after '.' |
character string for the filetype
Janina Reeder
Helper function to filter phenodata for interesting phenotypes to be used for filtering or subsetting
getFilterChoices(MRobj)
getFilterChoices(MRobj)
MRobj |
the MRexperiment storing the data |
list of named vectors with names being pData column headers and values being unique entries; columns with only one entry or those with different values for each samples are omitted
Janina Reeder
Function to find a non-empty facet in the last row. This will be the one to be connected to the plot legend to avoid duplicates within
getLegendLevel(df2, facets, facet2s)
getLegendLevel(df2, facets, facet2s)
df2 |
plotting data frame |
facets |
column facets |
facet2s |
row facets |
the name of the column-based facet which can be used as legend
Helper function returning the code used to modify the data types of the pheno table
getPhenoChanges(phenotype, datatype)
getPhenoChanges(phenotype, datatype)
phenotype |
name of the phenotype column header |
datatype |
variable type to assign to column |
String storing code to perform modification
Janina Reeder
Helper function returning the code used to modify the phenotable as a string
getPhenoModCode(name, pheno1, pheno2)
getPhenoModCode(name, pheno1, pheno2)
name |
interaction name |
pheno1 |
first interaction phenotype |
pheno2 |
second interaction phenotype |
String storing code to perform modification
Janina Reeder
Helper function to account for issues plotly has with very small widths (these end up being 1 and cover the entire plotting area)
getWidths(df2, facets, x_var, drop = TRUE)
getWidths(df2, facets, x_var, drop = TRUE)
df2 |
dataframe storing plotting data |
facets |
column facets |
x_var |
x variable |
drop |
passed on as .drop to dplyr::group_by |
widths for each facet
Server side for the analysis input module handling analysis control
heatmapInput(input, output, session, meData, reset, aggDat = reactive(NULL))
heatmapInput(input, output, session, meData, reset, aggDat = reactive(NULL))
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment object storing all data |
reset |
reactive boolean determining if all inputs should be reset |
aggDat |
aggregated MRExperiment object (default is NULL) |
list holding all chosen values and the selected feature
Janina Reeder
Heatmap analysis input module. Set up to handle all analysis tabs in the app depending on given parameters
heatmapInputUI(id)
heatmapInputUI(id)
id |
element identifier - namespace |
box containing ui element
Janina Reeder
inter Analysis Module - server
interAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData )
interAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
data |
the main data object returned from data_input_module |
levelOpts |
available levels to aggregate on (depends on input data) |
chosenLevel |
previously selected level (passed from different instance) |
resetInput |
reactive boolean determining if reset is required |
aggData |
the aggregated MRExperiment object |
reactive holding code to be used in reports
inter Analysis Module - UI
interAnalysisUI(id)
interAnalysisUI(id)
id |
namespace identifier |
fluidRow containing the ui code
Janina Reeder
interAnalysisUI("interanalysis_id")
interAnalysisUI("interanalysis_id")
Intra Analysis Module - server
intraAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData, normalizedData )
intraAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData, normalizedData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
data |
the main data object returned from data_input_module |
levelOpts |
available levels to aggregate on (depends on input data) |
chosenLevel |
previously selected level (passed from different instance) |
resetInput |
reactive boolean determining if reset is required |
aggData |
the aggregated MRExperiment object |
normalizedData |
boolean indicating if normalization was done |
reactive holding code to be used in reports
Janina Reeder
Intra Analysis Module - UI
intraAnalysisUI(id)
intraAnalysisUI(id)
id |
namespace identifier |
fluidRow containing the ui code
Janina Reeder
intraAnalysisUI("intraanalysis_id")
intraAnalysisUI("intraanalysis_id")
Server side for the intra analysis input module
intraInput( input, output, session, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
intraInput( input, output, session, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment object storing all data |
facetOptions |
named vector of available facet choices |
reset |
reactive boolean determining if all inputs should be reset |
aggDat |
aggregated MRExperiment object (default is NULL) |
list holding all chosen values and the selected feature
Janina Reeder
Main intra analysis input module. Set up to handle all analysis tabs in the app depending on given parameters
intraInputUI(id)
intraInputUI(id)
id |
element identifier - namespace |
box containing ui element
Janina Reeder
long Analysis Module - server
longAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData, normalizedData )
longAnalysis( input, output, session, data, levelOpts, chosenLevel, resetInput, aggData, normalizedData )
input |
shiny input |
output |
shiny output |
session |
shiny session |
data |
the main data object returned from data_input_module |
levelOpts |
available levels to aggregate on (depends on input data) |
chosenLevel |
previously selected level (passed from longerent instance) |
resetInput |
reactive boolean determining if reset is required |
aggData |
the aggregated MRExperiment object |
normalizedData |
boolean indicating if normalization was done |
reactive holding code to be used in reports
Janina Reeder
Long Analysis Module - UI
longAnalysisUI(id)
longAnalysisUI(id)
id |
namespace identifier |
fluidRow containing the ui code
Janina Reeder
longAnalysisUI("longanalysis_id")
longAnalysisUI("longanalysis_id")
Server side for the analysis input module handling analysis control
longInput( input, output, session, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
longInput( input, output, session, meData, facetOptions = NULL, reset, aggDat = reactive(NULL) )
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRexperiment object storing all data |
facetOptions |
named vector of available facet choices |
reset |
reactive boolean determining if all inputs should be reset |
aggDat |
aggregated MRexperiment |
list holding all chosen values and the selected feature
Janina Reeder
Main diffanalysis input module. Set up to handle diff analysis tabs in the app depending on given parameters
longInputUI(id)
longInputUI(id)
id |
element identifier - namespace |
box containing ui element
Janina Reeder
Longitudinal analysis module server code
longResults( input, output, session, aggDat, featLevel, longSettings, normalizedData, reset )
longResults( input, output, session, aggDat, featLevel, longSettings, normalizedData, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
longSettings |
reactive storing values selected in analysis input interface |
normalizedData |
reactive boolean indicating if data has been normalized |
reset |
boolean reactive which resets the module if TRUE |
list containing R code for analysis and for feature plots
Janina Reeder
Longitudinal Analysis module UI
longResultsUI(id)
longResultsUI(id)
id |
namespace identifier |
row containing the UI elements
Janina Reeder
This function makes a scatterplot of read and feature counts for each sample. It was adjusted based on original work by Mo Huang
makeQCPlot( MRobj, col_by = NULL, log = "none", filter_feat = 0, filter_read = 0, allowWebGL = TRUE, pwidth = 550, pheight = 550 )
makeQCPlot( MRobj, col_by = NULL, log = "none", filter_feat = 0, filter_read = 0, allowWebGL = TRUE, pwidth = 550, pheight = 550 )
MRobj |
metagenomeSeq object to be plotted |
col_by |
factor by which to color the points |
log |
character indicating which (if any) axes should be shown as log |
filter_feat |
Numeric Y-coordinate to draw horizontal dashed line to indicate feature filtering. If 0 (default), no line is drawn. |
filter_read |
Numeric X-coordinate to draw vertical dashed line to indicate read count filtering. If 0 (default), no line is drawn. |
allowWebGL |
boolean indicating if webGL should be added |
pwidth |
overall plot width; default is 550 (125 are added for legend) |
pheight |
overall plot height; default is 550 |
the plotly QC plot
Janina Reeder
data("mouseData", package = "metagenomeSeq") makeQCPlot(mouseData)
data("mouseData", package = "metagenomeSeq") makeQCPlot(mouseData)
Calls appropriate normalization functions depending on input parameter The two available methods included in the package are based on either calculating proportions or by using cumulative sum scaling (CSS), Paulson, et al. Nat Meth 2013.
normalizeData(MRobj, norm_method)
normalizeData(MRobj, norm_method)
MRobj |
the MRexperiment |
norm_method |
method to use for normalization; CSS or Proportional |
the normalized MRobj
data("mouseData", package = "metagenomeSeq") normalizeData(mouseData, norm_method = "CSS")
data("mouseData", package = "metagenomeSeq") normalizeData(mouseData, norm_method = "CSS")
Helper function used to build a correct interactionName based on the chosen columns
parseInteractionName(interactionName)
parseInteractionName(interactionName)
interactionName |
as chosen by user. This may not be good to store internally |
updated interactionName or warning/error string
Phenotype correlation analysis server module
phenotypeCorr( input, output, session, aggDat, colorOptions, corFeatBase, corPheno, corFacet1, corFacet2, corMethod, reset )
phenotypeCorr( input, output, session, aggDat, colorOptions, corFeatBase, corPheno, corFacet1, corFacet2, corMethod, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
colorOptions |
reactive storing filters available via data input |
corFeatBase |
first correlation feature |
corPheno |
correlation phenotype |
corFacet1 |
first correlation facet |
corFacet2 |
second correlation facet |
corMethod |
correlation method to use |
reset |
boolean reactive which resets the module if TRUE |
R code used to do the correlation analysis (character)
Janina Reeder
Phenotype correlation analysis module
phenotypeCorrUI(id)
phenotypeCorrUI(id)
id |
namespace identifier |
box containing the UI element
Janina Reeder
Phenotype table server module
phenotypeTable(input, output, session, meData, phenoModRep, addPheno)
phenotypeTable(input, output, session, meData, phenoModRep, addPheno)
input |
shiny input |
output |
shiny output |
session |
shiny session |
meData |
MRExperiment storing the data |
phenoModRep |
reactive Value storing any phenotable modifications made |
addPheno |
reactive boolean keeping track of pheno data modifications |
phenotype table server fragment - no return value
Janina Reeder
Phenotype table UI module
phenotypeTableUI(id)
phenotypeTableUI(id)
id |
namespace identifier |
fluidRow holding the ui code
Janina Reeder
phenotypeTableUI("phenotype_id")
phenotypeTableUI("phenotype_id")
This function plots the relative abundance of the top abundant features.
plotAbundance( aggdat, level, x_var = "SAMPLE_ID", ind = seq_len(10), plotTitle = "", ylab = "Reads", facet1 = NULL, facet2 = NULL, source = "A", pwidth = 650, pheight = 150 )
plotAbundance( aggdat, level, x_var = "SAMPLE_ID", ind = seq_len(10), plotTitle = "", ylab = "Reads", facet1 = NULL, facet2 = NULL, source = "A", pwidth = 650, pheight = 150 )
aggdat |
aggregated MRExperiment object |
level |
Feature level. |
x_var |
Phenotype to aggregate over on X-axis. Default by "SAMPLE_ID". |
ind |
Indices of top abundant features to plot. Rest of features are aggregated and displayed as "other". |
plotTitle |
Plot title. Default shows no title. |
ylab |
Y-axis label. Default is "Reads" |
facet1 |
Phenotype for facet 1. |
facet2 |
Phenotype for facet 2. |
source |
name of the plot (needed for event handling); default is "A" |
pwidth |
overall plot width; default is 650 |
pheight |
overall plot height; default is 150 |
plotly plot
Janina Reeder
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotAbundance(aggdat, level = "genus", x_var = "diet")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotAbundance(aggdat, level = "genus", x_var = "diet")
This function plots the alpha diversity. See ?vegan::diversity for details on the available index
plotAlpha( aggdat, level, index = c("shannon", "simpson", "invsimpson", "richness"), x_var = "SAMPLE_ID", ylab = index, col_by = NULL, facet1 = NULL, facet2 = NULL, plotTitle = "", pwidth = 500, pheight = 150 )
plotAlpha( aggdat, level, index = c("shannon", "simpson", "invsimpson", "richness"), x_var = "SAMPLE_ID", ylab = index, col_by = NULL, facet1 = NULL, facet2 = NULL, plotTitle = "", pwidth = 500, pheight = 150 )
aggdat |
aggregated MRExperiment |
level |
Feature level |
index |
Diversity index, one of "shannon", "simpson", "invsimpson" or "richness" (=number of features). Default is "shannon". |
x_var |
Phenotype to aggregate over on X-axis. Default by "SAMPLE_ID". |
ylab |
Y-axis label. Default is "Reads". |
col_by |
Phenotype for coloring. |
facet1 |
Phenotype for facet 1. |
facet2 |
Phenotype for facet 2. |
plotTitle |
Plot title. By default, no title is used. |
pwidth |
overall plot width; default is 650 |
pheight |
overall plot height; default is 150 |
plotly plot object
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotAlpha(aggdat, level = "genus", index = "shannon", x_var = "diet")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotAlpha(aggdat, level = "genus", index = "shannon", x_var = "diet")
This function plots the average relative abundance of the top abundant features.
plotAvgAbundance( aggdat, level, ind = seq_len(10), plotTitle = "", ylab = "Reads", facet1 = NULL, facet2 = NULL, source = "A", pwidth = 500, pheight = 150 )
plotAvgAbundance( aggdat, level, ind = seq_len(10), plotTitle = "", ylab = "Reads", facet1 = NULL, facet2 = NULL, source = "A", pwidth = 500, pheight = 150 )
aggdat |
aggregated MRExperiment object |
level |
Feature level. |
ind |
Indices of top abundant features to plot. Rest of features are aggregated and displayed as "other". |
plotTitle |
Plot title. Default shows no title. |
ylab |
Y-axis label. Default is "Reads" |
facet1 |
Phenotype for facet 1. |
facet2 |
Phenotype for facet 2. |
source |
name of the plot (needed for event handling); default is "A" |
pwidth |
overall plot width; default is 500 |
pheight |
overall plot height; default is 150 |
plotly plot
Janina Reeder
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotAvgAbundance(aggdat, level = "genus")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotAvgAbundance(aggdat, level = "genus")
This functions plots the beta diversity as a PCoA plot.
plotBeta( aggdat, dim = c(1, 2), log = TRUE, dist_method = "bray", pcas = NULL, nfeatures = nrow(aggdat), col_by = NULL, shape_by = NULL, plotTitle = "", xlab = NULL, ylab = NULL, pt_size = 8, plotText = NULL, confInterval = NULL, allowWebGL = TRUE, pwidth = 550, pheight = 550 )
plotBeta( aggdat, dim = c(1, 2), log = TRUE, dist_method = "bray", pcas = NULL, nfeatures = nrow(aggdat), col_by = NULL, shape_by = NULL, plotTitle = "", xlab = NULL, ylab = NULL, pt_size = 8, plotText = NULL, confInterval = NULL, allowWebGL = TRUE, pwidth = 550, pheight = 550 )
aggdat |
aggregated MRExperiment |
dim |
Vector of length 2 specifying which dimensions to plot. |
log |
Log2 transform data. Default is TRUE. |
dist_method |
Which distance method to use. See ?vegan::vegdist for more
|
pcas |
precalculated pcas to avoid recalculation via CalcPCs |
nfeatures |
Number of top features in terms of standard deviation. Default is all. |
col_by |
Phenotype for coloring. |
shape_by |
Phenotype for shape. |
plotTitle |
Plot title. By default, becomes PCoA (codedist.method). |
xlab |
X-axis label. By default, shows dimension and percent variance explained. |
ylab |
Y-axis label. By default, shows dimension and percent variance explained. |
pt_size |
the size of the markers |
plotText |
adonis text to be added to plot |
confInterval |
numeric value indicating confidence level for ellipses |
allowWebGL |
boolean indicating if WebGL should be used |
pwidth |
overall plot width; default is 550 (125 are added for legend) |
pheight |
overall plot height; default is 550 |
plotly plot object
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotBeta(aggdat)
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotBeta(aggdat)
This function plots a heatmap of feature abundance.
plotHeatmap( aggdat, features = NULL, log = TRUE, sort_by = c("Fano", "MAD", "Variance"), nfeat = 50, col_by = NULL, row_by = NULL, plotTitle = "" )
plotHeatmap( aggdat, features = NULL, log = TRUE, sort_by = c("Fano", "MAD", "Variance"), nfeat = 50, col_by = NULL, row_by = NULL, plotTitle = "" )
aggdat |
aggregated MRExperiment |
features |
Vector of features to plot. If NULL, the top 'nfeat' features in terms of 'sort_by' will be plotted. |
log |
Log2 transform data. Default is TRUE. |
sort_by |
Dispersion measure to sort features, one of "Fano", "MAD", and "Variance" |
nfeat |
Number of features to display. Default is 50. |
col_by |
Vector of phenotypes for coloring. |
row_by |
Name of feature level for coloring. |
plotTitle |
Plot title. By default, no title. |
plotly heatmap
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotHeatmap(aggdat, sort_by = "Fano")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotHeatmap(aggdat, sort_by = "Fano")
This function plots the reads of a particular feature over different time points.
plotLongFeature( aggdat, feature, x_var, id_var = "SAMPLE_ID", plotTitle = NULL, ylab = "Reads", log = FALSE, showLines = TRUE, fixedHeight = NULL, x_levels = NULL, pwidth = 650 )
plotLongFeature( aggdat, feature, x_var, id_var = "SAMPLE_ID", plotTitle = NULL, ylab = "Reads", log = FALSE, showLines = TRUE, fixedHeight = NULL, x_levels = NULL, pwidth = 650 )
aggdat |
aggregated MRExperiment |
feature |
Feature to plot. |
x_var |
Phenotype to show along on X-axis. |
id_var |
phenotype used to connect data points. Default is "SAMPLE_ID" |
plotTitle |
Plot title. Default shows no title. |
ylab |
Y-axis label. Default is "Reads" |
log |
Log2 transform data. Default is FALSE. |
showLines |
add lines between the points |
fixedHeight |
sets a specific plot height (differential analysis) |
x_levels |
restrict to specific levels of x_var (differential analysis) |
pwidth |
overall plot width; default is 650 |
plotly object holding long feature plot
Janina Reeder, Mo Huang
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotLongFeature(aggdat, feature = "Prevotella", x_var = "diet", id_var = "mouseID")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotLongFeature(aggdat, feature = "Prevotella", x_var = "diet", id_var = "mouseID")
Function plotting a plotly histogram on the given histvalue
plotlyHistogram( histvalue, plotTitle, xaxisTitle = "", yaxisTitle = "", pwidth = 200, pheight = 200 )
plotlyHistogram( histvalue, plotTitle, xaxisTitle = "", yaxisTitle = "", pwidth = 200, pheight = 200 )
histvalue |
the value to plot as a histogram |
plotTitle |
title of the plot |
xaxisTitle |
name of xaxis; default is "" |
yaxisTitle |
name of yaxis; default is "" |
pwidth |
overall plot width; default is 200 |
pheight |
overall plot height; default is 200 |
plotly plot object
data("mouseData", package = "metagenomeSeq") plotlyHistogram(histvalue = colSums(MRcounts(mouseData) > 0), plotTitle = "Feature distribution", xaxisTitle = "features", yaxisTitle = "frequency")
data("mouseData", package = "metagenomeSeq") plotlyHistogram(histvalue = colSums(MRcounts(mouseData) > 0), plotTitle = "Feature distribution", xaxisTitle = "features", yaxisTitle = "frequency")
Function plotting a barplot showing number of OTUs per samples
plotlySampleBarplot( MRobj, col_by = NULL, xaxisTitle = "", yaxisTitle = "", pwidth = 600, pheight = 450, sortbyfreq = FALSE, pheno_sort = NULL, x_levels = NULL )
plotlySampleBarplot( MRobj, col_by = NULL, xaxisTitle = "", yaxisTitle = "", pwidth = 600, pheight = 450, sortbyfreq = FALSE, pheno_sort = NULL, x_levels = NULL )
MRobj |
containing data to plot |
col_by |
phenotype to color bars by; default is NULL |
xaxisTitle |
name of xaxis; default is "" |
yaxisTitle |
name of yaxis; default is "" |
pwidth |
overall plot width; default is 600 |
pheight |
overall plot height; default is 450 |
sortbyfreq |
boolean determining if bars should be sorted by frequency; default is FALSE |
pheno_sort |
order of pheno levels to sort by; ignored if sortbyfreq is TRUE |
x_levels |
character vector holding x values in order to be shown |
plotly plot object
data("mouseData", package = "metagenomeSeq") plotlySampleBarplot(mouseData)
data("mouseData", package = "metagenomeSeq") plotlySampleBarplot(mouseData)
This function plots the reads of a particular feature or set of features.
plotSingleFeature( aggdat, feature = "other", x_var = "SAMPLE_ID", ind = seq_len(10), plotTitle = NULL, ylab = "Reads", xlab = NULL, facet1 = NULL, facet2 = NULL, log = FALSE, showPoints = FALSE, fixedHeight = NULL, x_levels = NULL, pwidth = 500 )
plotSingleFeature( aggdat, feature = "other", x_var = "SAMPLE_ID", ind = seq_len(10), plotTitle = NULL, ylab = "Reads", xlab = NULL, facet1 = NULL, facet2 = NULL, log = FALSE, showPoints = FALSE, fixedHeight = NULL, x_levels = NULL, pwidth = 500 )
aggdat |
aggregated MRExperiment |
feature |
Feature to plot. |
x_var |
Phenotype to aggregate over on X-axis. Default by "SAMPLE_ID". |
ind |
Indices of top abundant features to plot. Needed to determine appropriate color |
plotTitle |
Plot title. Default shows no title. |
ylab |
Y-axis label. Default is "Reads" |
xlab |
X-axis label. If NULL, x_var will be used as label. |
facet1 |
Phenotype for facet 1. |
facet2 |
Phenotype for facet 2. |
log |
Log2 transform data. Default is FALSE. |
showPoints |
add points for each sample on plot |
fixedHeight |
sets a specific plot height (differential analysis) |
x_levels |
restrict to specific levels of x_var (differential analysis) |
pwidth |
overall plot width; default is 650 |
plotly plot object
Janina Reeder
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotSingleFeature(aggdat, feature = "Prevotella", x_var = "diet")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") plotSingleFeature(aggdat, feature = "Prevotella", x_var = "diet")
This function reads in an MRexperiment object saved as an RDS file, a Biom file, or a tab - delimited count matrix with features as rows and samples as columns.
readData(filepath, type = "RDS")
readData(filepath, type = "RDS")
filepath |
Relative or absolute file path of data object. |
type |
The type of file to be read; default is "RDS", other options are "RDATA", "BIOM", "TAB", "CSV" |
An MRexperiment object.
Relative abundance plot module - server
relAbundance( input, output, session, aggDat, featLevel, intraSettings, normalizedData, reset )
relAbundance( input, output, session, aggDat, featLevel, intraSettings, normalizedData, reset )
input |
shiny input |
output |
shiny output |
session |
shiny session |
aggDat |
aggregated MRExperiment |
featLevel |
chosen feature level (aggregation level) |
intraSettings |
analysis input settings passed over to this module |
normalizedData |
boolean indicating whether data has been normalized |
reset |
boolean reactive which resets the module if TRUE |
list storing plot clicks and number of features displayed (passed to feature plot module) as well as the R code to make plot
Relative abundance plot module - UI
relAbundanceUI(id)
relAbundanceUI(id)
id |
namespace identifier |
box containing the ui code
Janina Reeder
Helper function to replace any un-annotated features with the term unknown
replaceWithUnknown(featcol)
replaceWithUnknown(featcol)
featcol |
vector of entried to be replaced where needed (fData column) |
modified featcol
Janina Reeder
data("mouseData", package = "metagenomeSeq") featcol <- fData(mouseData)[["genus"]] featcol[featcol == "NA"] <- NA replaceWithUnknown(featcol)
data("mouseData", package = "metagenomeSeq") featcol <- fData(mouseData)[["genus"]] featcol[featcol == "NA"] <- NA replaceWithUnknown(featcol)
Report tab module server
reportList( input, output, session, dataSource, preprocessRep, qcRep, analysisRep, aggIndex, reset )
reportList( input, output, session, dataSource, preprocessRep, qcRep, analysisRep, aggIndex, reset )
input |
module input |
output |
module output |
session |
app session |
dataSource |
R code to obtain data for rendering |
preprocessRep |
R code containing preprocessing steps of data |
qcRep |
R Code to generate QC plots |
analysisRep |
R Code to generate all analyses saved to reports |
aggIndex |
boolean value representing aggregation steps in analysisRep |
reset |
boolean reactive which resets the module if TRUE |
report list server fragment - no return value
Janina Reeder
report tab ui
reportListUI(id)
reportListUI(id)
id |
namespace identifier |
fluidRow holding ui elements
Janina Reeder
reportListUI("reportlist_id")
reportListUI("reportlist_id")
Report Row
reportRow(input, output, session, type, content)
reportRow(input, output, session, type, content)
input |
module input |
output |
module output |
session |
app session |
type |
boolean indicating whether checkbox should be included |
content |
R code to show |
reactive boolean indicating whether row is selected
Janina Reeder
Report row module consisting of a checkbox, image and description/R code area
reportRowUI(id, type)
reportRowUI(id, type)
id |
namespace identifier |
type |
boolean indicating if a selector checkbox should be added |
div holding the UI code
Janina Reeder
Helper function which rolls down annotated from closest higher order with annotation
rollDownFeatures(featrow)
rollDownFeatures(featrow)
featrow |
vector of entries to be replaced where needed (fData row) |
modified featurerow
Janina Reeder
data("mouseData", package = "metagenomeSeq") featrow <- fData(mouseData)[5,] rollDownFeatures(featrow)
data("mouseData", package = "metagenomeSeq") featrow <- fData(mouseData)[5,] rollDownFeatures(featrow)
This function performs differential abundance testing between groups of a specified phenotype. Four methods are available: limma, Kruskal-Wallis, ZILN and DESeq2 (see details).
runDiffTest( aggdat, level, phenotype, phenolevels = NULL, log = TRUE, coef = NULL, method = c("limma", "Kruskal-Wallis", "DESeq2") )
runDiffTest( aggdat, level, phenotype, phenolevels = NULL, log = TRUE, coef = NULL, method = c("limma", "Kruskal-Wallis", "DESeq2") )
aggdat |
aggregated MRExperiment |
level |
Feature level. |
phenotype |
Phenotype to test. |
phenolevels |
levels of the phenotype to restrict the comparison to |
log |
Log2 transform data. Default is TRUE. |
coef |
Numeric which indicates which pairwise comparison to analyze
when there are more than two groups. Corresponds to the column number of the
model matrix produced by |
method |
Differential testing method. One of "limma" (default), "Kruskal-Wallis", or "DESeq2". |
limma is a differential expression tool for microarray data using linear models. It can also be applied to microbiome data.
The Kruskal-Wallis test is a non-parametric rank test which examines if groups come from the same distribution. A significant result indicates at least one group is distributionally different than another group.
ZILN is a zero-inflated log-normal model implemented in
fitFeatureModel()
of the metagenomeSeq
package.
DeSeq2 performs differential gene expression analysis based on the negative binomial distribution
data.frame holding results of the differential analysis
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") runDiffTest(aggdat = aggdat,level = "genus", phenotype = "diet", method = "Kruskal-Wallis")
data("mouseData", package = "metagenomeSeq") aggdat <- aggFeatures(mouseData, level = "genus") runDiffTest(aggdat = aggdat,level = "genus", phenotype = "diet", method = "Kruskal-Wallis")
Main function to start the Microbiome Explorer Shiny app via a command line call
runMicrobiomeExplorer()
runMicrobiomeExplorer()
the shiny application