Browse code

Revert "Revert "Minor Fixes""

This reverts commit 95e0a4636618f7e41229a46e7825ab0fbcf59e7c.

WilliamMc authored on 07/12/2020 15:21:42
Showing 4 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 #' Protein Charge Calculation, Globally
2 2
 #'
3 3
 #' This function will determine the charge of a peptide using the
4
-#'   Henderson-Hasselbalch Equation. The output is a data frame (default) or q
4
+#'   Henderson-Hasselbalch Equation. The output is a data frame (default) or a
5 5
 #'   plot of charge calculations along the peptide sequence. Charges are
6 6
 #'   determined globally, or along the entire chain.
7 7
 #'
... ...
@@ -207,7 +207,8 @@ chargeCalculationGlobal <- function(
207 207
             hline = 0, dynamicColor = chargeDF$Charge,
208 208
             customColors = c("#348AA7", "#92140C", "grey65"),
209 209
             customTitle = NA, propertyLimits = c(-1, 1))
210
-        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle)
210
+        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle,
211
+                                 y = "Charge")
211 212
         return(gg)
212 213
     } else {
213 214
         return(chargeDF)
... ...
@@ -363,7 +364,8 @@ chargeCalculationLocal <- function(sequence, window = 7,  proteinName = NA,
363 364
                             hline = 0, dynamicColor = chargeDF$windowCharge,
364 365
                             customColors = c("#348AA7", "#92140C", "grey65"),
365 366
                             customTitle = NA, propertyLimits = c(-1, 1))
366
-        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle)
367
+        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle,
368
+                                 y = "Average Charge")
367 369
         return(gg)
368 370
     } else {
369 371
         return(chargeDF)
... ...
@@ -118,7 +118,8 @@ scaledHydropathyLocal <- function(sequence, window = 9,
118 118
                         dynamicColor = windowDF$WindowHydropathy,
119 119
                         customColors = c("chocolate1", "skyblue3", "grey65"),
120 120
                         customTitle = NA, propertyLimits = c(0, 1))
121
-        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle)
121
+        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle,
122
+                                 y = "Hydropathy")
122 123
         return(gg)
123 124
     } else { #returns the DF
124 125
         return(windowDF)
... ...
@@ -224,7 +225,8 @@ scaledHydropathyGlobal <- function(
224 225
                         customColors = c("chocolate1", "skyblue3", "grey65"),
225 226
                         customTitle = NA,
226 227
                         propertyLimits = c(0, 1))
227
-        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle)
228
+        gg <- gg + ggplot2::labs(title = plotTitle, subtitle = plotSubtitle,
229
+                                 y = "Hydropathy")
228 230
         return(gg)
229 231
     } else {
230 232
         return(hydropathyDF)
... ...
@@ -95,7 +95,8 @@ sequenceCheck <- function(
95 95
     }
96 96
     #-----
97 97
     #This section will confirm what to do with the amino acid sequence
98
-    if(is(sequence)[1] == "AAString"){
98
+    if(is(sequence)[1] %in% c("AAString", "BString", 
99
+                              "AAStringSet", "BStringSet")){
99 100
         sequence <- as.character(sequence)
100 101
     }
101 102
     if (length(sequence) == 1) {
... ...
@@ -342,9 +342,13 @@ sequenceMap <- function(
342 342
         if (plyr::is.discrete(seqDF$Property)) {
343 343
             gg <- gg + ggplot2::scale_fill_manual(values = customColors)
344 344
         } else {
345
-            gg <- gg + ggplot2::scale_fill_gradient2(high = customColors[1],
346
-                                                        low = customColors[2],
347
-                                                        mid = customColors[3])
345
+            gg <- gg + 
346
+                ggplot2::scale_fill_gradient2(
347
+                    high = customColors[1],
348
+                    low = customColors[2],
349
+                    mid = customColors[3],
350
+                    midpoint = ((min(seqDF$Property) + max(seqDF$Property)) / 2)
351
+                )
348 352
         }
349 353
     }
350 354
     return(gg)