comparison ipo4retgroup.r @ 10:57f180a8eaae draft default tip

planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
author workflow4metabolomics
date Mon, 11 Sep 2023 22:36:51 +0000
parents 364756ea5f42
children
comparison
equal deleted inserted replaced
9:364756ea5f42 10:57f180a8eaae
1 #!/usr/bin/env Rscript 1 #!/usr/bin/env Rscript
2 #Authors Gildas Le Corguille and Yann Guitton 2 # Authors Gildas Le Corguille and Yann Guitton
3 3
4 4
5 # ----- PACKAGE ----- 5 # ----- PACKAGE -----
6 cat("\tSESSION INFO\n") 6 cat("\tSESSION INFO\n")
7 7
8 #Import the different functions 8 # Import the different functions
9 source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } 9 source_local <- function(fname) {
10 argv <- commandArgs(trailingOnly = FALSE)
11 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
12 source(paste(base_dir, fname, sep = "/"))
13 }
10 source_local("lib.r") 14 source_local("lib.r")
11 15
12 pkgs <- c("IPO","batch") 16 pkgs <- c("IPO", "batch")
13 loadAndDisplayPackages(pkgs) 17 loadAndDisplayPackages(pkgs)
14 cat("\n\n"); 18 cat("\n\n")
15
16
17 # ----- ARGUMENTS ----- 19 # ----- ARGUMENTS -----
18 cat("\tARGUMENTS INFO\n") 20 cat("\tARGUMENTS INFO\n")
19 args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects 21 args <- parseCommandArgs(evaluate = FALSE) # interpretation of arguments given in command line as an R list of objects
20 write.table(as.matrix(args), col.names=F, quote=F, sep='\t') 22 write.table(as.matrix(args), col.names = FALSE, quote = FALSE, sep = "\t")
21 23
22 cat("\n\n"); 24 cat("\n\n")
23
24
25 # ----- PROCESSING INFILE ----- 25 # ----- PROCESSING INFILE -----
26 cat("\tARGUMENTS PROCESSING INFO\n") 26 cat("\tARGUMENTS PROCESSING INFO\n")
27 27
28 samplebyclass = 2 28 samplebyclass <- 2
29 if (!is.null(args$samplebyclass)){ 29 if (!is.null(args$samplebyclass)) {
30 samplebyclass = args$samplebyclass; args$samplebyclass=NULL 30 samplebyclass <- args$samplebyclass
31 args$samplebyclass <- NULL
31 } 32 }
32 33
33 cat("\n\n") 34 cat("\n\n")
34 35
35 # ----- INFILE PROCESSING ----- 36 # ----- INFILE PROCESSING -----
36 cat("\tINFILE PROCESSING INFO\n") 37 cat("\tINFILE PROCESSING INFO\n")
37 options(bitmapType='cairo') 38 options(bitmapType = "cairo")
38 39
39 #image is an .RData file necessary to use xset variable given by previous tools 40 # image is an .RData file necessary to use xset variable given by previous tools
40 load(args$image); args$image=NULL 41 load(args$image)
42 args$image <- NULL
41 43
42 # Because so far CAMERA isn't compatible with the new XCMSnExp object 44 # Because so far CAMERA isn't compatible with the new XCMSnExp object
43 if (exists("xdata")){ 45 if (exists("xdata")) {
44 xset <- getxcmsSetObject(xdata) 46 xset <- getxcmsSetObject(xdata)
45 } 47 }
46 48
47 if (!exists("xset")) stop("\n\nERROR: The RData doesn't contain any object called 'xdata' which is provided by the tool: MSnbase readMSData") 49 if (!exists("xset")) stop("\n\nERROR: The RData doesn't contain any object called 'xdata' which is provided by the tool: MSnbase readMSData")
48 50
49 51
50 # Handle infiles 52 # Handle infiles
51 if (!exists("singlefile")) singlefile <- NULL 53 if (!exists("singlefile")) singlefile <- NULL
52 rawFilePath <- getRawfilePathFromArguments(singlefile, NULL, args) 54 rawFilePath <- getRawfilePathFromArguments(singlefile, NULL, args)
53 singlefile <- rawFilePath$singlefile 55 singlefile <- rawFilePath$singlefile
54 print(singlefile) 56 print(singlefile)
55 directory <- retrieveRawfileInTheWorkingDirectory(singlefile, NULL) 57 directory <- retrieveRawfileInWD(singlefile, NULL)
56 58
57 59
58 cat("\n\n") 60 cat("\n\n")
59 61
60 62