Basic Shiny app to fetch variant information

I created a basic Shiny app that uses the myvariant package to fetch variant information from MyVariant.info. The variants need to be represented in the format recommended by the Human Genome Variation Society. Once you have your variant of interest in the correct format, just hit "Get variant info!" and the annotations will appear on the right. You can find the app hosted at: https://davetang.shinyapps.io/get_variant_info/.

If you want to learn more about Shiny, check out the tutorial video. Here's the code for the app:

library(shiny)
library(myvariant)

ui <- fluidPage(
  
  # Application title
  titlePanel("Get variant information from MyVariant.info"),
  
  # Sidebar with controls to select a dataset and specify the
  # number of observations to view
  sidebarLayout(
    sidebarPanel(
      textInput("var", "Variant: (e.g. chr1:g.3319550C>T)", 'chr1:g.13380C>G'),
      actionButton(inputId = "go", label = "Get variant info!")
    ),

    mainPanel(
      tableOutput("hg19"),
      tableOutput("vcf"),
      tableOutput("ann"),
      tableOutput("cadd"),
      tableOutput("exac"),
      tableOutput("exac_nontcga"),
      tableOutput("snpeff"),
      tableOutput("clinvar")
    )
  )
)

server <- function(input, output) {
  
  result <- eventReactive(input$go, {
    getVariant(input$var)
  })
  
  output$hg19 <- renderTable({
    data <- result()
    data[[1]]['hg19']
  })
  output$vcf <- renderTable({
    data <- result()
    data[[1]]['vcf']
  })
  output$ann <- renderTable({
    data <- result()
    data[[1]]['ann']
  })
  output$cadd <- renderTable({
    data <- result()
    data[[1]]['cadd']
  })
  output$exac <- renderTable({
    data <- result()
    data[[1]]['exac']
  })
  output$exac_nontcga <- renderTable({
    data <- result()
    data[[1]]['exac_nontcga']
  })
  output$snpeff <- renderTable({
    data <- result()
    data[[1]]['snpeff']
  })
  output$clinvar <- renderTable({
    data <- result()
    data[[1]]['clinvar']
  })
}

# Run the application 
shinyApp(ui = ui, server = server)

I'm not showing all the annotations that can be potentially available for a variant. The app breaks for some variants because of the "list of list" to data frame conversion. I'll fix it soon.

Print Friendly, PDF & Email



Creative Commons License
This work is licensed under a Creative Commons
Attribution 4.0 International License
.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.