Repository 'mqppep_preproc'
hg clone https://toolshed.g2.bx.psu.edu/repos/galaxyp/mqppep_preproc

Changeset 3:bae3a23461c9 (2023-01-31)
Previous changeset 2:a5e7469dfdfa (2022-12-12) Next changeset 4:5c2beb4eb41c (2023-02-14)
Commit message:
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
modified:
MaxQuantProcessingScript.R
macros.xml
mqppep_anova.R
mqppep_anova_script.Rmd
b
diff -r a5e7469dfdfa -r bae3a23461c9 MaxQuantProcessingScript.R
--- a/MaxQuantProcessingScript.R Mon Dec 12 22:01:21 2022 +0000
+++ b/MaxQuantProcessingScript.R Tue Jan 31 22:27:00 2023 +0000
[
@@ -73,7 +73,9 @@
 }
 
 # Generate phosphopeptide and build list when applied
+# nolint start: squash un-actionable cyclomatic_complexity warning
 phosphopeptide_func <- function(df) {
+# nolint end
   # generate peptide sequence and list of phosphopositions
   phosphoprobsequence <-
     strsplit(as.character(df["Phospho (STY) Score diffs"]), "")[[1]]
b
diff -r a5e7469dfdfa -r bae3a23461c9 macros.xml
--- a/macros.xml Mon Dec 12 22:01:21 2022 +0000
+++ b/macros.xml Tue Jan 31 22:27:00 2023 +0000
b
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@TOOL_VERSION@">0.1.16</token>
+    <token name="@TOOL_VERSION@">0.1.17</token>
     <token name="@VERSION_SUFFIX@">0</token>
     <xml name="requirements">
         <requirements>
b
diff -r a5e7469dfdfa -r bae3a23461c9 mqppep_anova.R
--- a/mqppep_anova.R Mon Dec 12 22:01:21 2022 +0000
+++ b/mqppep_anova.R Tue Jan 31 22:27:00 2023 +0000
[
@@ -101,14 +101,15 @@
     default = "FDR",
     type = "character",
     help = paste0("Method for missing-value imputation,",
-             " one of c('FDR','p.value'), but don't expect 'p.value' to work well.")
+      " one of c('FDR','p.value'), but don't expect 'p.value' to work well.")
   ),
   make_option(
     c("-t", "--ksea_cutoff_threshold"),
     action = "store",
     default = 0.05,
     type = "double",
-    help = paste0("Maximum score to be used to score a kinase enrichment as significant")
+    help = paste0(
+      "Maximum score to be used to score a kinase enrichment as significant")
   ),
   make_option(
     c("-c", "--kseaMinSubstrateCount"),
@@ -269,7 +270,8 @@
       )
     ) < 1
   ) {
-    print(sprintf("bad ksea_cutoff_statistic argument: %s", ksea_cutoff_statistic))
+    print(sprintf(
+      "bad ksea_cutoff_statistic argument: %s", ksea_cutoff_statistic))
     return(-1)
     }
 
@@ -313,7 +315,6 @@
       cat(sprintf("not a file: '%s'\n", fname))
       fname
     }
-  #AC print(paste0("read_config_file_string: opening file '", as.character(fname), "'"))
   # eliminate any leading whitespace
   result <- gsub("^[ \t\n]*", "",   result)
   # eliminate any trailing whitespace
@@ -347,8 +348,10 @@
 cat(paste0("regex_sample_names: ",    regex_sample_names,    "\n"))
 
 if (group_filter != "none") {
-  cat(paste0("group_filter_patterns file: '", args$sampleGroupFilterPatterns, "'\n"))
-  group_filter_patterns <- read_config_file_string(args$sampleGroupFilterPatterns, nc)
+  cat(paste0("group_filter_patterns file: '",
+             args$sampleGroupFilterPatterns, "'\n"))
+  group_filter_patterns <-
+    read_config_file_string(args$sampleGroupFilterPatterns, nc)
 } else {
   group_filter_patterns <- ".*"
 }
