A lightweight interactive HTML widget in R for rendering an interactive ideogram diagram displaying shared identity-by-descent (IBD) regions between individuals detected from IBIS or TRUFFLE using Ideogram.js (https://github.com/eweitz/ideogram). The annotation bands on the chromosomes of the created ideogram register click events and display tooltips. This interactive ideogram widget can be embedded in Shiny applications or R-markdown documents (Rmd).
- R (>4.2.1)
- htmlwidgets (>=1.5.4 )
- pals (>=1.7)
- DescTools (>=0.99.45)
To install all the widget's dependencies, type the following in R:
install.packages(c("htmlwidgets", "pals", "DescTools"))
To download the latest release of the Ideogram htmlwidget library click here. To install the ideogram R library, download the tar file (.tar.gz) and run the following command in R using the downloaded ideogram tar file path:
install.packages("ideogram-0.1.0-alpha.tar.gz", type="source", repos=NULL)
The input IBD segment file containing IBD segment to be displayed on the ideogram widget can be either an IBIS IBD segment file (.seg) or a TRUFFLE segments file (.segment).
An example IBIS segment file (default file is usually headerless)
If a header is provided, the header must be specified as follows:
An example Truffle segments file (taken from an example provided on the TRUFFLE website at https://adimitromanolakis.github.io/truffle-website/documentation/doc.html)
To start using the ideogram library in the R environment, type the following in R:
library(ideogram)
After installation of the ideogram library in R, create the htmlwidget in R by calling the ideogram
function with an IBD segment file (.seg/.segment from IBIS/TRUFFLE):
ideogram("ibd_segment.txt")
The ideogram library has two Shiny binding functions:
-
ideogramOutput
- Shiny front-end function (with a widget id) -
renderIdeogram
- Shiny back-end (server) function to render the ideogram
To embed the widget in a Shiny App, use the ideogramOutput
in the Shiny front-end function with a custom ID and invoke the ideogram function in a renderIdeogram
function in the back-end (server), as demonstrated in a basic Shiny app below:
install.packages(shiny) # if not installed
library(shiny)
# render Shiny UI
ui <- fluidPage(
ideogramOutput("ideogram_id")
)
# server logic code
serve <- function(input, output){
output$ideogram_id <- renderIdeogram({
ideogram("ibd_segment_file_path.seg")
})
}
shinyApp(ui, output)
For any questions, feature requests, bug reports or issues regarding the latest version of Ideogram, please click on the "issues" tab present at the top-left of the GitHub repository page.