Mercurial > repos > marie-tremblay-metatoul > nmr_bucketing
annotate NmrBucketing_script.R @ 4:d61f6ceef5d6 draft
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
author | lecorguille |
---|---|
date | Tue, 22 Nov 2016 05:22:03 -0500 |
parents | 58679e85745f |
children |
rev | line source |
---|---|
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
1 ################################################################################################ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
2 # SPECTRA BUCKETING AND INTEGRATION FROM RAW BRUKER FILES # |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
3 # User : Galaxy # |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
4 # Original data : -- # |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
5 # Starting date : 20-10-2014 # |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
6 # Version 1 : 18-12-2014 # |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
7 # Version 2 : 07-01-2015 # |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
8 # Version 3 : 24-10-2016 # |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
9 # # |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
10 # Input files : modification on october 2016 # |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
11 # - Raw bruker files included in user-defined fileName # |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
12 # - Preprocessed files (alignment, ...) included in p x n dataframe # |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
13 ################################################################################################ |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
14 NmrBucketing <- function(fileType,fileName,leftBorder = 10.0,rightBorder = 0.5,bucketSize = 0.04,exclusionZones, |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
15 exclusionZonesBorders=NULL,graph=c("None","Overlay","One_per_individual"), |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
16 nomFichier,savLog.txtC = NULL) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
17 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
18 ## Option |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
19 ##--------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
20 strAsFacL <- options()$stringsAsFactors |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
21 options(stingsAsFactors = FALSE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
22 options(warn = -1) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
23 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
24 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
25 ## Constants |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
26 ##--------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
27 topEnvC <- environment() |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
28 flgC <- "\n" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
29 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
30 ## Log file (in case of integration into Galaxy) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
31 ##---------------------------------------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
32 if(!is.null(savLog.txtC)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
33 sink(savLog.txtC, append = TRUE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
34 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
35 ## Functions definition |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
36 ##--------------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
37 ## RAW BRUKER FILE READING FUNCTION |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
38 NmRBrucker_read <- function(DataDir,SampleSpectrum) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
39 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
40 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
41 bruker.get_param <- function (ACQ,paramStr) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
42 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
43 regexpStr <- paste("^...",paramStr,"=",sep="") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
44 as.numeric(gsub("^[^=]+= ","" ,ACQ[which(simplify2array(regexpr(regexpStr,ACQ))>0)])) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
45 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
46 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
47 ACQFILE <- "acqus" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
48 SPECFILE <- paste(DataDir,"/1r",sep="") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
49 PROCFILE <- paste(DataDir,"/procs",sep="") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
50 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
51 ACQ <- readLines(ACQFILE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
52 TD <- bruker.get_param(ACQ,"TD") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
53 SW <- bruker.get_param(ACQ,"SW") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
54 SWH <- bruker.get_param(ACQ,"SW_h") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
55 DTYPA <- bruker.get_param(ACQ,"DTYPA") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
56 BYTORDA <- bruker.get_param(ACQ,"BYTORDA") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
57 #ENDIAN = ifelse( BYTORDA==0, "little", "big") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
58 ENDIAN <- "little" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
59 SIZE = ifelse( DTYPA==0, 4, 8) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
60 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
61 PROC <- readLines(PROCFILE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
62 OFFSET <- bruker.get_param(PROC,"OFFSET") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
63 SI <- bruker.get_param(PROC,"SI") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
64 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
65 to.read = file(SPECFILE,"rb") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
66 maxTDSI = max(TD,SI) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
67 # signal<-rev(readBin(to.read, what="int",size=SIZE, n=TD, signed = TRUE, endian = ENDIAN)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
68 signal<-rev(readBin(to.read, what="int",size=SIZE, n=maxTDSI, signed = TRUE, endian = ENDIAN)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
69 close(to.read) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
70 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
71 td <- length(signal) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
72 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
73 # dppm <- SW/(TD-1) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
74 dppm <- SW/(td-1) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
75 pmax <- OFFSET |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
76 pmin <- OFFSET - SW |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
77 ppmseq <- seq(from=pmin, to=pmax, by=dppm) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
78 signal <- 100*signal/max(signal) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
79 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
80 SampleSpectrum <- cbind(ppmseq,signal) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
81 return(SampleSpectrum) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
82 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
83 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
84 ## SPECTRUM BUCKETING |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
85 NmrBrucker_bucket <- function(spectrum) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
86 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
87 # Initialisations |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
88 b <- 1 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
89 j <- 1 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
90 # Variable number |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
91 J <- round((spectrum[1,1]-spectrum[dim(spectrum)[1],1])/bucketSize) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
92 f.bucket <- matrix(rep(0,J*2),ncol=2) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
93 colnames(f.bucket) <- c("Bucket",FileNames[i]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
94 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
95 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
96 # Data bucketing |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
97 while (j < dim(spectrum)[1]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
98 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
99 # chemical shift |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
100 BUB <- spectrum[j,1] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
101 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
102 # In zone exclusion? |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
103 exclusion.in <- FALSE |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
104 if (!is.null(exclusionZonesBorders)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
105 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
106 for (k in 1:nrow(exclusion.zone.m)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
107 if (BUB <= exclusion.zone.m[k,1] && exclusion.zone.m[k,2] < BUB) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
108 exclusion.in <- TRUE |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
109 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
110 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
111 if (exclusion.in) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
112 j <- j + 1 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
113 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
114 if (!exclusion.in) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
115 # Bucketing |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
116 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
117 BLB <- BUB - bucketSize |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
118 bucket <- spectrum[j,] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
119 while (j < dim(spectrum)[1] && spectrum[j,1] > BLB) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
120 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
121 j <- j + 1 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
122 if (spectrum[j,1] > BLB) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
123 bucket <- rbind(bucket,spectrum[j,]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
124 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
125 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
126 # Integration (trapezoid method) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
127 s <- cumtrapz(bucket[,1],bucket[,2]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
128 f.bucket[b,] <- c(round(mean(bucket[,1]),3),abs(s[length(s)][[1]])) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
129 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
130 # Next bucket boundary |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
131 BUB <- spectrum[j,1] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
132 b <- b + 1 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
133 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
134 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
135 return(f.bucket) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
136 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
137 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
138 # Exclusion zones |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
139 if (!is.null(exclusionZonesBorders)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
140 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
141 exclusion.zone.m <- matrix(exclusionZonesBorders[[1]],nrow=1) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
142 if (length(exclusionZonesBorders) > 1) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
143 for (k in 2:length(exclusionZonesBorders)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
144 exclusion.zone.m <- rbind(exclusion.zone.m,exclusionZonesBorders[[k]]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
145 } |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
146 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
147 ## CHANGES |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
148 ## Inputs from zip or library (raw files) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
149 if (fileType == "zip") |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
150 { |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
151 # File names |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
152 FileNames <- list.files(fileName) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
153 n <- length(FileNames) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
154 |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
155 # Reading and Bucketing |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
156 fileName <- paste(fileName,"/",sep="") |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
157 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
158 i <- 1 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
159 while (i <= n) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
160 { |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
161 # File reading |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
162 SampleDir <- paste(fileName,FileNames[i],"/1/",sep="") |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
163 setwd(SampleDir) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
164 DataDir <- "pdata/1" |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
165 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
166 rawSpectrum <- NmRBrucker_read(DataDir,rawSpectrum) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
167 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
168 orderedSpectrum <- rawSpectrum[order(rawSpectrum[,1],decreasing=T), ] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
169 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
170 # Removal of chemical shifts > leftBorder or < rightBorder boundaries |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
171 truncatedSpectrum <- orderedSpectrum[orderedSpectrum[,1] < leftBorder & orderedSpectrum[,1] > rightBorder, ] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
172 truncatedSpectrum[,1] <- round(truncatedSpectrum[,1],3) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
173 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
174 # Bucketing |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
175 spectrum.bucket <- NmrBrucker_bucket(truncatedSpectrum) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
176 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
177 # spectrum Concatenation |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
178 if (i == 1) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
179 bucketedSpectra <- spectrum.bucket |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
180 if (i > 1) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
181 bucketedSpectra <- cbind(bucketedSpectra,spectrum.bucket[,2]) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
182 colnames(bucketedSpectra)[i+1] <- FileNames[i] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
183 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
184 # Next sample |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
185 rm(spectrum.bucket) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
186 i <- i +1 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
187 } |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
188 # Directory |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
189 cd(fileName) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
190 } |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
191 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
192 ## Inputs from dataset (preprocessed files) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
193 if (fileType=="tsv") |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
194 { |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
195 FileNames <- colnames(fileName) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
196 n <- length(FileNames) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
197 |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
198 for (i in 1:ncol(fileName)) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
199 { |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
200 orderedSpectrum <- cbind(as.numeric(rownames(fileName)),fileName[,i]) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
201 orderedSpectrum <- orderedSpectrum[order(orderedSpectrum[,1],decreasing=T), ] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
202 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
203 truncatedSpectrum <- orderedSpectrum[orderedSpectrum[,1] < leftBorder & orderedSpectrum[,1] > rightBorder, ] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
204 truncatedSpectrum[,1] <- round(truncatedSpectrum[,1],3) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
205 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
206 # Bucketing |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
207 spectrum.bucket <- NmrBrucker_bucket(truncatedSpectrum) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
208 |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
209 # spectrum Concatenation |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
210 if (i == 1) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
211 bucketedSpectra <- spectrum.bucket |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
212 if (i > 1) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
213 bucketedSpectra <- cbind(bucketedSpectra,spectrum.bucket[,2]) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
214 colnames(bucketedSpectra)[i+1] <- colnames(fileName)[i] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
215 } |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
216 } |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
3
diff
changeset
|
217 |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
218 identifiants <- gsub("([- , * { } | \\[ ])","_",colnames(bucketedSpectra)[-1]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
219 colnames(bucketedSpectra) <- c(colnames(bucketedSpectra)[1],identifiants) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
220 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
221 bucketedSpectra <- bucketedSpectra[bucketedSpectra[,1]!=0,] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
222 rownames(bucketedSpectra) <- paste("B",bucketedSpectra[,1],sep="") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
223 bucketedSpectra <- bucketedSpectra[,-1] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
224 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
225 # Metadata matrice outputs |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
226 sampleMetadata <- data.frame(1:n) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
227 rownames(sampleMetadata) <- colnames(bucketedSpectra) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
228 colnames(sampleMetadata) <- "SampleOrder" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
229 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
230 variableMetadata <- data.frame(1:nrow(bucketedSpectra)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
231 rownames(variableMetadata) <- rownames(bucketedSpectra) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
232 colnames(variableMetadata) <- "VariableOrder" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
233 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
234 # Bucketed spectra graph |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
235 if (graph != "None") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
236 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
237 # Graphic Device opening |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
238 pdf(nomFichier,onefile=TRUE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
239 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
240 if (graph == "Overlay") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
241 { |
3
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
242 x <- 1:length(bucketedSpectra[,1]) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
243 ymax <- max(bucketedSpectra) |
3
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
244 plot(x,bucketedSpectra[,1],ylim=c(0,ymax),type='l',col=1,xlab="",xaxt="n",ylab="Intensity") |
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
245 # x-axis labels |
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
246 axis(1, at=seq(1,length(x),by=50),labels=gsub("B","",rownames(bucketedSpectra)[seq(1,length(x),by=50)]), las=2) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
247 for (i in 2:ncol(bucketedSpectra)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
248 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
249 spectre <- bucketedSpectra[,i] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
250 lines(spectre,col=i) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
251 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
252 # legend(0,ymax,lty=c(1,1),legend=colnames(bucketedSpectra),col=1:ncol(bucketedSpectra)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
253 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
254 else |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
255 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
256 for (i in 1:ncol(bucketedSpectra)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
257 { |
3
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
258 x <- 1:length(bucketedSpectra[,1]) |
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
259 plot(x,bucketedSpectra[,i],type='l',col=1,xlab="",xaxt="n",ylab="Intensity") |
58679e85745f
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
lecorguille
parents:
2
diff
changeset
|
260 axis(1, at=seq(1,length(x),by=50),labels=gsub("B","",rownames(bucketedSpectra)[seq(1,length(x),by=50)]), las=2) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
261 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
262 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
263 dev.off() |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
264 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
265 return(list(bucketedSpectra,sampleMetadata,variableMetadata)) # ,truncatedSpectrum_matrice |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
266 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
267 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
268 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
269 ################################################################################################################# |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
270 ## Typical function call |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
271 ################################################################################################################# |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
272 ## StudyDir <- "K:/PROJETS/Metabohub/Bruker/Tlse_BPASourisCerveau/" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
273 ## upper <- 9.5 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
274 ## lower <- 0.8 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
275 ## bucket.width <- 0.01 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
276 ## exclusion <- TRUE |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
277 ## exclusion.zone <- list(c(5.1,4.5)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
278 ## graphique <- "Overlay" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
279 ## nomFichier <- "Tlse_BPASourisCerveau_NmrBucketing_graph.pdf" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
280 ## tlse_cerveaupnd21.bucket <- NmrBucketing(StudyDir,upper,lower,bucket.width,exclusion,exclusion.zone,graphique,nomFichier) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
281 ## write.table(tlse_cerveaupnd21.bucket,file=paste(StudyDir,"Tlse_BPASourisCerveau_NmrBucketing_dataMatrix.tsv",sep=""), |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
282 ## quote=FALSE,row.nmaes=FALSE,sep="\t") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
283 ################################################################################################################# |