b
diff -r a5e7469dfdfa -r bae3a23461c9 mqppep_anova_script.Rmd
--- a/mqppep_anova_script.Rmd Mon Dec 12 22:01:21 2022 +0000
+++ b/mqppep_anova_script.Rmd Tue Jan 31 22:27:00 2023 +0000
[
b'@@ -48,11 +48,11 @@\n   # for small random value imputation, what should `s / mean(x)` ratio be?\n   sdPercentile:         1.0\n   # output path for imputed data file\n-  imputedDataFilename:  "test-data/limbo/imputedDataFilename.txt"\n+  imputedDataFilename:  "test-data/imputedDataFilename.txt"\n   # output path for imputed/quantile-normalized/log-transformed data file\n-  imputedQNLTDataFile:  "test-data/limbo/imputedQNLTDataFile.txt"\n+  imputedQNLTDataFile:  "test-data/imputedQNLTDataFile.txt"\n   # output path for contents of `stats_metadata_v` table\n-  anovaKseaMetadata:    "test-data/limbo/anovaKseaMetadata.txt"\n+  anovaKseaMetadata:    "test-data/anovaKseaMetadata.txt"\n   # how to test one variable with > 2 categories (e.g., aov or kruskal.test)\n   oneWayManyCategories: !r c("aov", "kruskal.test", "oneway.test")[1]\n   # how to test one variable with 2 categories (e.g., oneway.test)\n@@ -99,8 +99,17 @@\n   showEnrichedSubstrates: FALSE\n   # should debugging nb/nbe messages be printed?\n   printNBMsgs:          FALSE\n-  # showld row-scaling be applied to heatmaps: "none" or "row"\n-  defaultHeatMapRowScaling: "none"\n+  #printNBMsgs:          TRUE\n+  # should row-scaling be applied to heatmaps: "none" or "row"\n+  defaultHeatMapRowScaling: !r c("none", "row")[1]\n+  # how missing values be displayed on heat maps: "NA" or " "\n+  heatMapNAcellNote:    !r c(" ", "NA")[1]\n+  # how missing values be displayed on heat maps: "NA" or " "\n+  heatMapNAgrey:        "#D8D8D8"\n+  # temporary hack\n+  heatMapNAsubstitute:  TRUE\n+  # what color should be used for missing values be displayed on heat maps\n+  heatMapNAcellColor:   "grey15"\n   # should debugging trace messages be printed?\n   printTraceMsgs:       FALSE\n   # when debugging files are needed, set debugFileBasePath to the path\n@@ -124,7 +133,7 @@\n   } else {\n     function(..., f = cat, file = stderr()) {\n       cat(\n-        stringi::stri_unescape_unicode("\\nNBE \\\\u2203\\\\u2283\\\\u2200"),\n+        stringi::stri_unescape_unicode("\\nN.B. \\\\u2203\\\\u2283\\\\u2200"),\n         ...,\n         file = file\n       )\n@@ -148,7 +157,7 @@\n library(gplots)\n if (print_nb_messages) nbe("library(caret)")\n # load caret for nearZeroVar\n-if (print_nb_messages) nbe("Please ignore the messages about systemd, if any.\\n")\n+if (print_nb_messages) nbe("Please ignore any messages about systemd.\\n")\n library(caret)\n if (print_nb_messages) nbe("library(DBI)")\n library(DBI)\n@@ -342,6 +351,18 @@\n     }\n   }\n \n+divert_warnings <-\n+  function(expr, classes = "warning") {\n+    withCallingHandlers(\n+      expr,\n+      warning = function(w) {\n+        cat("  divert_warnings: ", w$message, "\\n", file = stderr())\n+        if (inherits(w, classes))\n+          tryInvokeRestart("muffleWarning")\n+        }\n+      )\n+  }\n+\n # ref: https://tug.org/texinfohtml/latex2e.html\n # LaTeX sets aside the following characters for special purposes.\n #   For example, the percent sign % is for comments.\n@@ -360,24 +381,68 @@\n #   receiving a tilde accent).\n # Similarly, to get a text body font circumflex use \\^{}.\n #   To get a backslash in the font of the text body enter \\textbackslash{}.\n-whack_math <-\n+whack_math <- if (TRUE) {\n   function(v) {\n     v <- as.character(v)\n+    w <- v\n     w <- gsub("\\\\", "\\\\textbackslash ", v, fixed = TRUE)\n     w <- Reduce(\n           f = function(l, r) {\n-            gsub(r, paste0("\\\\", r), l, fixed = TRUE)\n+            ptrn <- paste0("\\\\", r)\n+            for (i in seq_along(l)) {\n+              if (!grepl(ptrn, l[i], fixed = TRUE)) {\n+                l[i] <- gsub(r, ptrn, l[i], fixed = TRUE)\n+              }\n+            }\n+            l\n           },\n           x = c("#", "$", "%", "&", "{", "}", "_"),\n           init = w\n         )\n     w <- gsub("^", "\\\\^{}", w, fixed = TRUE)\n+    w <- gsub("\\\\textbackslash \\\\_", "\\\\_", w, fixed = TRUE)\n+    return(w)\n+  }\n+} else {\n+  function(v) {\n+    v <- as.character(v)\n+    w <- v\n+    w <- gsub("\\\\", "\\\\textbackslash ", v, fixed = TRUE)\n+    w <- Reduce(\n+          f = f'..b'rt_row_names <- short_row_names[good_rows]\n-    #ACE local_long_row_names  <- long_row_names[good_rows]\n-    #ACE local_enriched_intensities <- enriched_intensities[local_long_row_names, ]\n-\n     # Draw the heading and heatmap\n     nrow_m <- nrow(m)\n     if (nrow_m > 0) {\n@@ -6098,7 +6240,7 @@\n       is_na_m <- is.na(m)\n       cellnote_m <- is_na_m\n       cellnote_m[!is_na_m] <- ""\n-      cellnote_m[is_na_m] <- "NA"\n+      cellnote_m[is_na_m] <- params$heatMapNAcellNote\n       cut_args <- new_env()\n       cut_args$cutoff <- cutoff\n       cut_args$kinase <- kinase_name\n@@ -6110,8 +6252,9 @@\n           cellnote                = cellnote_m,\n           cutoff                  = cut_args,\n           hm_heading_function     = cat_enriched_heading,\n-          hm_main_title\n-            = "Unnormalized (zero-imputed) intensities of enriched kinase-substrates",\n+          hm_main_title           = paste(\n+            "Unnormalized (zero-imputed)",\n+            "intensities of enriched kinase-substrates"),\n           suppress_row_dendrogram = FALSE,\n           master_cex              = 0.35,\n           sepcolor                = "black",\n@@ -6123,7 +6266,11 @@\n           tryCatch(\n             {\n               rownames(m) <- short_row_names\n-              cov_heatmap(m, nrow_m > g_intensity_hm_rows)\n+              cov_heatmap(\n+                m = m,\n+                kinase_name = kinase_name,\n+                top_substrates = nrow_m > g_intensity_hm_rows\n+                )\n             },\n             error = function(e) {\n                 cat(\n@@ -6162,7 +6309,7 @@\n         cat("\\n\\\\newpage\\n")\n       cat(subsubsection_header(\n         sprintf(\n-          "Details for %s%s-substrates",\n+          "Details for %s%s-sites",\n           if (excess_substrates)\n             sprintf(\n               "%s \\"highest quality\\" ",\n@@ -6190,7 +6337,7 @@\n \n   if (print_nb_messages) nb("kinase_ppep_label <- ...\\n")\n   if (print_nb_messages) nbe("kinase_ppep_label <- ...\\n")\n-  kinase_ppep_label <- sqldf("\n+  kinase_ppep_label <- sqldf::sqldf("\n     WITH\n       t(ppep, label) AS\n         (\n@@ -6230,14 +6377,15 @@\n     WHERE\n       f.Phosphopeptide = q.Phosphopeptide\n     "\n-  data_table_imputed <- sqldf(data_table_imputed_sql)\n+  data_table_imputed <- sqldf::sqldf(data_table_imputed_sql)\n   # Zap the duplicated \'Phosphopeptide\' column named \'ppep\'\n   data_table_imputed <-\n       data_table_imputed[, c(1:12, 14:ncol(data_table_imputed))]\n \n   # Output imputed, un-normalized data\n   if (print_nb_messages) nb("Output imputed, un-normalized data tabular file\\n")\n-  if (print_nb_messages) nbe("Output imputed, un-normalized data tabular file\\n")\n+  if (print_nb_messages) nbe(\n+    "Output imputed, un-normalized data tabular file\\n")\n   write.table(\n       data_table_imputed\n     , file = imputed_data_filename\n@@ -6251,7 +6399,7 @@\n   #output quantile normalized data\n   impish <- cbind(rownames(quant_data_imp_qn_log), quant_data_imp_qn_log)\n   colnames(impish)[1] <- "Phosphopeptide"\n-  data_table_imputed <- sqldf(data_table_imputed_sql)\n+  data_table_imputed <- sqldf::sqldf(data_table_imputed_sql)\n   # Zap the duplicated \'Phosphopeptide\' column named \'ppep\'\n   data_table_imputed <-\n       data_table_imputed[, c(1:12, 14:ncol(data_table_imputed))]\n@@ -6266,7 +6414,7 @@\n     quote = FALSE\n   )\n \n-  ppep_kinase <- sqldf("\n+  ppep_kinase <- sqldf::sqldf("\n     SELECT DISTINCT k.ppep, k.kinase\n       FROM (\n         SELECT DISTINCT gene AS kinase, SUB_MOD_RSD AS ppep\n@@ -6314,8 +6462,11 @@\n     "\n   )\n \n-if (print_nb_messages) nb("Output contents of `stats_metadata_v` table to tabular file\\n")\n-if (print_nb_messages) nbe("Output contents of `stats_metadata_v` table to tabular file\\n")\n+if (print_nb_messages) nb(\n+   "Output contents of `stats_metadata_v` table to tabular file\\n")\n+if (print_nb_messages) nbe(\n+   "Output contents of `stats_metadata_v` table to tabular file\\n")\n+\n write.table(\n   dbReadTable(db, "stats_metadata_v"),\n   file = anova_ksea_mtdt_file,\n'