Shiny 网页设计
Yuxuan Wu Lv13

Short essay (300 words):

Briefly comment on bioinformatics web app design and usage, including important key considerations, information extraction, typical problems, future challenges, promising directions, and other issues that catch your attention. (20 points)

  • Key consideration
  • Information extraction
  • Typical problems
  • Future challenges
  • Promising direction

Web skills, one of the significant tools in demonstrating experiment results, have gained increasing importance in bioinformatics students and researchers. Generally, a bioinformatics web application could process some kind of biological data from users’ input and output the annotated or elaborated results, for instance, RNA-seq, GO analysis. In other words, a bioinformatics web application contains three steps, input, processing, and output. Therefore, UI design scripts and data processing scripts would be necessary for bioinformatics people. Regarding the UI design, HTML, CSS and JavaScript would be the top choice, meanwhile, regarding the data processing language, R or Python would be widely used.

Owing to the fact that most bioinformatics people do not possess enough programing knowledge to learn all the language suggested previously, they generally mastered one language, for instance, R. As a result, “shiny” package based on R was devised and researchers could now design and publish their own web application with a few R codes. To be more specific, shiny is a highly assembled R package and sufficient to cover basic requirements for demonstration. Hence, there is no need for bioinformatics researchers to learn extra web design language and let them focus on the data processing part, saving their energy and time.

However, the shiny-based web application has its own drawbacks. Based on my personal experience in this coursework, I found that the tools were limited and could only satisfy the basic layout, rather than fancy, well-designed web pages. Also, since shiny is based on R, researchers’ choice could be restricted to R, but some heated techniques like deep learning could not achieve their full potential on the R platform, so the application area is in a small scope. In the meantime, users have to devote some time to learning the document of shiny, but the overall investment could already support you to learn the normal web designing language HTML, CSS and Javascript. The previously stated reasons could probably account for the limited use of shiny in actual web development in the bioinformatic field, they mostly prefer the normal web development tool. In reality, it is a great way to start by shiny and cultivate some interests in web design and turn to other more general, widely used tools

The layout of the website

image-20210417190257742

Filtering criteria

image-20210417202526960

image-20210417202811677

image-20210417202738923

image-20210418075434264

Server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Title     : TODO
# Objective : TODO
# Created by: yuxuan
# Created on: 4/9/21

##############################
# This is Server design script
##############################

library(shiny)

shinyServer(function(input, output) {
res = read.table(file = "~/cw1/P1/DGE/gene_exp.diff", header = T, sep = "\t")

query <- eventReactive(input$go0, {
ID <- which(res$gene_id == input$gene)
data <- res[ID,]
data[,c(1,10,12)]
})
data_v1 <- eventReactive(input$go, {
input$FPKM_value_1
})

data_v2 <- eventReactive(input$go, {
input$FPKM_value_2
})

data_fg <- eventReactive(input$go, {
input$fold_change
})

data_pv <- eventReactive(input$go, {
input$p_value
})

output$FPKM_value_1 <- renderText(data_v1())
output$FPKM_value_2 <- renderText(data_v2())
output$fold_change <- renderText(data_fg())
output$p_value <- renderText(data_pv())

# data processing, still run after update buttom

process <- eventReactive(input$go, {
idx = which((res$value_1 > input$FPKM_value_1 | res$value_2 > input$FPKM_value_2) &
(abs(res$log2.fold_change.) >= input$fold_change) &
(res$p_value < input$p_value))
res_processed = res[idx,]
head(res_processed)
})

rows <- eventReactive(input$go, {
idx = which((res$value_1 > input$FPKM_value_1 | res$value_2 > input$FPKM_value_2) &
(abs(res$log2.fold_change.) >= input$fold_change) &
(res$p_value < input$p_value))
res_processed = res[idx,]
nrow(res_processed)
})
cols <- eventReactive(input$go, {
idx = which((res$value_1 > input$FPKM_value_1 | res$value_2 > input$FPKM_value_2) &
(abs(res$log2.fold_change.) >= input$fold_change) &
(res$p_value < input$p_value))
res_processed = res[idx,]
ncol(res_processed)
})

bar_plot <- eventReactive(input$go2, {
idx = which((res$value_1 > input$FPKM_value_1 | res$value_2 > input$FPKM_value_2) &
(abs(res$log2.fold_change.) >= input$fold_change) &
(res$p_value < input$p_value))
res_processed = res[idx,]
if (input$gene %in% res_processed$gene_id) {
ID <- which(res_processed$gene_id == input$gene)
data <- res_processed[ID,]
barplot(height = c(data$value_1, data$value_2), names.arg = c("WT", 'METTL5_KO')) }
else {
output$error <- renderText({ print("The entered gene name is not in the filtered list") })
}
})


output$head_ori_data <- renderTable({ head(res) })
output$query <- renderTable(query())
output$head_data_processed <- renderTable({ process() })
output$rows <- renderText({ rows() })
output$cols <- renderText({ cols() })
output$test <- renderPrint(test())
output$bar <- renderPlot({ bar_plot() })

})

