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