Title: | R interface to epiviz web components |
---|---|
Description: | This package provides an API for interactive visualization of genomic data using epiviz web components. Objects in R/BioConductor can be used to generate interactive R markdown/notebook documents or can be visualized in the R Studio's default viewer. |
Authors: | Brian Gottfried [aut], Jayaram Kancherla [aut], Hector Corrada Bravo [aut, cre] |
Maintainer: | Hector Corrada Bravo <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.29.0 |
Built: | 2024-11-25 06:21:36 UTC |
Source: | https://github.com/bioc/epivizrChart |
Construct URL for Websocket connection between R and UI
.constructURL(host = "localhost", port = 7123L, path = "")
.constructURL(host = "localhost", port = 7123L, path = "")
host |
host |
port |
port |
path |
path |
url
Initialize Epiviz Chart based on chart type
.initialize_chart(chart_type, ...)
.initialize_chart(chart_type, ...)
chart_type |
Chart type. |
... |
Arguments for |
(taken from epivizr) register epiviz actions
.register_all_the_epiviz_things(srv, app)
.register_all_the_epiviz_things(srv, app)
srv |
epivizrServer object |
app |
EpivizApp object |
(taken from epivizr) print settings in a readable format
.settings_as_df(chart_settings)
.settings_as_df(chart_settings)
chart_settings |
chart settings |
chart settings as data frame
Generic method to add navigation regions
append_region(x, ...) ## S4 method for signature 'EpivizEnvironment' append_region(x, chr, start, end, return_parent = FALSE)
append_region(x, ...) ## S4 method for signature 'EpivizEnvironment' append_region(x, chr, start, end, return_parent = FALSE)
x |
an object of type |
... |
other parameters |
chr |
chromosome id. ex. "chr11" |
start |
genomic region start |
end |
genomic region end |
return_parent |
To return the parent or the new navigation element. Defaults to FALSE |
See vignette data_preprocessing
for code to build this object.
data(bcode_eset)
data(bcode_eset)
An Biobase::ExpressionSet
object
Method to add Blocks Track
BlocksTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' BlocksTrack(x, y, ...)
BlocksTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' BlocksTrack(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Locations of CpG Islands
data(cgi_gr)
data(cgi_gr)
A GenomicRanges::GRanges
object with locations of CpG Islands in hg19
Get default chart settings and colors
chart_default_settings_colors(chart_type)
chart_default_settings_colors(chart_type)
chart_type |
chart type |
list of settings and colors
Data container for an Epiviz Blocks Track.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
EpivizChart
object to visualize in viewer or knit to HTML.Initialize an EpivizChart
object to visualize in viewer or knit to HTML.
epivizChart( data_obj = NULL, measurements = NULL, datasource_name = NULL, parent = NULL, chart = NULL, chr = NULL, start = NULL, end = NULL, settings = NULL, colors = NULL, ... )
epivizChart( data_obj = NULL, measurements = NULL, datasource_name = NULL, parent = NULL, chart = NULL, chr = NULL, start = NULL, end = NULL, settings = NULL, colors = NULL, ... )
data_obj |
A data object that will register to an |
measurements |
An |
datasource_name |
A name for the datasource. For example, "Mean by Sample Type". |
parent |
An object of class |
chart |
The chart type to be visualized: "BlocksTrack", HeatmapPlot", "LinePlot", "LineTrack", "ScatterPlot", "StackedLinePlot", "StackedLineTrack". |
chr |
The chromosome to filter on, e.g., chr="chr11". |
start |
The start location, e.g., start=110800000. |
end |
The end location, e.g., end=130383180. |
settings |
List of settings, e.g., list(title="Blocks Chart"). |
colors |
List of colors. When chart is rendered to html this will be converted to a string encoded as JSON |
... |
Additional arguments passed to |
An object of class EpivizChart
.
data(tcga_colon_blocks) start <- 99800000 end <- 103383180 blocks_track <- epivizChart(tcga_colon_blocks, chr="chr11", start=start, end=end) # See package vignette for more examples.
data(tcga_colon_blocks) start <- 99800000 end <- 103383180 blocks_track <- epivizChart(tcga_colon_blocks, chr="chr11", start=start, end=end) # See package vignette for more examples.
Data container for an Epiviz chart component.
data
(list) Values of an epiviz chart's data attribute.
colors
(character) Epiviz chart's colors attribute.
settings
(list) Epiviz chart's settings attribute.
parent
An object of class EpivizEnvironment
where chart is appended.
get_attributes()
Get attributes for rendering chart
get_available_settings()
Get available settings
get_colors()
Get chart colors
get_data()
Get chart data
get_parent()
Get parent
get_settings()
Get chart settings
navigate(chr, start, end)
Navigate chart to a genomic location
Chromosome
Start location
End location
render_component(shiny = FALSE)
Render to html
revisualize(chart_type)
Revisualize chart as the given chart type
The type of chart to be visualized (BlocksTrack, HeatmapPlot, LinePlot, LineTrack, ScatterPlot, StackedLinePlot, StackedLineTrack)
set_colors(colors)
Set chart colors
set_data(data)
Set chart data
set_settings(settings)
Modify current settings
List of new settings. Call get_available_settings for settings available to modify.
Class providing data manager for epiviz charts.
.ms_list
(environment) List of measurment records
.ms_idCounter
(integer) Counter for ID generator
add_genome(genome)
Add genome to data manager (for seqInfo)
Chromosome
Start location
End location
add_measurements(
obj,
datasource_name = NULL,
datasource_obj_name = deparse(substitute(obj)),
...
)
Register measurements in data manager
get_data(measurements, chr = NULL, start = NULL, end = NULL)
Get data from data mgr based on measurements, chr, start, and end
List of EpivizMeasurements
Chromosome
Start location
End location
register_shiny_handler(session)
Handlers to enable interactions with Shiny session.
Shiny session object
rm_all_measurements()
Remove all registered measurements
rm_measurements(ms_obj_or_id)
Remove registered measurements from a given data object
Data container for an Epiviz Data Source component.
provider_type
(character)
provider_id
(character)
provider_url
(character)
get_attributes()
Get attributes for rendering web component
get_component_type()
Get component type for prefix of random id generator
get_name()
Get name of Epiviz Web Component
get_provider_id()
Get provider id
get_provider_type()
Get provider type
get_provider_url()
Get provider url
render_component(shiny = FALSE)
Render to html
set_provder_url(url)
Set provider url
set_provider_id(id)
Set provider id
set_provider_type(type)
Set provider type
EpivizEnvironment
object.Initialize an EpivizEnvironment
object.
epivizEnv(chr = NULL, start = NULL, end = NULL, interactive = FALSE, ...)
epivizEnv(chr = NULL, start = NULL, end = NULL, interactive = FALSE, ...)
chr |
The chromosome to filter on, e.g., |
start |
The start location, e.g., |
end |
The end location, e.g., |
interactive |
(logical) enable if running a websocket/shiny server |
... |
Additional params to pass to |
An object of class EpivizEnvironment
epiviz <- epivizEnv(chr="chr11", start=99800000, end=103383180)
epiviz <- epivizEnv(chr="chr11", start=99800000, end=103383180)
Data container for an Epiviz environment component.
charts
List of class EpivizViewComponent
used to track nested elements.
interactive
Logical value of whether componenet is interactive with data source componenet..
epiviz_ds
EpivizDataSource
object for interactive documents.
add_data(...)
Add data to environment's data manager
Arguments for add_measurements and register, e.g., data, datasource_name, datasource_obj_name, type, etc
add_genome(genome, type = "gene_info", datasource_name = NULL)
Add a genome to the view, and a genes-track.
annotation object. eg. Homo.sapiens
append_chart(chart)
Append chart or navigation to environment
append_region(chr = NULL, start = NULL, end = NULL, ...)
Add a child Navigation element to the given genomic region
get_charts()
Get charts within environment
get_component_type()
Get component type for prefix of random id generator
get_measurements()
Get measurements
get_name()
Get name of Epiviz Web Component
get_rows(...)
Get row data from environment's data manager
get_values(...)
Get value data from environment's data manager
init_region(chr = NULL, start = NULL, end = NULL)
Initialize navigation based on a genomic region
Chromosome
Start location
End location
init_regions(regions)
Initialize navigations based on genomic regions
List of named lists of genomic locations, e.g., list(list(chr='chr11', start=99800000, end=103383180))
is_interactive()
Return whether the environment is interactive with a data source
navigate(chr = NULL, start = NULL, end = NULL)
Navigate environment to genomic location
Chromosome
Start location
End location
order_charts(ordered_charts)
Order the charts within an environment
An ordered list of EpivizViewComponent objects
plot(...)
Plot an EpivizChart within the environment
Arguments for epivizChart
register_shiny_handler(session)
Enable components to interact with Shiny session.
Shiny session object
remove_all_charts()
Remove all charts from environment
remove_chart(chart)
Remove chart from environment
render_component(shiny = FALSE)
Render to html
if rendering component in a shiny environment
set_charts(charts)
Set charts of environment
Data container for an Epiviz Genes Track.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Heatmap Plot.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Genes Track.
get_attributes()
Get attributes for rendering component
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Line Plot.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Line Track.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Scatter Plot.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Blocks Track.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Stacked Line Plot.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz Stacked Line Track.
get_component_type()
Get component type for prefix of random id generator
get_default_colors()
Get default colors
get_default_settings()
Get default settings
get_name()
Get name of Epiviz Web Component
Data container for an Epiviz web component.
chr
(CharacterOrNULL) Chromosome location.
start
(NumericOrNULL) Start location.
end
(NumericOrNULL) End location.
measurements
(ListOrNULL) list of measurements of class EpivizMeasurement
.
get_attributes()
Get attributes for rendering web component
get_chr()
Get chromosome
get_end()
Get end
get_measurements()
Get measurements
get_start()
Get start
set_chr(chr)
Set the chromosome
set_end(end)
Set end
set_measurements(ms)
Set measurements
set_start(start)
Set start
Data container for an Epiviz Web component.
data_mgr
name
(character) Epiviz chart type (tag name).
class
(CharacterOrNULL) Epiviz chart's class attribute.
id
(character) Epiviz chart's id attribute.
get_attributes()
Get attributes for rendering web component
get_class()
Get class
get_data_mgr()
Get data manager
get_id()
Get id
get_name()
Get name of Epiviz Web Component
set_class(class)
Set chart class
set_id(id)
Set chart id
set_name(name)
Set name
Construct URL for Websocket connection between R and UI
get_available_chart_types()
get_available_chart_types()
url
Construct URL for Websocket connection between R and UI
get_registered_data_types()
get_registered_data_types()
url
Method to add Heatmap Plot
HeatmapPlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' HeatmapPlot(x, y, ...)
HeatmapPlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' HeatmapPlot(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Currently this just renames fromJSON
in the rjson
package.
json_parser( json_str, file, method = "C", unexpected.escape = "error", simplify = TRUE )
json_parser( json_str, file, method = "C", unexpected.escape = "error", simplify = TRUE )
json_str |
json string to parse |
file |
file to read json_Str from |
method |
method used to parse json |
unexpected.escape |
handling escape characters, one of error, skip, keep |
simplify |
if TRUE, convert json-encoded lists to vectors |
a JSON object
json_parser('{"a":true, "b":false, "c":null}')
json_parser('{"a":true, "b":false, "c":null}')
Currently this just renames toJSON
in the rjson
package.
json_writer(x, indent = 0, method = "C")
json_writer(x, indent = 0, method = "C")
x |
object to write to json |
indent |
integer specifying how much indentation to use when formatting the JSON object; if 0, no pretty-formatting is used |
method |
method used to write json |
a string with JSON encoding of object
json_writer(1:10)
json_writer(1:10)
Method to add Line Plot
LinePlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' LinePlot(x, y, ...)
LinePlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' LinePlot(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Method to add Line Track
LineTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' LineTrack(x, y, ...)
LineTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' LineTrack(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Generic methods to plot charts and add navigation regions
## S4 method for signature 'EpivizEnvironment,ANY' plot(x, y, ...)
## S4 method for signature 'EpivizEnvironment,ANY' plot(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
## Not run: library(epivizrChart) library(Homo.sapiens) require(magrittr) # example data set data(sumexp) # create an environment element epivizEnv <- epivizEnv() # chain and add navigation regions and plots. epivizEnv %>% plot(sumexp, datasource_name="sumExp", columns=c("cancer", "normal")) %>% append_region(chr="chr11", start=118000000, end=121000000) %>% plot(sumexp, datasource_name="sumExp", columns=c("normal", "cancer")) epivizEnv ## End(Not run)
## Not run: library(epivizrChart) library(Homo.sapiens) require(magrittr) # example data set data(sumexp) # create an environment element epivizEnv <- epivizEnv() # chain and add navigation regions and plots. epivizEnv %>% plot(sumexp, datasource_name="sumExp", columns=c("cancer", "normal")) %>% append_region(chr="chr11", start=118000000, end=121000000) %>% plot(sumexp, datasource_name="sumExp", columns=c("normal", "cancer")) epivizEnv ## End(Not run)
Random ID generator for epiviz charts
rand_id(prefix = "")
rand_id(prefix = "")
prefix |
prefix for random ID |
random ID
Method to add Scatter Plot
ScatterPlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' ScatterPlot(x, y, ...)
ScatterPlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' ScatterPlot(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Method to add Stacked Blocks Track
StackedBlocksTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' StackedBlocksTrack(x, y, ...)
StackedBlocksTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' StackedBlocksTrack(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Method to add Stacked Line Plot
StackedLinePlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' StackedLinePlot(x, y, ...)
StackedLinePlot(x, y, ...) ## S4 method for signature 'EpivizEnvironment' StackedLinePlot(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Method to add Stacked Line Track
StackedLineTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' StackedLineTrack(x, y, ...)
StackedLineTrack(x, y, ...) ## S4 method for signature 'EpivizEnvironment' StackedLineTrack(x, y, ...)
x |
an object of type |
y |
a genomic data object |
... |
other parameters for the plot method |
Example SummarizedExperiment for epivizr vignette
data(sumexp)
data(sumexp)
A SummarizedExperiment::RangedSummarizedExperiment
object.
Example results from methylation analysis of human chromosome 11 using the minfi
package
of TCGA 450k beadarray samples. This object contains large regions of methylation difference between tumor
and normal samples obtained from minfi::blockFinder()
.
data(tcga_colon_blocks)
data(tcga_colon_blocks)
A GenomicRanges::GRanges
object with 129 and mcols
:
value
average smooth methylation difference within block
area
block area estimate (abs(value) * length)
cluster
id of cluster blockgroup within which block occurs
indexStart
index of first cluster in block
indexEnd
index of last cluster in block
L
number of clusters in block
clusterL
number of probes in block
p.value
permutation p.value based on difference conditioned on length
fwer
family-wise error rate estimate based on difference conditioned on length
p.valueArea
permutation p.value based on area
fwerArea
family-wise error rate estimate based on area
TCGA project: https://tcga-data.nci.nih.gov/tcga/
Example results from methylation analysis of human chromosome 11 using the minfi
package
of TCGA 450k beadarray samples. This object contains probe cluster level methylation estimates from
minfi::blockFinder()
.
data(tcga_colon_curves)
data(tcga_colon_curves)
A GenomicRanges::GRanges
object with 7135 ranges and mcols
:
id
probe cluster id
type
probe cluster type
blockgroup
probe cluster block group
diff
raw methylation percentage difference between normal and tumor
smooth
smooth methylation percentage difference between normal and tumor
normalMean
mean methylation estimate for normal samples
cancerMean
mean methylation estimate for cancer samples
TCGA project: https://tcga-data.nci.nih.gov/tcga/
A SummarizedExperiment::RangedSummarizedExperiment
object containing exon-level
counts from RNAseq data for colon tumor and normal tissue from the TCGA project.
Only exons in human chromosome 11 are included.
data(tcga_colon_expression)
data(tcga_colon_expression)
A SummarizedExperiment::RangedSummarizedExperiment
object with 12,800 rows (exons) and 40 samples.
assay(tcga_colon_expression)
exon-level count matrix
colData(tcga_colon_expression)
a DataFrame
containing sample information.
Normal/Tumor status is given in column sample_type
TCGA project: https://tcga-data.nci.nih.gov/tcga/