epivizrData Usage

Héctor Corrada Bravo

2016-05-15

The epivizrData packages includes methods supporting serving data for visualization applications of data from R/Bioconductor objects. It is primarily used to serve data from interactive R/Bioconductor sessions to the epiviz JS application http://epiviz.github.io. These functions have been extracted from the epivizr Bioconductor package into its own package for easier use and maintenance.

It is designed to receive and send requests through WebSocket connections provided by the epivizrServer package.

Usage

The general pattern to use this package is to create an EpivizDataMgr object using the createMgr function. Once the manager is created, data objects, which provide measurements to a visualization application can be added using the add_measurements method.

library(epivizrData)
## Loading required package: epivizrServer
## Loading required package: Biobase
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, xtabs
## The following objects are masked from 'package:base':
## 
##     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
##     as.data.frame, cbind, colnames, do.call, duplicated, eval,
##     evalq, get, grep, grepl, intersect, is.unsorted, lapply,
##     lengths, mapply, match, mget, order, paste, pmax, pmax.int,
##     pmin, pmin.int, rank, rbind, rownames, sapply, setdiff, sort,
##     table, tapply, union, unique, unsplit
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
library(GenomicRanges)
## Loading required package: S4Vectors
## Loading required package: stats4
## 
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:base':
## 
##     colMeans, colSums, expand.grid, rowMeans, rowSums
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
server <- epivizrServer::createServer(port=7123L)
data_mgr <- epivizrData::createMgr(server)

## add measurements from a GRanges object
gr <- GRanges("chr10", IRanges(start=1:1000, width=100), score=rnorm(1000))
data_mgr$add_measurements(gr, "example_gr", type="bp", columns="score")
## EpivizBpData object example_gr_1 
## GNCList object with 1000 ranges and 1 metadata column:
##          seqnames       ranges strand |              score
##             <Rle>    <IRanges>  <Rle> |          <numeric>
##      [1]    chr10     [1, 100]      * | -0.198055844285377
##      [2]    chr10     [2, 101]      * | -0.324443770736628
##      [3]    chr10     [3, 102]      * | -0.203531073832704
##      [4]    chr10     [4, 103]      * |   1.14608197757056
##      [5]    chr10     [5, 104]      * |  0.906681207430112
##      ...      ...          ...    ... .                ...
##    [996]    chr10 [ 996, 1095]      * | -0.915315128025368
##    [997]    chr10 [ 997, 1096]      * | -0.415917067024602
##    [998]    chr10 [ 998, 1097]      * | -0.140479627540527
##    [999]    chr10 [ 999, 1098]      * |  0.634351221766449
##   [1000]    chr10 [1000, 1099]      * | -0.274400013330176
##   -------
##   seqinfo: 1 sequence from an unspecified genome; no seqlengths
## 
##  columns: score 
##  limits:
##      [,1]
## [1,]   -3
## [2,]    4

See ?epivizrData::register for supported object types and options when adding data. For details on usage within the epiviz visualization app see the epivizr package vignette.