Mercurial > repos > lecorguille > xcms_export_samplemetadata
comparison xcms_export_samplemetadata.r @ 0:e3c06320f884 draft
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 67da3bb19bde72d5e78397e5627c176896234f86
author | lecorguille |
---|---|
date | Tue, 09 Oct 2018 12:50:47 -0400 |
parents | |
children | 008aceb33627 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e3c06320f884 |
---|---|
1 #!/usr/bin/env Rscript | |
2 | |
3 #Import the different functions | |
4 source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } | |
5 source_local("lib.r") | |
6 source_local("lib-xcms3.x.x.r") | |
7 | |
8 pkgs <- c("xcms","batch") | |
9 loadAndDisplayPackages(pkgs) | |
10 cat("\n\n"); | |
11 | |
12 args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects | |
13 | |
14 | |
15 sampleMetadata <- NULL | |
16 for(image in args$images) { | |
17 load(image) | |
18 if (is.null(sampleMetadata)) | |
19 sampleMetadata <- xdata@phenoData@data | |
20 else | |
21 sampleMetadata <- rbind(sampleMetadata,xdata@phenoData@data) | |
22 } | |
23 colnames(sampleMetadata) <- c("sample_name","class") | |
24 sampleMetadata$sample_name <- make.names(sampleNamesOrigin) | |
25 | |
26 # Create a sampleMetada file | |
27 write.table(sampleMetadata,file="sampleMetadata.tsv", sep="\t", row.names=FALSE, quote=FALSE) |