diff qualitymetrics_script.R @ 2:596320b84315 draft

planemo upload for repository https://github.com/workflow4metabolomics/qualitymetrics.git commit 95d4658e5d9dd0421c9336b2232cc81f32879621
author ethevenot
date Thu, 11 Jan 2018 12:52:08 -0500
parents 6d3b7b6573d8
children
line wrap: on
line diff
--- a/qualitymetrics_script.R	Fri Oct 21 12:56:22 2016 -0400
+++ b/qualitymetrics_script.R	Thu Jan 11 12:52:08 2018 -0500
@@ -488,7 +488,6 @@
         par(mar = marLs[["msd"]])
         plot(apply(datMN, 2, function(y) mean(y, na.rm = TRUE)),
              apply(datMN, 2, function(y) sd(y, na.rm = TRUE)),
-             col=obsColVc,
              pch = 18,
              xlab = "",
              ylab = "")
@@ -642,6 +641,8 @@
     ## Constants
     ##----------
 
+    modNamC <- "Quality Metrics" ## module name
+    
     epsN <- .Machine[["double.eps"]] ## [1] 2.22e-16
 
 
@@ -649,9 +650,40 @@
     ## Start
     ##------------------------------
 
-    if(!is.null(log.txtC))
+    if(!is.null(log.txtC)) {
+        
         sink(log.txtC)
+        
+        cat("\nStart of the '", modNamC, "' Galaxy module call: ",
+            format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
 
+    }
+
+    
+    ## Checking the numerical type of the dataMatrix
+    ##----------------------------------------------
+
+
+    if(mode(datMN) != "numeric") {
+        sink()
+        stop("dataMatrix is not of numeric type;\ncheck your tables with the Check Format module\n",
+             call. = FALSE)
+    }
+
+    
+    ## Re-ordering dataMatrix samples if need (internally only)
+    ##---------------------------------------------------------
+
+    
+    if(!identical(rownames(datMN), samDF[, 1])) {
+
+        cat("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   WARNING   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\nThe sample order is not identical in dataMatrix and sampleMetadata;\nRe-ordering of the dataMatrix samples will be performed internally in this module\nfor the computation of the metrics,\nwithout changing the orders in the sampleMetadata output;\n\nTo get a re-ordered dataMatrix as output, please use the Check Format module\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
+
+        datMN <- datMN[samDF[, 1], , drop = FALSE]
+        
+    }
+
+    
     ## Description
     ##------------
 
@@ -885,8 +917,28 @@
     ##------------------------------
 
 
-    if(!is.null(log.txtC))
+    if(!is.null(log.txtC)) {
+
+        cat("\nEnd of '", modNamC, "' Galaxy module call: ",
+            as.character(Sys.time()), "\n", sep = "")
+
+        cat("\n\n\n============================================================================")
+        cat("\nAdditional information about the call:\n")
+        cat("\n1) Parameters:\n")
+        print(args)
+
+        cat("\n2) Session Info:\n")
+        sessioninfo <- sessionInfo()
+        cat(sessioninfo$R.version$version.string,"\n")
+        cat("Main packages:\n")
+        for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
+        cat("Other loaded packages:\n")
+        for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")        
+
+        cat("============================================================================\n")
+        
         sink()
+    }
 
     options(stingsAsFactors = strAsFacL)
     options(warn = optWrnN)