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