In this vignette, we will build a shiny app to visualize RangeSummarizedExperiment
using epivizrChart. Since epiviz visualization library is built upon the web components framework, it can be integrated with most frameworks that support HTML.
library(epivizrChart) library(shiny) library(Homo.sapiens)
Sample data sets to use for the vignette.
data(sumexp)
We create an Environment element which visualizes genome wide data. We then visualize cancer
and normal
values from the SummarizedExperiment
object.
epivizEnv <- epivizEnv(interactive = TRUE) scatterplot <- epivizEnv$plot(sumexp, datasource_name="sumExp", columns=c("cancer", "normal"))
After looking at the genomic wide data, if you are interested in further exploring a specific region of the genome, We can create a navigation element linked to that genomic location. We can plot additional annotation/data charts/tracks in this region.
epivizNav <- epivizNav(chr="chr11", start=118000000, end=121000000, parent=epivizEnv, interactive = TRUE) genes_track <- epivizNav$add_genome(Homo.sapiens, datasource_name="genes") # region_scatterplot <- epivizNav$plot(sumexp, datasource_name="sumExp", columns=c( "cancer", "normal")) region_linetrack <- epivizNav$plot(sumexp, datasource_name="sumExp", columns=c( "cancer", "normal"), chart="LineTrack")
Finally, we can embed these components in a Shiny App.
app <- shinyApp( ui=fluidPage( uiOutput("epivizChart") ), server=function(input, output, session) { output$epivizChart <- renderUI({ epivizEnv$render_component(shiny=TRUE) }) epivizEnv$register_shiny_handler(session) } ) app
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.