EpivizDeviceMgr-class: 'EpivizDeviceMgr' objects

Description Details Fields Utility methods Seqinfo methods Navigation methods Measurement management methods Data fetch methods Chart management methods Chart types Device management methods Author(s) See Also Examples

Description

This class manages interactive visualization connections to the epiviz web app. It provides a mechanism to add measurements (from objects in the R/bioc workspace), charts (plots and tracks in the web app) or devices (a one-step combination of measurements and charts). It also provides navigation and other interactive functions. Setters and getters are defined for the pertinent fields, which should not be accessed directly. Objects of this class are usually created using the startEpiviz function.

Details

The most important aspect of interactive connections to the epiviz web app is the ability to add tracks and plots displaying data from an R/bioc session. This class is designed so that data and display are distinct, the former represented by measurements encapsulated in EpivizData-class objects, the latter by charts encapsulated by EpivizChart-class objects.

For a user to visualize data stored in an object that can be referenced by genomic location, e.g., a GRanges or SummarizedExperiment objects, they must first indicate to the session manager which measurements are provided by this object using the addMeasurements method. This creates an object derived from class EpivizData-class (using register-methods) which wraps the data object so that efficient overlap queries are performed (using GIntervalTree objects) and adds the set of measurements provided to the web app. This allows users to create charts displaying data from this object either by using the addChart method or the web app UI itself. See section 'Measurement management methods' below for more information.

Once measurements have been declared, users can use the addChart method to visualize them in one or more different plot types (see section 'Chart types' below). Objects from classes derived from EpivizData-class have plot methods that use reasonable default chart types. See section 'Chart management methods' below for more information.

We also provide a 'device' interface to simplify the steps above. Users can call the addDevice method, passing a data object to be visualized and a chart is added with the default visualization for the object. The same mechanism above is used, so both a EpivizData-class and EpivizChart-class objects are added to the session manager. See section 'Device management methods' below for more information.

Fields

url:

The url used to connect to the epiviz web app

msList:

List of added measurements (objects of classes that inherit from EpivizData-class)

typeMap:

List of currently available measurements types

msIdCounter:

Used internally to manage msList

chartList:

List of currently added charts (objects of class EpivizChart-class)

chartIdCounter:

Used internally to manage chartList

activeId:

Id of currently active chart (not used)

chartIdMap:

Character vector of chart ids assigned by the web app. Vector names are chart ids set by the session manager

deviceList:

List of currently added devices (objects of class EpivizDevice-class)

deviceIdCounts:

Used internally to manage deviceList

server:

Object of class EpivizServer-class encapsulating the websocket connection to app

verbose:

Log to console on requests received

nonInteractive:

Run in non-interactive mode, for internal development use only

callbackArray:

Object of class IndexedArray-class containing request callback functions

Utility methods

bindToServer(): Call the bindManager function of the server object passing this object as argument.

isClosed(): Returns TRUE if connection to app is closed.

openBrowser(url=NULL): Open browser for epiviz web app, if argument url is NULL (the default), the url field is used.

service(): Service requests from app (this call blocks the R/interactive session until loop is escaped)

stopService(): Stop the service loop

startServer(): Start the websocket connection server

stopServer(): Stops the websocket connection server. Also removes all currently added devices, charts and measurements from web app.

Seqinfo methods

addSeqinfo(x): Add sequence space (e.g., chromosome) informationto the web app. x should be a Seqinfo-class object, or a named integer (or numeric) vector.

rmSeqinfo(seqnames): Remove sequence spaces (e.g., chromosome) information from the web app. seqnames should be a character vector containing chromosome names.

Navigation methods

refresh(): NOT SUPPORTED YET

navigate(chr, start, end): Navigate in web app to give genomic region

slideshow(granges, n=length(granges)): Navigate in web app to the first n regions in GenomicRanges-class object granges in succession.

Measurement management methods

addMeasurements(obj, msName, sendRequest=TRUE, ...): Add measurements in obj, calls the register-methods on obj passing extra arguments in .... Measurements are given names derived from msName. Measurements are added to the web app itself if sendRequest==TRUE (the default). This method adds a measuremnt object of class EpivizData-class, returned by the register-methods to the msList field. Measurement ids are generated automatically using msIdCounter and are returned by this method.

.clearDatasourceGroupCache(msObj, sendRequest=!nonInteractive): Clears data caches in web app using any of the measurements defined by msObj of class (EpivizData-class). Only affects web app if sendRequest==TRUE. This method is for internal use only.

updateMeasurements(oldObject, newObject, sendRequest=TRUE): Update the data object wrapped in EpivizData-class object oldObject to newObject. The class of newObject depends on the type of data, but is checked for correctness, i.e., the the classes of the new and current data objects are the same. Argument oldObject can be a EpivizData-class object already added to the session, or a character containing the id of an object. Ids are returned by the addMeasurements method.

.getMsObject(msObjId): Get the EpivizData-class object corresponding the the id msObjId. This method is for internal use only.

rmMeasurements(msObj): Remove measurements stored in EpivizData-class object msObj. The msObj argument can be an EpivizData-class object added to the session manager, or the id of such an object.

