plotStudy: Invoke a custom plotting function

View source: R/plots.R

plotStudyR Documentation

Invoke a custom plotting function

Description

plotStudy() invokes a custom plotting function saved within an OmicNavigator study. This function is called by the app using the study-model-test selection, feature selections, and plotting function metadata (see addPlots()) to define arguments.

Usage

plotStudy(study, modelID, featureID, plotID, testID = NULL, libraries = NULL)

Arguments

study

An OmicNavigator study. Either an object of class onStudy, or the name of an installed study package.

modelID

Filter by modelID

featureID

Filter by featureID

plotID

Filter by plotID

testID

Filter by testID

libraries

The directories to search for installed study packages. If left as NULL (the default), then installed.packages will use the result of .libPaths.

Details

The arguments study, modelID, featureID, and testID are passed to the function getPlottingData(). The list returned by getPlottingData() is passed as the first argument to a custom plotting function. Some custom plotTypes (see addPlots()) require care when being invoked and attention should be paid to how a custom plot will be rendered by the app. Custom plots with ⁠plotType = c(‘multiModel’, ‘singleTest’)⁠ accept a modelID vector of length n and a vector of testIDs length n, where n is the number of models. Custom plots with ⁠plotType = c(‘multiModel’, ‘multiTest’)⁠ accept modelID and testID vectors of length m, where m is the total number of tests considered across all models (note testIDs are often repeated across models). Note that the index positions of these two vectors should correspond. That is, testID position 1 should be found in the model specified by modelID position 1, etc.

The app will invoke custom plotting functions via plotStudy() using the current menu selections and plot metadata (see addPlots()). Plots with ⁠plotType = ‘multiTest’⁠ will be invoked with all testIDs found within the currently selected model. Plots with ⁠plotType = c(‘multiModel’,‘singleTest’)⁠ will be invoked with all modelIDs within the study (unless the plot has specified a list of models via models) and the currently selected testID (an error will result if the currently selected testID is not present in all relevant models for the plot). Plots with ⁠plotType = c(‘multiModel’, ‘multiTest’)⁠ will be invoked with all modelIDs within the study (unless the plot has specified a list of models via models) and all identical testIDs across models (if there are no matching testIDs across models an error will result).

Value

This function is called for the side effect of creating a plot. It invisibly returns the result from the custom plotting function specified by plotID. Previously it invisibly returned the study object. It's unlikely you relied on this behavior. For a ggplot2 plot, the return value will be the plotting object with class "ggplot". For a plotly plot, the return value will be the json schema used for plotting with class ⁠“json”⁠.

See Also

addPlots, getPlottingData


abbvie-external/OmicNavigator documentation built on April 12, 2025, 12:07 a.m.