plotMutualFindings {benchdamic} | R Documentation |
Plot and filter the features which are considered differentially abundant, simultaneously, by a specified number of methods.
plotMutualFindings(enrichment, enrichmentCol, levels_to_plot, n_methods = 1)
enrichment |
enrichment object produced by createEnrichment function. |
enrichmentCol |
name of the column containing information for enrichment analysis. |
levels_to_plot |
A character vector containing the levels of the enrichment variable to plot. |
n_methods |
minimum number of method that mutually find the features. |
a ggplot2
object.
createEnrichment
, plotEnrichment
, and
plotContingency
.
data("ps_plaque_16S") data("microbial_metabolism") # Extract genera from the phyloseq tax_table slot genera <- phyloseq::tax_table(ps_plaque_16S)[, "GENUS"] # Genera as rownames of microbial_metabolism data.frame rownames(microbial_metabolism) <- microbial_metabolism$Genus # Match OTUs to their metabolism priorInfo <- data.frame(genera, "Type" = microbial_metabolism[genera, "Type"] ) # Unmatched genera becomes "Unknown" unknown_metabolism <- is.na(priorInfo$Type) priorInfo[unknown_metabolism, "Type"] <- "Unknown" priorInfo$Type <- factor(priorInfo$Type) # Add a more informative names column priorInfo[, "newNames"] <- paste0(rownames(priorInfo), priorInfo[, "GENUS"]) # DA analysis # Add scaling factors ps_plaque_16S <- norm_edgeR(object = ps_plaque_16S, method = "TMM") ps_plaque_16S <- norm_CSS(object = ps_plaque_16S, method = "median") # Perform DA analysis Plaque_16S_DA <- list() Plaque_16S_DA <- within(Plaque_16S_DA, { # DA analysis da.limma <- DA_limma( object = ps_plaque_16S, design = ~ 1 + HMP_BODY_SUBSITE, coef = 2, norm = "TMM" ) da.limma.css <- DA_limma( object = ps_plaque_16S, design = ~ 1 + HMP_BODY_SUBSITE, coef = 2, norm = "CSSmedian" ) }) enrichment <- createEnrichment( object = Plaque_16S_DA, priorKnowledge = priorInfo, enrichmentCol = "Type", namesCol = "GENUS", slot = "pValMat", colName = "adjP", type = "pvalue", direction = "logFC", threshold_pvalue = 0.1, threshold_logfc = 1, top = 10, verbose = TRUE ) # Contingency tables plotContingency(enrichment = enrichment, method = "limma.TMM") # Barplots plotEnrichment(enrichment, enrichmentCol = "Type") # Mutual findings plotMutualFindings( enrichment = enrichment, enrichmentCol = "Type", n_methods = 1 )