Browse code

Merge pull request #91 from Vitek-Lab/devel

merge bug fix into release

Devon Kohler authored on 30/05/2024 14:43:09 • GitHub committed on 30/05/2024 14:43:09
Showing 5 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: MSstatsShiny
2 2
 Type: Package
3 3
 Title: MSstats GUI for Statistical Anaylsis of Proteomics Experiments
4
-Version: 1.6.0
4
+Version: 1.7.1
5 5
 Description: MSstatsShiny is an R-Shiny graphical user interface (GUI) 
6 6
   integrated with the R packages MSstats, MSstatsTMT, and MSstatsPTM. It 
7 7
   provides a point and click end-to-end analysis pipeline applicable to a wide 
... ...
@@ -48,54 +48,8 @@ expdesServer <- function(input, output, session,parent_session, loadpage_input,
48 48
                              power= power_x)
49 49
     }
50 50
 
51
-    #  plot output
52
-   designSampleSizePlots_ggplotly <- function(data) {
53
-  index <- if (length(unique(data$numSample)) > 1) {
54
-    "numSample"
55
-  } else if (length(unique(data$power)) > 1) {
56
-    "power"
57
-  } else if (length(unique(data$numSample)) == 1 & length(unique(data$power)) == 1) {
58
-    "numSample"
59
-  } else {
60
-    stop("Invalid input")
61
-  }
62
-  
63
-  text.size <- 12
64
-  axis.size <- 13
65
-  lab.size <- 17
66
-  
67
-  if (index == "numSample") {
68
-    p <- plot_ly(data, x = ~desiredFC, y = ~numSample, type = "scatter", mode = "lines")
69
-    p <- layout(p, xaxis = list(title = "Desired fold change"),
70
-                yaxis = list(title = "Minimal number of biological replicates"),
71
-                showlegend = TRUE,
72
-                annotations = list(text = paste("FDR is", unique(data$FDR),
73
-                                                "<br>Statistical power is", unique(data$power))),
74
-                font = list(size = text.size, family = "Arial"),
75
-                title = "")
76
-  }
77
-  
78
-  if (index == "power") {
79
-    p <- plot_ly(data, x = ~desiredFC, y = ~power, type = "scatter", mode = "lines")
80
-    p <- layout(p, xaxis = list(title = "Desired fold change"),
81
-                yaxis = list(title = "Power"),
82
-                showlegend = TRUE,
83
-                annotations = list(text = paste("Number of replicates is", unique(data$numSample),
84
-                                                "<br>FDR is", unique(data$FDR))),
85
-                font = list(size = text.size, family = "Arial"),
86
-                title = "")
87
-  }
88
-  
89
-  return(p)
90
-}
91
-
92
-    
93
-    
94
-    
95
-
96
-
97 51
     output$result_plot = renderPlotly({
98
-      designSampleSizePlots_ggplotly(future_exp())
52
+      designSampleSizePlots(future_exp(), isPlotly = TRUE)
99 53
     })
100 54
 
101 55
     #download
... ...
@@ -117,4 +71,4 @@ expdesServer <- function(input, output, session,parent_session, loadpage_input,
117 71
     })
118 72
   })
119 73
 
