FeatureAssayPlot-class | R Documentation |
The FeatureAssayPlot is a panel class for creating a ColumnDotPlot where the y-axis represents the expression of a feature of interest, using the assay
values of the SummarizedExperiment.
It provides slots and methods to specify the feature and what to plot on the x-axis, as well as a method to actually create a data.frame containing those pieces of data in preparation for plotting.
The following slots control the values on the y-axis:
YAxisFeatureName
, a string specifying the name of the feature to plot on the y-axis.
If NA
, defaults to the first row name of the SummarizedExperiment object.
Assay
, string specifying the name of the assay to use for obtaining expression values.
Defaults to "logcounts"
in getPanelDefault
, falling back to the name of the first valid assay
(see ?".cacheCommonInfo,DotPlot-method"
for the definition of validity).
YAxisFeatureSource
, string specifying the encoded name of the transmitting panel to obtain a single selection that replaces YAxisFeatureName
.
Defaults to "---"
, i.e., no transmission is performed.
YAxisFeatureDynamicSource
, a logical scalar indicating whether x
should dynamically change its selection source for the y-axis.
Defaults to FALSE
in getPanelDefault
.
The following slots control the values on the x-axis:
XAxis
, string specifying what should be plotting on the x-axis.
This can be any one of "None"
, "Feature name"
, "Column data"
or "Column selection"
.
Defaults to "None"
.
XAxisColumnData
, string specifying which column of the colData
should be shown on the x-axis,
if XAxis="Column data"
.
Defaults to the first valid colData
field (see ?".refineParameters,ColumnDotPlot-method"
for details).
XAaxisFeatureName
, string specifying the name of the feature to plot on the x-axis,
if XAxis="Feature name"
.
Defaults to the first row name.
XAxisFeatureSource
, string specifying the encoded name of the transmitting panel to obtain a single selection that replaces XAxisFeatureName
.
Defaults to "---"
, i.e., no transmission is performed.
XAxisFeatureDynamicSource
, a logical scalar indicating whether x
should dynamically change its selection source for the x-axis.
Defaults to FALSE
in getPanelDefault
.
In addition, this class inherits all slots from its parent ColumnDotPlot, DotPlot and Panel classes.
FeatureAssayPlot(...)
creates an instance of a FeatureAssayPlot class, where any slot and its value can be passed to ...
as a named argument.
In the following code snippets, x
is an instance of a FeatureAssayPlot class.
Refer to the documentation for each method for more details on the remaining arguments.
For setting up data values:
.refineParameters(x, se)
replaces any NA
values in XAxisFeatureName
and YAxisFeatureName
with the first row name; any NA
value in Assay
with the first valid assay name; and any NA
value in XAxisColumnData
with the first valid column metadata field.
This will also call the equivalent ColumnDotPlot method for further refinements to x
.
If no rows or assays are present, NULL
is returned instead.
For defining the interface:
.defineDataInterface(x, se, select_info)
returns a list of interface elements for manipulating all slots described above.
.panelColor(x)
will return the specified default color for this panel class.
For monitoring reactive expressions:
.createObservers(x, se, input, session, pObjects, rObjects)
sets up observers for all slots described above and in the parent classes.
This will also call the equivalent ColumnDotPlot method.
For defining the panel name:
.fullName(x)
will return "Feature assay plot"
.
For creating the plot:
.generateDotPlotData(x, envir)
will create a data.frame of feature expression values in envir
.
It will return the commands required to do so as well as a list of labels.
For managing selections:
.singleSelectionSlots(x)
will return a list specifying the slots that can be updated by single selections in transmitter panels,
mostly related to the choice of feature on the x- and y-axes.
This includes the output of the method for the parent ColumnDotPlot class.
.multiSelectionInvalidated(x)
returns TRUE
if the x-axis uses multiple column selections,
such that the point coordinates may change upon updates to upstream selections in transmitting panels.
Otherwise, it dispatches to the ColumnDotPlot method.
For documentation:
.definePanelTour(x)
returns an data.frame containing a panel-specific tour.
Aaron Lun
ColumnDotPlot, for the immediate parent class.
#################
# For end-users #
#################
x <- FeatureAssayPlot()
x[["XAxis"]]
x[["Assay"]] <- "logcounts"
x[["XAxisColumnData"]] <- "stuff"
##################
# For developers #
##################
library(scater)
sce <- mockSCE()
sce <- logNormCounts(sce)
old_assay_names <- assayNames(sce)
assayNames(sce) <- character(length(old_assay_names))
# Spits out a NULL and a warning if no assays are named.
sce0 <- .cacheCommonInfo(x, sce)
.refineParameters(x, sce0)
# Replaces the default with something sensible.
assayNames(sce) <- old_assay_names
sce0 <- .cacheCommonInfo(x, sce)
.refineParameters(x, sce0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.