UI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Title     : TODO
# Objective : TODO
# Created by: yuxuan
# Created on: 4/9/21

##############################
# This is UI design script
##############################

library(shiny)
res_ori = read.table(file = "~/cw1/P1/DGE/gene_exp.diff", header = T, sep = "\t")

# Define UI for application that draws a histogram
shinyUI(fluidPage(

# title
titlePanel("Welcome to my shiny-based website"),

tags$h3("An overview of the data selected"),
tableOutput("head_ori_data"),

tags$hr(),
tags$h3("Gene-based query"),
textInput('gene_query',label = "Enter the gene name",value = "A1BG"),
tableOutput("query"),
actionButton(inputId = "go0", label = "Search"),



tags$hr(),
tags$h3("Select the filter criteria"),

fluidRow(
column(3, sliderInput("FPKM_value_1", "FPKM of value 1", value = 1, min = 0, max = max(res_ori$value_1))),
column(3, sliderInput("FPKM_value_2", "FPKM of value 2", value = 1, min = 0, max = max(res_ori$value_2))),

column(3, sliderInput("fold_change", "log2(fold change)", value = 1, min = 0, max = 10)),
column(3, sliderInput("p_value", "p value", value = 0.05, min = 0, max = 1))
),

# add the input gene and set the default value

actionButton(inputId = "go", label = "update"),

tags$br(),
tags$br(),
tags$br(),

tags$h4("The suggested optimal filtering criteria is:"),
tags$br(),
tags$p("I. FPKM1 or FPKM2 > 1"),
tags$p("II. log2(fold change) >1 or < -1 <=> Absoluate value > 1 "),
tags$p("III. p-value < 0.05"),


tags$br(),


tags$h4("The filtering criteria you selected is: "),


fluidRow(
column(1, tags$p("FPKM_value_1:")),
column(1, textOutput("FPKM_value_1")),
column(1, tags$p("FPKM_value_2:")),
column(1, textOutput("FPKM_value_2")),
column(1, tags$p("log2(fold change):")),
column(1, textOutput("fold_change")),
column(1, tags$p("p value")),
column(3, textOutput("p_value")),
),

tags$hr(),
tags$h3("The head of the processed data under the criterial you filtered"),
tags$br(),
tableOutput("head_data_processed"),
fluidRow(column(1, tags$p("Rows:")),
column(1, textOutput("rows"))),
fluidRow(column(1, tags$p("Columns:")),
column(1, textOutput("cols"))),
tags$hr(),


tags$h3("Now you obtained the filtered dataset"),
tags$p("Enter the gene you would like to choose:"),
textInput(inputId = 'gene', "Gene Name", value = "ABHD11-AS1"),
tags$hr(),
actionButton(inputId = "go2", label = "update"),
textOutput("error"),
plotOutput("bar")
)
)
  • Post title:Shiny 网页设计
  • Post author:Yuxuan Wu
  • Create time:2021-04-17 02:24:26
  • Post link:yuxuanwu17.github.io2021/04/17/2021-04-17-Shiny-网页设计/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.