120
-}
121 74
\ No newline at end of file
75
+}
... ...
@@ -107,15 +107,15 @@ qcServer <- function(input, output, session,parent_session, loadpage_input,get_d
107 107
     print("Inside render UI and getting input$type1")
108 108
     print(input$type1)
109 109
     if ((loadpage_input()$BIO!="PTM" && input$type1 == "QCPlot")) {
110
-      if((loadpage_input()$DDA_DIA=="LType" && loadpage_input()$filetype=="sky") || (loadpage_input()$DDA_DIA=="LType" && loadpage_input()$filetype=="ump")){
111
-        selectizeInput(ns("which"), "Show plot for", 
112
-                       choices = c("", "ALL PROTEINS" = "allonly", 
113
-                                   unique(get_data()[2])))
114
-      } else {
115
-        selectizeInput(ns("which"), "Show plot for", 
116
-                       choices = c("", "ALL PROTEINS" = "allonly", 
117
-                                   unique(get_data()[1])))
118
-      }
110
+      # if((loadpage_input()$DDA_DIA=="LType" && loadpage_input()$filetype=="sky") || (loadpage_input()$DDA_DIA=="LType" && loadpage_input()$filetype=="ump")){
111
+      #   selectizeInput(ns("which"), "Show plot for", 
112
+      #                  choices = c("", "ALL PROTEINS" = "allonly", 
113
+      #                              unique(get_data()[2])))
114
+      # } else {
115
+      selectizeInput(ns("which"), "Show plot for", 
116
+                     choices = c("", "ALL PROTEINS" = "allonly", 
117
+                                 unique(get_data()[1])))
118
+      # }
119 119
     } else if (loadpage_input()$BIO == "PTM"){
120 120
       if (input$type1 == "QCPlot"){
121 121
         selectizeInput(ns("which"), "Show plot for", 
... ...
@@ -162,17 +162,17 @@ qcServer <- function(input, output, session,parent_session, loadpage_input,get_d
162 162
       # }
163 163
       
164 164
       if(loadpage_input()$DDA_DIA == "TMT"){
165
-        
166
-        dataProcessPlotsTMT(preprocess_data(),
165
+        plot <- dataProcessPlotsTMT(preprocess_data(),
167 166
                             type=input$type1,
167
+                            featureName = input$fname,
168 168
                             ylimUp = FALSE,
169 169
                             ylimDown = FALSE,
170 170
                             which.Protein = protein,
171
-                            originalPlot = TRUE,
171
+                            originalPlot = original,
172 172
                             summaryPlot = input$summ,
173
-                            address = file
174
-        )
175
-
173
+                            address = file, isPlotly = TRUE
174
+        )[[1]]
175
+        return(plot)
176 176
         
177 177
       } else if (loadpage_input()$BIO == "PTM"){
178 178
         
... ...
@@ -370,8 +370,8 @@ qcServer <- function(input, output, session,parent_session, loadpage_input,get_d
370 370
   output$showplot = renderUI({
371 371
     ns<- session$ns
372 372
     
373
-    # TMT and PTM plotly plots are still under development
374
-    if ((loadpage_input()$DDA_DIA == "TMT") || (loadpage_input()$BIO == "PTM")) {
373
+    # PTM plotly plots are still under development
374
+    if (loadpage_input()$BIO == "PTM") {
375 375
       output$theplot = renderPlot(theplot())
376 376
       op <- plotOutput(ns("theplot"))
377 377
     } else {
... ...
@@ -491,4 +491,4 @@ qcServer <- function(input, output, session,parent_session, loadpage_input,get_d
491 491
       preprocessData = preprocess_data
492 492
     )
493 493
   )
494
-}
495 494
\ No newline at end of file
495
+}
... ...
@@ -236,7 +236,7 @@ qcUI <- function(id) {
236 236
                           #                  tags$br(),
237 237
                           #                  tags$h4("Calculation in progress...")),
238 238
                           uiOutput(ns("showplot")),
239
-                          disabled(downloadButton(ns("saveplot"), "Save this plot"))
239
+                          # disabled(downloadButton(ns("saveplot"), "Save this plot"))
240 240
                  ),
241 241
                  tabPanel("Download Data", 
242 242
                           #verbatimTextOutput('effect'),
... ...
@@ -411,18 +411,20 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
411 411
 
412 412
     } else if(loadpage_input()$DDA_DIA=="TMT"){
413 413
       tryCatch({
414
-        plot1 = MSstatsShiny::groupComparisonPlots2(data=data_comparison()$ComparisonResult,
415
-                                                    type=input$typeplot,
416
-                                                    sig=input$sig,
417
-                                                    FCcutoff=input$FC,
418
-                                                    logBase.pvalue=input$logp,
419
-                                                    ProteinName=input$pname,
420
-                                                    numProtein=input$nump, 
421
-                                                    clustering=input$cluster, 
422
-                                                    which.Comparison=input$whichComp,
423
-                                                    which.Protein = input$whichProt,
424
-                                                    address=path1(),
425
-                                                    savePDF=pdf)
414
+        # makes use of MSstats groupComparisonPlots function
415
+        plot1 = groupComparisonPlots(data=data_comparison()$ComparisonResult,
416
+                                     type=input$typeplot,
417
+                                     sig=input$sig,
418
+                                     FCcutoff=input$FC,
419
+                                     logBase.pvalue=as.numeric(input$logp),
420
+                                     ProteinName=input$pname,
421
+                                     numProtein=input$nump, 
422
+                                     clustering=input$cluster, 
423
+                                     which.Comparison=input$whichComp,
424
+                                     which.Protein = input$whichProt,
425
+                                     height = input$height,
426
+                                     address="Ex_",
427
+                                     isPlotly = TRUE)[[1]]
426 428
       remove_modal_spinner()
427 429
       },
428 430
       error = function(e){
... ...
@@ -715,8 +717,8 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu
715 717
 
716 718
   observeEvent(input$viewresults, {
717 719
     ns <- session$ns
718
-    # TMT and PTM plotly plots are still under development
719
-    if ((loadpage_input()$DDA_DIA == "TMT") || (loadpage_input()$BIO == "PTM")) {
720
+    # PTM plotly plots are still under development
721
+    if (loadpage_input()$BIO == "PTM") {
720 722
       output$comp_plots = renderPlot({
721 723
         group_comparison(FALSE, FALSE)
722 724
       })