rmAllMeasurements(): Remove all measurements added to the session manager.

listMeasurements(): List measurements added to the session manager.

getMeasurements(): Returns list of currently added measurements in format required by web app. This method is for internal use only.

getMeasurementType(x): Returns type of measurement object x of class EpivizData-class.

Data fetch methods

getRows(chr, start, end, metadata, datasource): Get genomic location and metadata for rows in given datasource that overlap the region defined by chr, start and end.

getValues(chr, start, end, datasource, measurement): Get data values for column measurement for rows in datasource that overlap the region defined by chr, start and end.

Chart management methods

addChart(chartObject, sendRequest=TRUE, ...): Adds chart specified by chartObject of class EpivizChart-class to the session manager. The chart is added to the web app if sendRequest==TRUE (the default). The chartObject is inserted to the chartList field. Chart ids are generated automatically using chartIdCounter and are returned by this method.

.getChartObject(chartId): Returns the EpivizChart-class object corresponding to id chartId.

rmChart(chartObj): Remove chart corresponding to chartObj. Argument chartObj can be an object of class EpivizChart-class or the character id of such an object.

rmAllCharts(): Remove all charts currently in the session manager.

listCharts(): List all charts currently added to session manager.

Chart types

blockChart(ms, ...): Used to display data in GenomicRanges objects as genomic regions using rectangles in a browser track. ms is a list of lists, each component describing a measurement provided by an object of class EpivizBlockData-class. They can be obtained using the getMeasurements method in the EpivizBlockData-class. plot method for EpivizBlockData-class calls this method.

lineChart(ms, ...): Used to display continuous data at base-pair level as a line plot in a browser track. ms is a list of lists, each component describing a measurement provided by objects of class EpivizBpData-class. They can be obtained using the getMeasurements method in the EpivizBlockData-class. The plot method for EpivizBpData-class calls this method.

scatterChart(x, y, ...): Used to display genomic feature data in SummarizedExperiment objects as a scatter plot. x and y are lists for measurements provided by objects of class EpivizFeatureData-class. They can be obtained using the getMeasurements method in the EpivizFeatureData-class. The plot method for EpivizFeatureData-class calls this method.

heatmapChart(ms, ...): Used to display genomic feature data in SummarizedExperiment objects as a heatmap. ms is a list of lists, each component describing a measurement provided by an object of class EpivizFeatureData-class. They can be obtained using the getMeasurements method in the EpivizFeatureData-class.

genesChart(ms, ...): Used to display a gene annotation track. ms is a list containing a single entry: a list describing data provided by an object of class EpivizGeneInfoData-class. This list can be obtained using the getMeasurements method in the EpivizGeneInfoData-class.

Device management methods

addDevice(obj, devName, sendRequest=TRUE, ...): Adds device for object obj. This method calls the addMeasurements method on obj and calls the plot method of the resulting EpivizData-class object. Measurements and charts added by this called are given names derived from devName. Arguemnts to addMeasurement and the plot-methods call can be given in .... Device ids are generated automatically using devIdCounter and are returned by this function. An object of class EpivizDevice-class is created and inserted into devList.

rmDevice(devObj): Remove the device corresponding to devObj: an object of class EpivizDevice-class or the id for such an object. This removes the corresponding chart and measurement objects from the session manager.

rmAllDevices(): Remove all devices added to the session manager.

updateDevice(oldObject, newObject, sendRequest=TRUE, ...): Update the data object wrapped in EpivizDevice-class object oldObject to newObject. The class of newObject depends on the type of data, but is checked for correctness, i.e., the the classes of the new and current data objects are the same. Argument oldObject can be a EpivizDevice-class object already added to the session, or a character containing the id of an object. Ids are returned by the addDevice method.

listDevices(): List all devices added to the session manager.

Author(s)

Hector Corrada Bravo

See Also

startEpiviz EpivizData-class EpivizChart-class EpivizDevice-class GenomicRanges-class EpivizServer-class register-methods IndexedArray-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Not run: 
  require(epivizrData)
  data(tcga_colon_example)
  
  mgr <- startEpiviz(openBrowser=interactive())
  
  # using the device interface
  blockDev <- mgr$addDevice(colon_blocks, "blocks_test", type="block")
  
  # using the measurement/chart interface
  # add measurements
  blockMs <- mgr$addMeasurements(colon_blocks, "blocks_test2", type="block")
  
  # add chart
  blockChart <- mgr$blockChart(blockMs$getMeasurements()[1])
  
  # using plot methods
  blockChart2 <- blockMs$plot()
  
  # list devices
  mgr$listDevices()
  
  # list measurements
  mgr$listMeasurements()
  
  # list charts
  mgr$listCharts()
  
  # remove a chart
  mgr$rmChart(blockChart2)
  
  # navigate to genomic region
  mgr$navigate("chr2", 10000000, 30000000)
  mgr$stopServer()

## End(Not run)

epiviz/epivizr-release documentation built on May 16, 2019, 8:18 a.m.