annotate batch_correction_wrapper.R @ 1:f64656ae9ea4 draft

planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit b1f8bd1260c1c4b73600fb3867ca3bc613f258a7
author melpetera
date Sun, 09 Oct 2016 09:54:00 -0400
parents 71d83d8920bf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
1 #!/usr/bin/Rscript --vanilla --slave --no-site-file
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
2
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
3 ################################################################################################
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
4 # batch_correction_wrapper #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
5 # #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
6 # Author: Marion LANDI / Jean-Francois MARTIN / Melanie Petera #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
7 # User: Galaxy #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
8 # Original data: -- #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
9 # Starting date: 22-07-2014 #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
10 # Version 1: 22-07-2014 #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
11 # Version 2: 08-12-2014 #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
12 # Version 2.1: 09-01-2015 modification in Error message of sample matching #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
13 # Version 2.2: 16-03-2015 inclusion of miniTools' functions for special characters #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
14 # #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
15 # #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
16 # Input files: dataMatrix.txt ; sampleMetadata.txt ; variableMetadata.txt (for DBC) #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
17 # Output files: graph_output.pdf ; corrected table ; diagnostic table #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
18 # #
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
19 ################################################################################################
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
20
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
21
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
22 library(batch) #necessary for parseCommandArgs function
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
23 args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
24
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
25 source_local <- function(...){
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
26 argv <- commandArgs(trailingOnly = FALSE)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
27 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
28 for(i in 1:length(list(...))){source(paste(base_dir, list(...)[[i]], sep="/"))}
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
29 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
30 #Import the different functions
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
31 source_local("Normalisation_QCpool.r","easyrlibrary-lib/RcheckLibrary.R","easyrlibrary-lib/miniTools.R")
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
32
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
33
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
34 ## Reading of input files
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
35 idsample=read.table(args$sampleMetadata,header=T,sep='\t',check.names=FALSE)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
36 iddata=read.table(args$dataMatrix,header=T,sep='\t',check.names=FALSE)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
37
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
38 ### Table match check
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
39 table.check <- match2(iddata,idsample,"sample")
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
40
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
41 ### StockID
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
42 samp.id <- stockID(iddata,idsample,"sample")
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
43 iddata<-samp.id$dataMatrix ; idsample<-samp.id$Metadata ; samp.id<-samp.id$id.match
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
44
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
45 ### Checking mandatory variables
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
46 mand.check <- ""
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
47 for(mandcol in c("sampleType","injectionOrder","batch")){
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
48 if(!(mandcol%in%colnames(idsample))){
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
49 mand.check <- c(mand.check,"\nError: no '",mandcol,"' column in sample metadata.\n",
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
50 "Note: table must include this exact column name (it is case-sensitive).\n")
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
51 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
52 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
53 if(length(mand.check)>1){check.err(paste(table.check,mand.check,sep=""))}
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
54
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
55 ### Formating
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
56 idsample[[1]]=make.names(idsample[[1]])
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
57 dimnames(iddata)[[1]]=iddata[[1]]
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
58
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
59 ### Transposition of ions data
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
60 idTdata=t(iddata[,2:dim(iddata)[2]])
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
61 idTdata=data.frame(dimnames(idTdata)[[1]],idTdata)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
62
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
63 ### Merge of 2 files (ok even if the two dataframe are not sorted on the same key)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
64 id=merge(idsample, idTdata, by.x=1, by.y=1)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
65
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
66 id$batch=as.factor(id$batch)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
67 ids=id[id$sampleType == 'pool' | id$sampleType == 'sample',]
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
68 nbid=dim(idsample)[2]
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
69
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
70 ### Checking the number of sample and pool
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
71
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
72 # least 2 samples
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
73 if(length(which(ids$sampleType == "sample"))<2){
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
74 table.check <- c(table.check,"\nError: less than 2 samples specified in sample metadata.",
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
75 "\nMake sure this is not due to errors in sampleType coding.\n")
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
76 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
77
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
78 # least 2 pools per batch for all batchs
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
79 B <- rep(0,length(levels(ids$batch)))
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
80 for(nbB in length(levels(ids$batch))){
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
81 B[nbB]<-length(which(ids[which(ids$batch==(levels(ids$batch)[nbB])),]$sampleType == "pool"))
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
82 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
83 if(length(which(B>1))==0){
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
84 table.check <- c(table.check,"\nError: less than 2 pools specified in each batch in sample metadata.",
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
85 "\nMake sure this is not due to errors in sampleType coding.\n")
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
86 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
87
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
88 ### Factor of interest
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
89 factbio=args$ref_factor
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
90
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
91
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
92 if(args$analyse == "batch_correction") {
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
93 ## Reading of Metadata Ions file
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
94 metaion=read.table(args$variableMetadata,header=T,sep='\t',check.names=FALSE)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
95 ## Table match check
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
96 table.check <- c(table.check,match2(iddata,metaion,"variable"))
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
97 check.err(table.check)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
98
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
99 ## variables
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
100 detail=args$detail
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
101 method=args$method
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
102
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
103 ## outputs
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
104 outfic=args$variable_for_simca
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
105 outlog=args$graph_output
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
106
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
107 ## Launch
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
108 res = norm_QCpool(ids,nbid,outfic,outlog,factbio,metaion,detail,F,F,method,args$span)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
109 save(res, file=args$rdata_output)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
110 write.table(reproduceID(res[[1]],res[[3]],"sample",samp.id)$dataMatrix, file=args$dataMatrix_out, sep = '\t', row.names=F, quote=F)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
111 write.table(res[[2]], file=args$variableMetadata_out, sep = '\t', row.names=F, quote=F)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
112 }else{
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
113 ## error check
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
114 check.err(table.check)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
115
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
116 ## outputs
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
117 out_graph_pdf=args$out_graph_pdf
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
118 out_preNormSummary=args$out_preNormSummary
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
119
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
120 ## Launch
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
121 plotsituation(ids,nbid,out_graph_pdf,out_preNormSummary,factbio,args$span)
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
122 }
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
123
71d83d8920bf planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
melpetera
parents:
diff changeset
124 rm(args)