Skip to content

Commit

Permalink
add filter in search page
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanlizhanshi committed Dec 20, 2023
1 parent f3d25a6 commit f6fd7b1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions scLT/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
- [x] UMAP default show cell type and interactive with selected barcode
- [x] Build online tool
- [ ] Build download page like DRCTdb
- [ ] add three buttons in search page (species,barcode type,Techonology) to search dataset
- [ ] Build online tool (fate_mapping,cell_type_fate_similartiy, and clone_fate_bias functions in FateMapper package)
- [x] add three buttons in search page (species,barcode type,Techonology) to search dataset
- [x] Build online tool (fate_mapping,cell_type_fate_similartiy, and clone_fate_bias functions in FateMapper package)
- [ ] replace the lineage tree in the result page with fate bias DEGs/DRBs
30 changes: 18 additions & 12 deletions scLT/server.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
obj_metadata_list <- readRDS('obj_metadata_list.rds')
coretable <- readxl::read_xlsx('scLTdb summary.xlsx')
coretable <- readxl::read_xlsx('scLTdb summary.xlsx')[1:9]
coretable$species <- as.factor(coretable$species)
coretable$Technology <- as.factor(coretable$Technology)
coretable$`barcode type` <- as.factor(coretable$`barcode type`)

fate_mapping2 <- function(data,idx='celltype',input_type = 'table',normalize_method='ratio',
order_use=NULL,show_row=T,
Expand Down Expand Up @@ -110,20 +113,20 @@ cell_type_fate_similartiy2 <- function(data,idx='celltype',input_type = 'table'


dataset_cell_number_compare <- function(dataset1_name,dataset2_name,metdata_list){

dataset1 = metdata_list[[dataset1_name]]
dataset2 = metdata_list[[dataset2_name]]
dataset1_ct_freq = as.data.frame(table(dataset1$celltype))
dataset1_ct_freq$dataset = dataset1_name
dataset2_ct_freq = as.data.frame(table(dataset2$celltype))
dataset2_ct_freq$dataset = dataset2_name
df_final = rbind(dataset1_ct_freq,dataset2_ct_freq)

p1 <- ggplot(df_final,aes(x=Var1,y=Freq,fill=dataset))+
geom_col(stat='identity', position='dodge',width = 0.8)+theme_classic()+
xlab('cell state')+ylab('cell number') +scale_y_continuous(expand = c(0,0))+
scale_fill_manual(values = c("#5E4FA2","#F88D51"))

return(p1)
}

Expand All @@ -146,9 +149,12 @@ server <- function(input, output,session = session) {


#search-----
output$coretable = renderDataTable(
output$coretable = DT::renderDT(
coretable,
selection = 'single',
filter = list(
position = 'top', clear = FALSE
),
rownames =FALSE,
server = TRUE,
options = list(
Expand All @@ -166,7 +172,7 @@ server <- function(input, output,session = session) {
}
})
observeEvent(input$go_to_panel, {

updateTabsetPanel(session,"inTabset", selected = "Results")
})

Expand Down Expand Up @@ -335,18 +341,18 @@ server <- function(input, output,session = session) {
)
})




selected_value <- reactive({
input$Compare_dataset
})


output$selected_option <- renderPlot({
dataset_cell_number_compare(dataset1_name = selected_value()[1],
dataset2_name = selected_value()[2],
metdata_list = obj_metadata_list)

})
}
12 changes: 6 additions & 6 deletions scLT/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ options(shiny.maxRequestSize=1024*1024^2)
coretable <- readxl::read_xlsx('scLTdb summary.xlsx')


ui <-
ui <-
navbarPage(
includeCSS("www/style.css"),
includeCSS("www/style.css"),
title = NULL,
bg = "#325880",
id = "inTabset",
Expand Down Expand Up @@ -97,7 +97,7 @@ ui <-
actionButton("go_to_panel", "Expore dataset....",class = 'jump')
)

),style = "font-size:150%;width:80%;")
),style = "font-size:120%;width:90%;")
),


Expand Down Expand Up @@ -160,7 +160,7 @@ ui <-
"Please choose 2 datasets:",
style = 'margin-left: 20px;margin-top: 2px;font-size: 22px;'
)

),
column(7,
div(class = "double_choose",
Expand Down Expand Up @@ -212,10 +212,10 @@ ui <-

),

tabPanel(title = "Tutorials",
tabPanel(title = "Tutorials",
icon = icon('bookmark',lib = 'glyphicon'),
p("Second tab content.")),
tabPanel(title = "Download",
tabPanel(title = "Download",
icon = icon('download',lib = 'glyphicon'),
p("Third tab content")),
tabPanel(title = "Contact",
Expand Down

0 comments on commit f6fd7b1

Please sign in to comment.