R/plots-interactive.R
iplot.RdIt is informative to look at the individual log fold changes of the genes within a gene set to explore the degree to which they (1) are coherent with respect to each other; and (2) see how the compare to the background distribution of log fold changes of the entire transcriptome.
You can visualize this behavior via a type = "density" plot, or a
type = "boxplot". It is also common to plot either the individual log fold changes value = "logFC"or t-statisticsvalue = "t"`.
iplot(
x,
name,
value = "logFC",
type = c("density", "gsea", "boxplot"),
tools = c("wheel_zoom", "box_select", "reset", "save"),
main = NULL,
with.legend = TRUE,
collection = NULL,
result_name = NULL,
stats.report = c("NES", "logFC", "pval", "padj", "n"),
shiny_source = "mggenes",
width = NULL,
height = NULL,
ggtheme = ggplot2::theme_bw(),
trim = 0.005,
interactive = TRUE,
...
)A SparrowResult() object
the name of the geneset to plot
A string indicating the column name for the value of the
gene-level metadata to plot. Default is "logFC". Anoter often used choice
might also be "t", to plot t-statistics (if they're in the result). But
this can be any numeric column found in the data.frame returned by
geneSet(x, y, j). If this is a named string (vector), then the value in
names(value) will be used on the axis when plotted.
plot the distributions as a "density" plot or "boxplot".
the tools to display in the rbokeh plot
A title to display. If not specified, the gene set name
will be used, otherwise you can pass in a custom title, or NULL
will disable the title altogether.
Draws a legend to map point color to meaning. There are three levels a point (gene level statistic) can be color as, "notsig", "psig", and "sig". "notsig" implies that the FDR >= 10%, "psig" means that FDR <= 10%, but the logFC is "unremarkable" (< 1), and "sig" means that both the FDR <= 10% and the logFC >= 1
If you have genesets with duplicate names in x
(only possible with a GeneSetDb object), provide the name of the
collection here to disambiguate (default: NULL).
if not NULL (the default), it fetches statistics for the
given GSEA result using result(x, name = result_name, ...) which can then
be used for plotting.
the name of this element that is used in shiny callbacks.
Defaults to "mggenes".
the width and height of the output plotly plot
a ggplot theme, like the thing returned from
ggplot2::theme_bw(), for instance.
used to define the upper and lower quantiles to max out the individual gene statistics in the selected geneset.
pass through parameters to internal boxplot/density/gsea plotting functions
the ploty plot object
mgr <- exampleSparrowResult()
upreg <- "SOTIRIOU_BREAST_CANCER_GRADE_1_VS_3_UP"
dnreg <- "TURASHVILI_BREAST_LOBULAR_CARCINOMA_VS_DUCTAL_NORMAL_DN"
iplot(mgr, upreg, value = c("t-statistic" = "t"), type = "density")
iplot(mgr, upreg, value = c("t-statistic" = "t"), type = "density", .plot_static = TRUE)
#> Error in iplot.density.plotly(x, dat, value, main, with.legend = with.legend, tools = tools, shiny_source = shiny_source, ggtheme = ggtheme, trim = trim, result_name = result_name, gstats = gstats, .plot_static = !interactive, ...): formal argument ".plot_static" matched by multiple actual arguments
iplot(mgr, upreg, value = c("log2FC" = "logFC"), type = "boxplot")
iplot(mgr, upreg, value = c("t-statistic" = "t"), type = "gsea")
#> Loading required namespace: testthat
#> Loading required namespace: fgsea
iplot(mgr, dnreg, value = c("t-statistic" = "t"), type = "gsea")