EpivizDeviceMgr-class: 'EpivizDeviceMgr' objects

Description Details Fields Utility methods Navigation methods Measurement management methods Chart management methods Chart types Device management methods Data fetch 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.

Navigation methods

refresh(): NOT SUPPORTED YET

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

slideshow(granges, n=10): 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.

.findMeasurements(msType, ms): Finds the index of objects in msList where measurements ms of type msType are defined. See below to see valid types. Argument ms is a character vector of measurement ids. This method is for internal use only.

.checkMeasurements(msType, ms, sendRequest=TRUE, ...): Checks that measurements in ms, of type msType are valid. If sendRequest==TRUE it also checks measurements are properly added to web app. This method is for internal use only.

.clearChartCaches(msObj, sendRequest=TRUE): Clears chart 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.

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.

setActive(): NOT USED

Chart types

blockChart(ms, ...): Used to display data in GenomicRanges objects as genomic regions using rectangles in a browser track. ms is the id for a measurement provided by an object of class EpivizBlockData-class. The 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 are ids for measurements provided by objects of class EpivizBpData-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 ids for measurements provided by objects of class EpivizFeatureData-class. The plot method for EpivizFeatureData-class calls this method.

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.

rmAllDevice(): 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.

Data fetch methods

.initPack(msType, length=0L): Initialize a EpivizDataPack-class object of given length.

getData(measurements, chr, start, end): Query measurements for overlap with given genomic position. measurements is assumed to be a named list, with each component's name indicating measurement type as stored in msList. Each component in the list is a character vector of measurement ids. This method returns a list of the same length as measurements, each component containing the result of the overlap query in the appropriate format determined by the measurement type. See the various EpivizData-class classes for details on the result format.

Author(s)

Hector Corrada Bravo

See Also

startEpiviz EpivizData-class EpivizDataPack-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-tmp documentation built on May 16, 2019, 8:19 a.m.