Mercurial > repos > lecorguille > xcms_merge
annotate xcms_merge.r @ 7:a9d451591d7b draft
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 37b0a6a7686f701e4bf00db97ae2c1b82cd6e989
author | lecorguille |
---|---|
date | Fri, 09 Nov 2018 15:12:40 -0500 |
parents | f439ed7a8f03 |
children | a26679f68d4d |
rev | line source |
---|---|
3
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
2 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
3 #Import the different functions |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
4 source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
5 source_local("lib.r") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
6 source_local("lib-xcms3.x.x.r") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
7 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
8 pkgs <- c("xcms","batch") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
9 loadAndDisplayPackages(pkgs) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
10 cat("\n\n"); |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
11 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
12 args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
13 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
14 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
15 cat("\tXSET MERGING...\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
16 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
17 mergeXDataReturn <- mergeXData(args) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
18 xdata <- mergeXDataReturn$xdata |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
19 singlefile <- mergeXDataReturn$singlefile |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
20 md5sumList <- mergeXDataReturn$md5sumList |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
21 sampleNamesList <- mergeXDataReturn$sampleNamesList |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
22 chromTIC <- mergeXDataReturn$chromTIC |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
23 chromBPI <- mergeXDataReturn$chromBPI |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
24 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
25 # Create a sampleMetada file |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
26 sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
27 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
28 cat("\n\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
29 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
30 cat("\tXCMSnExp OBJECT INFO\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
31 print(pData(xdata)) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
32 print(xdata) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
33 cat("\n\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
34 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
35 cat("\txcmsSet OBJECT INFO\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
36 # Get the legacy xcmsSet object |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
37 xset <- getxcmsSetObject(xdata) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
38 print(xset@phenoData) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
39 print(xset) |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
40 cat("\n\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
41 |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
42 cat("\tSAVE RData\n") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
43 #saving R data in .Rdata file to save the variables used in the present tool |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
44 objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList", "chromTIC", "chromBPI") |
f439ed7a8f03
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
45 save(list=objects2save[objects2save %in% ls()], file="merged.RData") |