Mercurial > repos > marie-tremblay-metatoul > normalization
annotate NmrNormalization_wrapper.R @ 3:966fcf7ae66e draft
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
author | lecorguille |
---|---|
date | Thu, 26 Oct 2017 06:01:14 -0400 |
parents | |
children |
rev | line source |
---|---|
3
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
2 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
3 ## 070115_NmrBucketing2galaxy_v1.R |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
4 ## Marie Tremblay-Franco |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
5 ## MetaboHUB: The French Infrastructure for Metabolomics and Fluxomics |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
6 ## www.metabohub.fr/en |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
7 ## marie.tremblay-franco@toulouse.inra.fr |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
8 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
9 runExampleL <- FALSE |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
10 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
11 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
12 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
13 ## Options |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
14 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
15 strAsFacL <- options()$stringsAsFactors |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
16 options(stringsAsFactors = FALSE) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
17 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
18 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
19 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
20 ## Libraries laoding |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
21 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
22 # For parseCommandArgs function |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
23 library(batch) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
24 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
25 # R script call |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
26 source_local <- function(fname) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
27 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
28 argv <- commandArgs(trailingOnly = FALSE) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
29 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
30 source(paste(base_dir, fname, sep="/")) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
31 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
32 #Import the different functions |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
33 source_local("NmrNormalization_script.R") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
34 source_local("DrawSpec.R") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
35 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
36 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
37 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
38 ## Errors ????????????????????? |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
39 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
40 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
41 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
42 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
43 ## Constants |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
44 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
45 topEnvC <- environment() |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
46 flagC <- "\n" |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
47 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
48 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
49 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
50 ## Script |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
51 ##------------------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
52 if(!runExampleL) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
53 argLs <- parseCommandArgs(evaluate=FALSE) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
54 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
55 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
56 ## Parameters Loading |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
57 ##------------------- |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
58 # Inputs |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
59 data <- read.table(argLs[["dataMatrix"]],check.names=FALSE,header=TRUE,sep="\t") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
60 rownames(data) <- data[,1] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
61 data <- data[,-1] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
62 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
63 scaling <- argLs[["scalingMethod"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
64 graphique <- argLs[["graphType"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
65 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
66 if (scaling=='PQN') |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
67 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
68 metadataSample <- read.table(argLs[["sampleMetadata"]],check.names=FALSE,header=TRUE,sep="\t") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
69 factor<- argLs[["factor"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
70 ControlGroup <- argLs[["controlGroup"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
71 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
72 if (scaling=='QuantitativeVariable') |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
73 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
74 metadataSample <- read.table(argLs[["sampleMetadata"]],check.names=FALSE,header=TRUE,sep="\t") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
75 factor <- argLs[["factor"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
76 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
77 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
78 # Outputs |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
79 nomGraphe <- argLs[["graphOut"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
80 dataMatrixOut <- argLs[["dataMatrixOut"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
81 log <- argLs[["logOut"]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
82 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
83 ## Checking arguments |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
84 ##------------------- |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
85 error.stock <- "\n" |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
86 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
87 if(length(error.stock) > 1) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
88 stop(error.stock) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
89 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
90 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
91 ## Computation |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
92 ##------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
93 NormalizationResults <- NmrNormalization(dataMatrix=data,scalingMethod=scaling,sampleMetadata=metadataSample, |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
94 bioFactor=factor,ControlGroup=ControlGroup, |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
95 graph=graphique,nomFichier=nomGraphe,savLog.txtC=log) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
96 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
97 data_normalized <- NormalizationResults[[1]] |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
98 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
99 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
100 ## Graphical outputs |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
101 ##------------------ |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
102 if (graphique != "None") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
103 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
104 # Graphic Device opening |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
105 pdf(nomGraphe,onefile=TRUE) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
106 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
107 if (graphique == "Overlay") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
108 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
109 # Global spectral window |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
110 spectra <- data.frame(t(data_normalized)) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
111 drawSpec(spectra,xlab="", ylab="Intensity", main="") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
112 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
113 else |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
114 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
115 for (i in 1:ncol(data_normalized)) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
116 { |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
117 spectra <- t(data_normalized[,i]) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
118 drawSpec(spectra,xlab="", ylab="Intensity", main=colnames(data_normalized)[i]) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
119 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
120 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
121 dev.off() |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
122 } |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
123 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
124 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
125 ## Saving |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
126 ##------- |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
127 # Data |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
128 data_normalized <- cbind(rownames(data_normalized),data_normalized) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
129 colnames(data_normalized) <- c("Bucket",colnames(data_normalized)[-1]) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
130 write.table(data_normalized,file=argLs$dataMatrixOut,quote=FALSE,row.names=FALSE,sep="\t") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
131 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
132 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
133 ## Ending |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
134 ##--------------------- |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
135 cat("\nEnd of 'Normalization' Galaxy module call: ", as.character(Sys.time()), sep = "") |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
136 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
137 options(stringsAsFactors = strAsFacL) |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
138 |
966fcf7ae66e
planemo upload for repository https://github.com/workflow4metabolomics/normalization commit 9ca88a22e9b9394bfa00ea383fbb2b78ef05f990
lecorguille
parents:
diff
changeset
|
139 rm(list = ls()) |