annotate xcms_merge.r @ 11:67ab853b89f3 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
author lecorguille
date Tue, 03 Apr 2018 11:38:21 -0400
parents 47e953d9da82
children 9efcd7620cde
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
1 #!/usr/bin/env Rscript
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
2
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
3 #Import the different functions
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
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="/")) }
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
5 source_local("lib.r")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
6
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
7 pkgs <- c("xcms","batch")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
8 loadAndDisplayPackages(pkgs)
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
9 cat("\n\n");
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
10
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
11 args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
12
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
13
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
14 cat("\tXSET MERGING...\n")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
15
11
67ab853b89f3 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 10
diff changeset
16 mergeXDataReturn <- mergeXData(args)
67ab853b89f3 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 10
diff changeset
17 xdata <- mergeXDataReturn$xdata
67ab853b89f3 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 10
diff changeset
18 singlefile <- mergeXDataReturn$singlefile
67ab853b89f3 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 10
diff changeset
19 md5sumList <- mergeXDataReturn$md5sumList
67ab853b89f3 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 10
diff changeset
20 sampleNamesList <- mergeXDataReturn$sampleNamesList
8
6b5504f877ff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 7
diff changeset
21
6b5504f877ff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 7
diff changeset
22 # Create a sampleMetada file
6b5504f877ff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 7
diff changeset
23 sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv")
6b5504f877ff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 7
diff changeset
24
6b5504f877ff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 7
diff changeset
25 cat("\n\n")
7
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
26
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
27 cat("\tXCMSnExp OBJECT INFO\n")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
28 print(pData(xdata))
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
29 print(xdata)
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
30 cat("\n\n")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
31
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
32 cat("\txcmsSet OBJECT INFO\n")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
33 # Get the legacy xcmsSet object
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
34 xset <- getxcmsSetObject(xdata)
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
35 print(xset@phenoData)
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
36 print(xset)
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
37 cat("\n\n")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
38
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
39 cat("\tSAVE RData\n")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
40 #saving R data in .Rdata file to save the variables used in the present tool
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
41 objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList")
dca722aecb67 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
42 save(list=objects2save[objects2save %in% ls()], file="merged.RData")