example3_shiny.Rmd
Here is an example of ideogRam in Shiny.
library(shiny)
library(ideogRam)
server <- function(input, output) {
output$ideo_01 <- renderIdeogRam({
chromosome <- input$chromosome
organism <- input$organism
orientation <- input$orientation
if (orientation == "default") {
orientation <- NULL
}
barWidth <- as.numeric(input$barWidth)
chrHeight <- as.numeric(input$chrHeight)
chrMargin <- as.numeric(input$chrMargin)
chrWidth <- as.numeric(input$chrWidth)
ploidy <- input$ploidy
rows <- input$rows
sex <- input$sex
rotatable <- as.logical(input$rotatable)
showBandLabels <- as.logical(input$showBandLabels)
showChromosomeLabels <- as.logical(input$showChromosomeLabels)
showAnnotTooltip <- as.logical(input$showAnnotTooltip)
showFullyBanded <- as.logical(input$showFullyBanded)
showNonNuclearChromosomes <- as.logical(input$showNonNuclearChromosomes)
ideogRam(
organism = organism, chromosome = chromosome, orientation = orientation,
barWidth = barWidth, chrHeight = chrHeight, chrMargin = chrMargin, chrWidth = chrWidth,
ploidy = ploidy, rows = rows, sex = sex,
rotatable = rotatable,
showBandLabels = showBandLabels,
showChromosomeLabels = showChromosomeLabels,
showAnnotTooltip = showAnnotTooltip,
showFullyBanded = showFullyBanded,
showNonNuclearChromosomes = showNonNuclearChromosomes
)
})
}
ui <- shinyUI(fluidPage(
titlePanel("Hello IdeogRam!"),
sidebarPanel(
width = 4,
textInput("organism",
label = "Organism", value = "human",
placeholder = "Organism's name or organism's NCBI Taxonomy ID"
),
textInput("chromosome",
label = "Chromosome", value = "",
placeholder = "Default showing all chromosomes"
),
selectInput("orientation",
label = "Orientation",
choices = c("default", "horizontal", "vertical")
),
numericInput("barWidth", label = "barWidth", value = 3, min = 1, max = 10),
numericInput("chrHeight", label = "chrHeight", value = 400, min = 10, max = 1000, step = 10),
numericInput("chrMargin", label = "chrMargin", value = 10, min = 0, max = 100, step = 1),
numericInput("chrWidth", label = "chrWidth", value = 10, min = 0, max = 100, step = 1),
numericInput("ploidy", label = "Ploidy", value = 1, min = 1, max = 8, step = 1),
numericInput("rows", label = "rows", value = 1, min = 1, max = 5, step = 1),
selectInput("sex", label = "sex", choices = c("male", "female")),
checkboxInput("rotatable", label = "rotatable", value = TRUE),
checkboxInput("showBandLabels", label = "showBandLabels", value = FALSE),
checkboxInput("showChromosomeLabels", label = "showChromosomeLabels", value = TRUE),
checkboxInput("showAnnotTooltip", label = "showAnnotTooltip", value = TRUE),
checkboxInput("showFullyBanded", label = "showFullyBanded", value = TRUE),
checkboxInput("showNonNuclearChromosomes",
label = "showNonNuclearChromosomes",
value = FALSE
)
),
mainPanel(
ideogRamOutput("ideo_01")
)
))
shinyApp(ui = ui, server = server)