Learn R Programming

OmicNavigator (version 1.19.0)

getPlottingData: Get plotting data from an OmicNavigator study

Description

Returns assays, samples, and features data that may be used for plotting. This function is called by plotStudy() and the output is passed to custom plotting functions. It should be used directly when interactively creating custom plotting functions. Optionally, it can also return data for results, metaFeatures, metaAssays.

Usage

getPlottingData(study, modelID, featureID, testID = NULL, libraries = NULL)

Value

Returns a list of at least 3 elements:

assays

A data frame that contains the assay measurements, filtered to only include the row(s) corresponding to the input featureID(s) (see getAssays). If multiple featureIDs are requested, the rows are reordered to match the order of this input. The column order is unchanged.

samples

A data frame that contains the sample metadata for the given modelID (see getSamples). The rows are reordered to match the columns of the assays data frame.

features

A data frame that contains the feature metadata, filtered to only include the row(s) corresponding to the input featureID(s) (see getFeatures). If multiple featureIDs are requested, the rows are reordered to match the order of this input (and thus match the order of the assays data frame).

If a testID is passed, the data frame results is also returned (by default the app will always pass the currently selected testID):

results

A data frame that contains the test results, filtered to only include the row(s) corresponding to the input featureID(s). If multiple featureIDs are requested, the rows are reordered to match the order of this input. The column order is unchanged. If multiple testIDs are provided, they are stored in a list object.

If the study has metaAssays available that map to the input featureID(s), then metaFeatures and metaAssays are returned:

metaFeatures

A data frame that contains the metaFeature metadata, filtered to only include the row(s) corresponding to the input featureID(s) (see getMetaFeatures). If multiple featureIDs are requested, the rows are reordered to match the order of this input (and thus match the order of the metaAssays data frame).

metaAssays

A data frame that contains the metaAssay measurements, filtered to only include the row(s) corresponding to the input featureID(s) (see getMetaAssays). If multiple featureIDs are requested, the rows are reordered to match the order of this input. The column order is unchanged.

If the study has objects available that map to the input modelID(s), then objects is returned. It is not possible to filter by featureID(s) since the structure of the custom object is unknown (and thus will need to be filtered by the plotting function code).

objects

A custom object that was added to the modelID (addObjects)

If multiple models are passed, then the top-level elements correspond to the names of the modelIDs, and the above elements are each nested within their respective modelID. Furthermore, an additional top-level element mapping is returned:

mapping

A data frame that contains the featureID(s) from each model. This is the filtered mapping object.

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

testID

Filter by testID

libraries

Character vector of library directories to search for study packages. If NULL, uses .libPaths.

Details

The end-user should call this function and populate the first argument of their custom plotting function with the output. When building functions, the end-user should understand the category of plotting function they are creating (e.g. singleFeature or multiFeature, see addPlots()) and call getPlottingData() accordingly.

Custom plots that accept data from multiple models and a single test (plotType = c(‘multiModel’, ‘singleTest’); see addPlots()) should be built to accept output from getPlottingData() where modelID is vector of length n and testID is a vector of length n, where n is the number of models. Custom plots that accept data from multiple models and multiple tests (plotType = c(‘multiModel’, ‘multiTest’)) should be built to accept output from getPlottingData() where modelID and testID vectors are length m, where m is the total number of tests considered across all models (note that testIDs must be repeated across models for the plotting function to work in the app). 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. See addPlots() for information about the assignment of plotTypes for your custom plots.

See Also

addPlots, plotStudy