Skip to content

Commit 90a4fb5

Browse files
Update server.R
Fix the download of the filtered plot on tab1.
1 parent c62b3d0 commit 90a4fb5

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

server.R

+63-3
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,75 @@ function(input, output, session) {
254254
withProgress(message = "Please wait, preparing the data for download.",
255255
value = 0.5, {
256256

257-
shinyFeedback::feedbackWarning("p1_height", is.na(input$p1_height), "Required value")
258-
shinyFeedback::feedbackWarning("p1_width", is.na(input$p1_width), "Required value")
257+
data_sc <- req( single_cell_data_reac() )
258+
259+
# Filtering features and cells based on the counts and % of mito contamination.
260+
# single_cell_data_filt <- base::subset(data_sc,
261+
# subset = nFeature_RNA > input$min_count &
262+
# nFeature_RNA < input$max_count &
263+
# percent.mt < input$max_mito_perc)
264+
265+
test_cond <- if( !is.na(input$max_count) && !is.na(input$min_count) ) {
266+
267+
shinyFeedback::feedbackWarning("max_count",
268+
input$min_count > input$max_count,
269+
"No cells will be selected by appling this parameters!")
270+
271+
shinyFeedback::feedbackWarning("min_count",
272+
input$min_count > input$max_count,
273+
"No cells will be selected by appling this parameters!")
274+
275+
validate(need(input$min_count < input$max_count, "Error: No cells will be selected by appling this parameters!"))
276+
277+
}
278+
279+
280+
if ( !is.na(input$min_count) ) {
281+
282+
# Filtering features and cells based on the counts and % of mito contamination.
283+
data_sc <- base::subset(data_sc,
284+
subset = nFeature_RNA > input$min_count)
285+
286+
}
287+
288+
if ( !is.na(input$max_count) ) {
289+
290+
shinyFeedback::feedbackWarning("max_count",
291+
input$max_count <= 0,
292+
"No cells will be selected by appling this parameters!")
293+
294+
validate(need(input$max_count > 0, "Error: No cells will be selected by appling this parameters!"))
295+
296+
# Filtering features and cells based on the counts and % of mito contamination.
297+
data_sc <- base::subset(data_sc,
298+
subset = nFeature_RNA < input$max_count)
299+
300+
301+
302+
}
303+
304+
if ( !is.na(input$max_mito_perc) ) {
305+
306+
shinyFeedback::feedbackWarning("max_mito_perc",
307+
input$max_mito_perc <= 0,
308+
"No cells will be selected by appling this parameters!")
309+
310+
validate(need(input$max_mito_perc > 0, "Error: No cells will be selected by appling this parameters!"))
311+
312+
# Filtering features and cells based on the counts and % of mito contamination.
313+
data_sc <- base::subset(data_sc,
314+
subset = percent.mt < input$max_mito_perc)
315+
316+
}
317+
318+
259319

260320
height <- as.numeric( req( input$p1_height) )
261321
width <- as.numeric( req( input$p1_width) )
262322
res <- as.numeric( req( input$p1_res) )
263323

264324

265-
p <- Seurat::VlnPlot(req( single_cell_data_filt() ),
325+
p <- Seurat::VlnPlot(data_sc,
266326
features = c("nFeature_RNA", "nCount_RNA", "percent.mt"),
267327
ncol = 3,
268328
split.plot = F)

0 commit comments

Comments
 (0)