Mercurial > repos > lecorguille > ipo
comparison ipo4xcmsSet.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 # ----- PROCESSING INFILE ----- | 25 # ----- PROCESSING INFILE ----- |
| 25 cat("\tARGUMENTS PROCESSING INFO\n") | 26 cat("\tARGUMENTS PROCESSING INFO\n") |
| 26 options(bitmapType='cairo') | 27 options(bitmapType = "cairo") |
| 27 | 28 |
| 28 samplebyclass = 2 | 29 samplebyclass <- 2 |
| 29 if (!is.null(args$samplebyclass)){ | 30 if (!is.null(args$samplebyclass)) { |
| 30 samplebyclass = args$samplebyclass; args$samplebyclass=NULL | 31 samplebyclass <- args$samplebyclass |
| 32 args$samplebyclass <- NULL | |
| 31 } | 33 } |
| 32 | 34 |
| 33 # ----- INFILE PROCESSING ----- | 35 # ----- INFILE PROCESSING ----- |
| 34 cat("\tINFILE PROCESSING INFO\n") | 36 cat("\tINFILE PROCESSING INFO\n") |
| 35 | 37 |
| 36 # Handle infiles | 38 # Handle infiles |
| 37 if (!exists("singlefile")) singlefile <- NULL | 39 if (!exists("singlefile")) singlefile <- NULL |
| 38 rawFilePath <- getRawfilePathFromArguments(singlefile, NULL, args) | 40 rawFilePath <- getRawfilePathFromArguments(singlefile, NULL, args) |
| 39 singlefile <- rawFilePath$singlefile | 41 singlefile <- rawFilePath$singlefile |
| 40 directory <- retrieveRawfileInTheWorkingDirectory(singlefile, NULL) | 42 directory <- retrieveRawfileInWD(singlefile, NULL) |
| 41 | 43 |
| 42 # Check some character issues | 44 # Check some character issues |
| 43 checkXmlStructure(directory) | 45 checkXmlStructure(directory) |
| 44 | 46 |
| 45 cat("\n\n") | 47 cat("\n\n") |
| 49 | 51 |
| 50 # ----- MAIN PROCESSING INFO ----- | 52 # ----- MAIN PROCESSING INFO ----- |
| 51 cat("\tMAIN PROCESSING INFO\n") | 53 cat("\tMAIN PROCESSING INFO\n") |
| 52 | 54 |
| 53 | 55 |
| 54 xset = ipo4xcmsSet(directory, "IPO_parameters4xcmsSet.tsv", args, samplebyclass) | 56 xset <- ipo4xcmsSet(directory, "IPO_parameters4xcmsSet.tsv", args, samplebyclass) |
| 55 | 57 |
| 56 | 58 |
| 57 | 59 |
| 58 cat("\n\n") | 60 cat("\n\n") |
| 59 | 61 |
| 60 | 62 |
| 61 # ----- EXPORT ----- | 63 # ----- EXPORT ----- |
| 62 | 64 |
| 63 cat("\tXSET OBJECT INFO\n") | 65 cat("\tXSET OBJECT INFO\n") |
| 64 print(xset) | 66 print(xset) |
| 65 #delete the parameters to avoid the passage to the next tool in .RData image | 67 # delete the parameters to avoid the passage to the next tool in .RData image |
| 66 | 68 |
| 67 | 69 |
| 68 #saving R data in .Rdata file to save the variables used in the present tool | 70 # saving R data in .Rdata file to save the variables used in the present tool |
| 69 objects2save = c("xset", "singlefile") | 71 objects2save <- c("xset", "singlefile") |
| 70 save(list=objects2save[objects2save %in% ls()], file="ipo4xcmsSet.RData") | 72 save(list = objects2save[objects2save %in% ls()], file = "ipo4xcmsSet.RData") |
| 71 | 73 |
| 72 cat("\n\n") | 74 cat("\n\n") |
| 73 | 75 |
| 74 | 76 |
| 75 cat("\tDONE\n") | 77 cat("\tDONE\n") |
| 76 |
