Mercurial > repos > marie-tremblay-metatoul > 2dnmrannotation
annotate annotationRmn2DGlobale.R @ 3:546c7ccd2ed4 draft default tip
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
author | workflow4metabolomics |
---|---|
date | Fri, 04 Feb 2022 09:01:11 +0000 |
parents | dff7bde22102 |
children |
rev | line source |
---|---|
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
1 ################################################################################################### |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
2 # ANNOTATION SPECTRE 2D MATRICE COMPLEXE BASEE SUR UNE (OU PLUSIEURS) SEQUENCE(s) # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
3 # template : dataframe contenant la liste des couples de deplacements chimiques de la matrice complexe a annoter # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
4 # cosy : 1 si sequence a utiliser / 0 sinon # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
5 # hmbc : 1 si sequence a utiliser / 0 sinon # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
6 # hsqc : 1 si sequence a utiliser / 0 sinon # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
7 # jres : 1 si sequence a utiliser / 0 sinon # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
8 # tocsy : 1 si sequence a utiliser / 0 sinon # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
9 # tolPpm1 : tolerance autorisee autour de la valeur1 du couple de deplacements chimiques # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
10 # tolPpm2HJRes : tolerance autorisee autour de la valeur2 du couple de deplacements chimiques si H dans dimension 2 # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
11 # tolPpm2C : tolerance autorisee autour de la valeur2 du couple de deplacements chimiques si C dans dimension 2 # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
12 # seuil : valeur du score de presence en dela de laquelle les metabolites annotes ne sont pas retenus # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
13 # unicite : boolean pour ne retenir que les ... # |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
14 ################################################################################################### |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
15 ## CALCUL MOYENNE SANS VALEUR(S) MANQUANTE(S) |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
16 mean.rmNa <- function(x) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
17 mean(x, na.rm = TRUE) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
18 } |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
19 |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
20 annotationRmn2DGlobale <- function(template, tolPpm1 = 0.01, tolPpm2HJRes = 0.002, tolPpm2C = 0.5, cosy = 1, hmbc = 1, hsqc = 1, jres = 1, tocsy = 1, seuil, unicite = "NO") { |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
21 ## Initialisation |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
22 options(max.print = 999999999) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
23 annotationCOSY <- data.frame() |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
24 annotationHMBC <- data.frame() |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
25 annotationHSQC <- data.frame() |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
26 annotationJRES <- data.frame() |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
27 annotationTOCSY <- data.frame() |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
28 |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
29 dataCOSY <- "NA" |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
30 dataHMBC <- "NA" |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
31 dataHSQC <- "NA" |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
32 dataJRES <- "NA" |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
33 dataTOCSY <- "NA" |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
34 |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
35 ## Application seuil seulement si annotation avec 1 seule sequence |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
36 seuilPls2D <- seuil |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
37 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
38 if (cosy == 1) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
39 matrice.cosy <- read.xlsx(template, sheet = "COSY", startRow = 2, colNames = TRUE, rowNames = FALSE, cols = 1:3, na.strings = "NA") |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
40 matrice.cosy <- matrice.cosy[matrice.cosy$peak.index != "x", ] |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
41 annotationCOSY <- annotationRmn2D(matrice.cosy, BdDReference_COSY, "COSY", ppm1Tol = tolPpm1, ppm2Tol = tolPpm1, seuil = seuilPls2D, unicite = unicite) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
42 dataCOSY <- data.frame(Metabolite = str_to_lower(annotationCOSY$liste_resultat$Metabolite), score.COSY = annotationCOSY$liste_resultat$score) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
43 dataCOSY <- unique.data.frame(dataCOSY) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
44 } |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
45 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
46 if (hmbc == 1) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
47 matrice.hmbc <- read.xlsx(template, sheet = "HMBC", startRow = 2, colNames = TRUE, rowNames = FALSE, cols = 1:3, na.strings = "NA") |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
48 matrice.hmbc <- matrice.hmbc[matrice.hmbc$peak.index != "x", ] |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
49 annotationHMBC <- annotationRmn2D(matrice.hmbc, BdDReference_HMBC, "HMBC", ppm1Tol = tolPpm1, ppm2Tol = tolPpm2C, seuil = seuilPls2D, unicite = unicite) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
50 dataHMBC <- data.frame(Metabolite = str_to_lower(annotationHMBC$liste_resultat$Metabolite), score.HMBC = annotationHMBC$liste_resultat$score) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
51 dataHMBC <- unique.data.frame(dataHMBC) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
52 } |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
53 |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
54 if (hsqc == 1) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
55 matrice.hsqc <- read.xlsx(template, sheet = "HSQC", startRow = 2, colNames = TRUE, rowNames = FALSE, cols = 1:3, na.strings = "NA") |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
56 matrice.hsqc <- matrice.hsqc[matrice.hsqc$peak.index != "x", ] |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
57 annotationHSQC <- annotationRmn2D(matrice.hsqc, BdDReference_HSQC, "HSQC", ppm1Tol = tolPpm1, ppm2Tol = tolPpm2C, seuil = seuilPls2D, unicite = unicite) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
58 dataHSQC <- data.frame(Metabolite = str_to_lower(annotationHSQC$liste_resultat$Metabolite), score.HSQC = annotationHSQC$liste_resultat$score) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
59 dataHSQC <- unique.data.frame(dataHSQC) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
60 } |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
61 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
62 if (jres == 1) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
63 matrice.jres <- read.xlsx(template, sheet = "JRES", startRow = 2, colNames = TRUE, rowNames = FALSE, cols = 1:3, na.strings = "NA") |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
64 matrice.jres <- matrice.jres[matrice.jres$peak.index != "x", ] |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
65 annotationJRES <- annotationRmn2D(matrice.jres, BdDReference_JRES, "JRES", ppm1Tol = tolPpm1, ppm2Tol = tolPpm2HJRes, seuil = seuilPls2D, unicite = unicite) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
66 dataJRES <- data.frame(Metabolite = str_to_lower(annotationJRES$liste_resultat$Metabolite), score.JRES = annotationJRES$liste_resultat$score) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
67 dataJRES <- unique.data.frame(dataJRES) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
68 } |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
69 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
70 if (tocsy == 1) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
71 matrice.tocsy <- read.xlsx(template, sheet = "TOCSY", startRow = 2, colNames = TRUE, rowNames = FALSE, cols = 1:3, na.strings = "NA") |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
72 matrice.tocsy <- matrice.tocsy[matrice.tocsy$peak.index != "x", ] |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
73 annotationTOCSY <- annotationRmn2D(matrice.tocsy, BdDReference_TOCSY, "TOCSY", ppm1Tol = tolPpm1, ppm2Tol = tolPpm1, seuil = seuilPls2D, unicite = unicite) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
74 dataTOCSY <- data.frame(Metabolite = str_to_lower(annotationTOCSY$liste_resultat$Metabolite), score.TOCSY = annotationTOCSY$liste_resultat$score) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
75 dataTOCSY <- unique.data.frame(dataTOCSY) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
76 } |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
77 |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
78 seqCombiMeanScoreSeuil <- data.frame() |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
79 seqCombiMeanScoreSeuilFiltre <- data.frame() |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
80 |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
81 ## CONCATENATION RESULTATS DIFFERENTES SEQUENCES |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
82 data2D <- list(dataCOSY, dataHMBC, dataHSQC, dataJRES, dataTOCSY) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
83 whichSequenceNaN <- which((data2D != "NA")) |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
84 data2D <- data2D[whichSequenceNaN] |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
85 sequencesCombination <- data.frame(data2D[1]) |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
86 seqCombiMeanScore <- sequencesCombination |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
87 |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
88 ## Si une seule sequence et seuil sur score = filtre applique dans la fonction annotationRmn2D |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
89 if (length(data2D) >= 2) { |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
90 ## CONCATENATION SCORE PAR SEQUENCE |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
91 for (l in 2:length(data2D)) |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
92 sequencesCombination <- merge.data.frame(sequencesCombination, data2D[l], by = "Metabolite", all.x = TRUE, all.y = TRUE) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
93 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
94 ## Replacement of NA values due to mis annotation |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
95 for (m in seq_len(nrow(sequencesCombination))) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
96 COSYcompound <- sort(names(BdDReference_COSY)) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
97 HMBCcompound <- sort(names(BdDReference_HMBC)) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
98 HSQCcompound <- sort(names(BdDReference_HSQC)) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
99 JREScompound <- sort(names(BdDReference_JRES)) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
100 TOCSYcompound <- sort(names(BdDReference_TOCSY)) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
101 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
102 if (is.na(sequencesCombination[m, 2])) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
103 compound <- as.character(sequencesCombination[m, 1]) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
104 for (c in seq_len(length(COSYcompound))) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
105 if (str_to_lower(compound) == str_to_lower(COSYcompound[c])) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
106 sequencesCombination[m, 2] <- 0 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
107 } |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
108 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
109 if (is.na(sequencesCombination[m, 3])) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
110 compound <- as.character(sequencesCombination[m, 1]) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
111 for (c in seq_len(length(HMBCcompound))) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
112 if (str_to_lower(compound) == str_to_lower(HMBCcompound[c])) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
113 sequencesCombination[m, 3] <- 0 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
114 } |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
115 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
116 if (is.na(sequencesCombination[m, 4])) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
117 compound <- as.character(sequencesCombination[m, 1]) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
118 for (c in seq_len(length(HSQCcompound))) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
119 if (str_to_lower(compound) == str_to_lower(HSQCcompound[c])) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
120 sequencesCombination[m, 4] <- 0 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
121 } |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
122 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
123 if (is.na(sequencesCombination[m, 5])) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
124 compound <- as.character(sequencesCombination[m, 1]) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
125 for (c in seq_len(length(JREScompound))) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
126 if (str_to_lower(compound) == str_to_lower(JREScompound[c])) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
127 sequencesCombination[m, 5] <- 0 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
128 } |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
129 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
130 if (is.na(sequencesCombination[m, 6])) { |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
131 compound <- as.character(sequencesCombination[m, 1]) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
132 for (c in seq_len(length(TOCSYcompound))) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
133 if (str_to_lower(compound) == str_to_lower(TOCSYcompound[c])) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
134 sequencesCombination[m, 6] <- 0 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
135 } |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
136 } |
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
137 |
3
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
138 ## SCORE MOYEN (sans prise en compte valeurs manquantes) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
139 meanScore <- round(apply(sequencesCombination[, -1], 1, FUN = mean.rmNa), 2) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
140 seqCombiMeanScore <- cbind.data.frame(sequencesCombination, averageScore = meanScore) |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
141 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
142 ## SUPPRESSION METABOLITE AVEC SCORE MOYEN < SEUIL |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
143 seqCombiMeanScoreSeuilFiltre <- seqCombiMeanScore[seqCombiMeanScore$averageScore > seuil, ] |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
144 } |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
145 |
546c7ccd2ed4
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents:
2
diff
changeset
|
146 return(list(COSY = annotationCOSY, HMBC = annotationHMBC, HSQC = annotationHSQC, JRES = annotationJRES, TOCSY = annotationTOCSY, combination = seqCombiMeanScoreSeuilFiltre)) |
2
dff7bde22102
"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff
changeset
|
147 } |