-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from lishensuo/develop24
add daily-gene module
- Loading branch information
Showing
7 changed files
with
174 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
ui.home_daily_gene <- function(id) { | ||
ns <- NS(id) | ||
tagList( | ||
# h3("Daily Gene", icon = "dice", align = "center"), | ||
fluidRow( | ||
column(6, #offset = 1, | ||
uiOutput(ns("gene_tip")), | ||
|
||
fluidRow( | ||
column(12, align = "center", | ||
actionBttn( | ||
inputId = ns("change_gene"), | ||
label = "Sample another one", | ||
style = "bordered", | ||
color = "primary", | ||
icon = icon("dice"), | ||
size = "sm" | ||
) | ||
) | ||
) | ||
), | ||
column(6, #offset = 2, | ||
uiOutput(ns("gene_cancer")) | ||
) | ||
), | ||
# fluidRow( | ||
# column(8, offset = 2, | ||
# uiOutput(ns("gene_cancer")) | ||
# ) | ||
# ), | ||
) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
server.home_daily_gene <- function(input, output, session) { | ||
ns <- session$ns | ||
|
||
|
||
gene_sp = reactiveValues(gene="TP53") | ||
|
||
|
||
gene_sp = reactive({ | ||
if(input$change_gene==0){ | ||
current_date <- Sys.Date() | ||
formatted_date <- as.integer(format(current_date, "%Y%m%d")) | ||
set.seed(formatted_date) | ||
gene_sp = sample(pancan_identifiers$gene,size = 1) | ||
} else { | ||
current_time <- Sys.time() | ||
total_seconds <- as.integer(difftime(current_time, as.POSIXct("1970-01-01"), units = "secs")) | ||
set.seed(total_seconds) | ||
gene_sp = sample(pancan_identifiers$gene,size = 1) | ||
} | ||
gene_sp | ||
}) | ||
|
||
gene_data = reactive({ | ||
data.list = get_pancan_gene_value(gene_sp(), norm = "tpm") | ||
data = data.list$expression | ||
shiny::validate( | ||
need(try(!all(is.na(data))), | ||
"Sorry, no valid value for the sampling gene. Pleaese click the button again."), | ||
) | ||
data = data.frame(value=data) %>% | ||
tibble::rownames_to_column("sample") %>% | ||
dplyr::inner_join(tcga_gtex) %>% | ||
dplyr::mutate(tissue = as.character(tissue)) | ||
data | ||
}) | ||
|
||
|
||
|
||
stat_res = reactive({ | ||
data = gene_data() | ||
stat_res = compare_means(value ~ type2, data = data, | ||
group.by = "tissue") %>% | ||
dplyr::arrange(p) | ||
stat_res | ||
}) | ||
|
||
|
||
output$gene_cancer = renderUI({ | ||
output$box_plot = renderPlotly({ | ||
data = gene_data() | ||
p = data %>% | ||
dplyr::filter(tissue == stat_res()$tissue[1]) %>% | ||
dplyr::filter(value > -9.966) %>% | ||
ggboxplot(x = "type2", y = "value", | ||
fill = "type2", | ||
color = "black", | ||
width = 0.5, | ||
palette = "aaas") + | ||
xlab(paste0("TCGA-",stat_res()$tissue[1])) + | ||
ylab("TPM value (TCGA+GTEx)") + | ||
ggtitle(gene_sp(), | ||
subtitle = paste0("Wilcoxon, p=", | ||
formatC(stat_res()$p[1], format = "e", digits = 2))) + | ||
theme(legend.position = "none", | ||
text = element_text(size = 12), | ||
plot.title = element_text(hjust = 0.5), | ||
plot.subtitle = element_text(size = 12, hjust = 0.5)) | ||
subtitle_txt = paste0("Wilcoxon, p=", formatC(stat_res()$p[1], format = "e", digits = 2)) | ||
title_text = | ||
p = ggplotly(p) %>% | ||
layout(title = list(text = paste0(gene_sp(),'<br>','<sup>', subtitle_txt,'</sup>'), | ||
font = list(size = 18)), | ||
xaxis = list(font=list(size = 15)), | ||
yaxis = list(font=list(size = 10))) | ||
p | ||
}) | ||
plotlyOutput(ns("box_plot"), height = "220px") | ||
}) | ||
|
||
|
||
output$gene_tip = renderUI({ | ||
|
||
tcga_link = "https://gdc.cancer.gov/resources-tcga-users/tcga-code-tables/tcga-study-abbreviations" | ||
gc_link = paste0("https://www.genecards.org/cgi-bin/carddisp.pl?gene=", gene_sp()) | ||
pm_link = paste0("https://pubmed.ncbi.nlm.nih.gov/?term=%28",gene_sp(),"%29+AND+%28cancer%29") | ||
tagList( | ||
tags$ul( | ||
tags$li(gene_sp()," is most differentially expressed in ", | ||
a(paste0("TCGA-",stat_res()$tissue[1]), href = tcga_link), ".", | ||
style = "font-size: 16px;"), | ||
tags$li("Explore its pan-cancer feature in right panel. ☞",style = "font-size: 16px;"), | ||
tags$li("Search more about the gene in ", | ||
a("GeneCards", href = gc_link), " or ", | ||
a("PubMed", href = pm_link), ".", | ||
style = "font-size: 16px;") | ||
) | ||
) | ||
}) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ ui.page_home <- function() { | |
tags$link(rel = "stylesheet", type = "text/css", href = "bootstrap4.css") | ||
), | ||
fluidRow( | ||
column(5, | ||
column(4, | ||
tags$div( | ||
column( | ||
12, | ||
|
@@ -34,29 +34,21 @@ ui.page_home <- function() { | |
) | ||
) | ||
), | ||
column(4, | ||
wellPanel( | ||
style = "background: #b3cde3", | ||
h3("❤ Daily Gene", icon = "dice", align = "center"), | ||
ui.home_daily_gene("homepage_daily_gene"), | ||
) | ||
), | ||
column(4, | ||
wellPanel( | ||
style = "background: #a6cee3", | ||
h2("TCGA Pan-Cancer Query!", align = "center"), | ||
h3("❤ Pan-Cancer Query", align = "center"), | ||
# br(), | ||
ui.home_search_box("homepage_pancan_search"), | ||
) | ||
), | ||
column(3, | ||
wellPanel( | ||
style = "background: #b3cde3", | ||
h2("Latest Release Notes", align = "center"), | ||
br(), | ||
tags$ul( | ||
tags$li("2024-01-21: Adjust homepge with slick gallery to show basic page help.",style = "font-size: 14px;"), | ||
tags$li("2024-01-16: Introduce MSigDB genesets for molecule batch analysis.",style = "font-size: 14px;"), | ||
tags$li("2023-12-20: Add download modules that support data requisition.",style = "font-size: 14px;"), | ||
tags$li("See more update logs in", | ||
a("Github", href="https://github.com/openbiox/UCSCXenaShiny"), | ||
style = "font-size: 16px;") | ||
) | ||
) | ||
) | ||
), | ||
tags$br(), | ||
h2(strong("※ Shiny Page Gallery")), | ||
|
@@ -68,7 +60,7 @@ ui.page_home <- function() { | |
) | ||
), | ||
br(),br(), | ||
h2(strong("※ Quick TCGA modules with specific functions")), | ||
h2(strong("※ Custom TCGA modules with specific functions")), | ||
tags$hr(style = "border:none; border-top:5px solid #5E81AC;"), | ||
fluidRow( | ||
column( | ||
|
@@ -240,8 +232,28 @@ ui.page_home <- function() { | |
"similar versatile pipeline analyses (including comparison, correlation, survival) with personalized operations for PCAWG and CCLE databases.")) | ||
) | ||
) | ||
), | ||
br(), | ||
h2(strong("※ Latest significant release notes")), | ||
tags$hr(style = "border:none; border-top:5px solid #5E81AC;"), | ||
fluidRow( | ||
column(12, #offset = 1, | ||
tags$ul( | ||
tags$li("2024-02-14: Incorporate the PharmacoGenomics analysis modules",style = "font-size: 20px;"), | ||
tags$li("2024-01-21: Adjust homepge with slick gallery to show basic page help.",style = "font-size: 20px;"), | ||
tags$li("2024-01-16: Introduce MSigDB genesets for molecule batch analysis.",style = "font-size: 20px;"), | ||
tags$li("2023-12-20: Add download modules that support data requisition.",style = "font-size: 20px;"), | ||
tags$li("See more update logs in our", | ||
a("Github", href="https://github.com/openbiox/UCSCXenaShiny"), ".", | ||
"If you have any questions, please report the ", | ||
a("issue", href = "https://github.com/openbiox/UCSCXenaShiny/issues"), | ||
" or email at [email protected]. We will get back to you ASAP.", | ||
style = "font-size: 20px;") | ||
) | ||
) | ||
) | ||
) | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters