diff GalFilter/filter_wrap.R @ 3:cfd7c4aa5c26 draft default tip

Uploaded
author melpetera
date Fri, 03 Jan 2020 04:09:28 -0500
parents 2c9afaf849ad
children
line wrap: on
line diff
--- a/GalFilter/filter_wrap.R	Tue Jun 27 05:57:04 2017 -0400
+++ b/GalFilter/filter_wrap.R	Fri Jan 03 04:09:28 2020 -0500
@@ -10,6 +10,7 @@
 # V-1: Restriction of old filter wrapper to Filter according to factors                        #
 # V-1.1: Modification to allow the choice of meta-data table for filtering                     #
 # V-2: Addition of numerical filter                                                            #
+# V-2.5: -h option + additional information in stdout                                          #
 #                                                                                              #
 #                                                                                              #
 # Input files: dataMatrix.txt ; sampleMetadata.txt ; variableMetadata.txt                      #
@@ -19,6 +20,23 @@
 
 
 library(batch) #necessary for parseCommandArgs function
+
+# Constants
+argv <- commandArgs(trailingOnly = FALSE)
+script.path <- sub("--file=","",argv[grep("--file=",argv)])
+prog.name <- basename(script.path)
+
+# Help
+if (length(grep('-h', argv)) >0) {
+	cat("Usage:", prog.name,
+      "dataMatrix_in myDataMatrix.tsv",
+      "sampleMetadata_in mySampleMetadata.tsv",
+      "variableMetadata_in myVariableMetadata.tsv",
+      "...",
+		"\n")
+	quit(status = 0)
+}
+
 args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
 
 source_local <- function(...){
@@ -32,6 +50,14 @@
 
 if(length(args) < 8){ stop("NOT enough argument !!!") }
 
+
+cat('\nJob starting time:\n',format(Sys.time(), "%a %d %b %Y %X"),
+'\n\n--------------------------------------------------------------------', 
+'\nParameters used in "Generic Filter":\n\n')
+print(args)
+cat('--------------------------------------------------------------------\n\n')
+
+
 list_num <- NULL
 if(!is.null(args$parm_col)){
 	for( i in which(names(args)=="num_file") ){
@@ -59,5 +85,13 @@
 #        NUM, ls.num, FACT, ls.fact,
 #        ion.file.out, meta.samp.file.out, meta.ion.file.out)
 
+
+cat('\n--------------------------------------------------------------------',
+'\nInformation about R (version, Operating System, attached or loaded packages):\n\n')
+sessionInfo()
+cat('--------------------------------------------------------------------\n',
+'\nJob ending time:\n',format(Sys.time(), "%a %d %b %Y %X"))
+
+
 #delete the parameters to avoid the passage to the next tool in .RData image
 rm(args)