Browse code

clean statmodel server

deril2605 authored on 28/01/2024 01:37:13
Showing 1 changed files

... ...
@@ -429,23 +429,7 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
429 429
 
430 430
 
431 431
     } else{
432
-      # tryCatch({
433
-      print("lets seee comppp")
434
-      print(input$whichComp)
435
-      print(input$whichProt)
436
-      print("lets seee comppp")
437
-      # plot1 = MSstatsShiny::groupComparisonPlots2(data=data_comparison()$ComparisonResult,
438
-      #                                                       type=input$typeplot,
439
-      #                                                       sig=input$sig,
440
-      #                                                       FCcutoff=input$FC,
441
-      #                                                       logBase.pvalue=input$logp,
442
-      #                                                       ProteinName=input$pname,
443
-      #                                                       numProtein=input$nump,
444
-      #                                                       clustering=input$cluster,
445
-      #                                                       which.Comparison=input$whichComp,
446
-      #                                                       which.Protein = input$whichProt,
447
-      #                                                       address=path1(),
448
-      #                                                       savePDF=pdf)
432
+      tryCatch({                                                   
449 433
       if(toupper(input$typeplot) == "VOLCANOPLOT" && input$whichComp == "all") {
450 434
         remove_modal_spinner()
451 435
         stop( '** Cannnot generate multiple plots in a screen. Please refine selection or save to a pdf.**' )
... ...
@@ -464,11 +448,11 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
464 448
                                    height = input$height,
465 449
                                    address="Ex_",
466 450
                                    isPlotly = TRUE)[[1]]
467
-      # }, error = function(e){
468
-      #   remove_modal_spinner()
469
-      #   message("An error occurred: ", conditionMessage(e))
470
-      #   stop( '** Cannnot generate multiple plots in a screen. Please refine selection or save to a pdf.**' )}
471
-      # )
451
+      }, error = function(e){
452
+        remove_modal_spinner()
453
+        message("An error occurred: ", conditionMessage(e))
454
+        stop( '** Cannnot generate multiple plots in a screen. Please refine selection or save to a pdf.**' )}
455
+      )
472 456
     }
473 457
 
474 458
     remove_modal_spinner()
... ...
@@ -482,8 +466,8 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
482 466
 
483 467
   }
484 468
   
469
+  # On Heatmap page to display the num of proteins, bound the input range
485 470
   observe({
486
-    # Check if the input is NA or not a number
487 471
     if(is.na(input$nump) || !is.numeric(input$nump) || input$nump <= 0) {
488 472
       # Reset to default value or handle the error as needed
489 473
       updateNumericInput(session, "nump", value = 100)
... ...
@@ -525,21 +509,11 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
525 509
 
526 510
   ########## output ##########
527 511
   
528
-  # 
529 512
   output$plotresults = downloadHandler(
530 513
     filename = function() {
531 514
       paste("SummaryPlot-", Sys.Date(), ".zip", sep="")
532 515
     },
533 516
     content = function(file) {
534
-      # pdf(file)
535
-      # group_comparison(TRUE, TRUE)
536
-      # dev.off()
537
-      # doc = .get.plotly.plot.html(list(group_comparison(FALSE, FALSE)),800,600)
538
-      # print(doc)
539
-      # writeLines(doc, file)
540
-      # print(file)
541
-      # .save.plotly.plot.html(list(group_comparison(FALSE, FALSE)),"",file,800,600)
542
-      # group_comparison(FALSE, FALSE)
543 517
       files <- list.files(getwd(), pattern = "^Ex_", full.names = TRUE)
544 518
       file_info <- file.info(files)
545 519
       latest_file <- files[which.max(file_info$mtime)]
... ...
@@ -547,22 +521,6 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
547 521
       file.copy(latest_file, file)
548 522
     }
549 523
   )
550
-  # 
551
-  # observeEvent(input$plotresults, {
552
-  #   # print("IN DOWNLOADDD 111")
553
-  #   # tryCatch({
554
-  #     MSstats::.save.plotly.plot.html(list(group_comparison(FALSE, FALSE)),"",paste("SummaryPlot-", Sys.Date(), sep=""),800,600)
555
-  #     print("IN DOWNLOADDD 222")
556
-  #     showNotification("File downloaded successfully in your local directory")
557
-  #     print("IN DOWNLOADDD 333")
558
-  #   # },
559
-  #   # error=function(cond) {
560
-  #   #   showNotification("File download failed", type='error')
561
-  #   #   message(cond)
562
-  #   #   stop("why")
563
-  #   # })
564
-  #   print("IN DOWNLOADDD 444")
565
-  # })
566 524
 
567 525
   # download comparison data
568 526