Add buttons to copy results

This commit is contained in:
Elias Projahn 2021-10-07 12:59:04 +02:00
parent 686af3f44b
commit ae0643741a
2 changed files with 34 additions and 0 deletions

View file

@ -2,6 +2,7 @@ library(data.table)
library(DT)
library(gprofiler2)
library(plotly)
library(rclipboard)
library(shiny)
source("init.R")
@ -100,6 +101,33 @@ server <- function(input, output) {
)
})
output$copy <- renderUI({
results <- results()
gene_ids <- results[, gene]
names <- results[name != "", name]
genes_text <- paste(gene_ids, collapse = "\n")
names_text <- paste(names, collapse = "\n")
splitLayout(
rclipButton(
"copy_ids_button",
"Copy gene IDs",
genes_text,
icon = icon("clipboard"),
width = "100%"
),
rclipButton(
"copy_names_button",
"Copy gene names",
names_text,
icon = icon("clipboard"),
width = "100%"
)
)
})
output$scatter <- renderPlot({
results <- results()

6
ui.R
View file

@ -1,8 +1,10 @@
library(DT)
library(plotly)
library(rclipboard)
library(shiny)
ui <- fluidPage(
rclipboardSetup(),
titlePanel("TPE-OLD candidates"),
column(
width = 3,
@ -59,6 +61,10 @@ ui <- fluidPage(
wellPanel(
h3("Results"),
textOutput("synposis"),
div(
style = "margin-top: 16px",
uiOutput("copy")
),
div(
style = "overflow-x: auto; overflow-y: auto; margin-top: 16px",
DTOutput("genes")