annotate annotationRmn2D.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 SEQUENCE RMN #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
3 # matriceComplexe : data.frame liste couples ppm de la matrice a annoter #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
4 # BdDStandards : objet contenant la base de donnees des composes standards #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
5 # nom_sequence : nom sequence 2D a utiliser pour annotation ("JRES", "COSY", "TOCSY", "HMBC", "HSQC") #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
6 # ppm1Tol : tolerance ppm axe abscisses #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
7 # ppm2Tol : tolerance ppm axe ordonnees #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
8 # nb_ligne_template : preciser le nombre total de ligne de la feuille de calcul a annoter #
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
9 #######################################################################################################
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
10 annotationRmn2D <- function(matriceComplexe, BdDStandards, nom_sequence, ppm1Tol = 0.01, ppm2Tol = 0.01,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
11 seuil = 0, unicite = "NO") {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
12 ## Longueur de la peak-list de la matrice a annoter
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
13 PeakListLength <- length(matriceComplexe[, 1])
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
14
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
15 ## Nombre de metabolites inclus dans BdD de composes standards
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
16 nbMetabolitesBdD <- length(BdDStandards)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
17 matrixAnnotation <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
18 allMetabolitesList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
19 seuil_score <- seuil
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
20
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
21 ## Boucle sur les metabolites inclus dans BdD
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
22 for (i in seq_len(nbMetabolitesBdD)) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
23 ## Infos metabolite en cours
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
24 iMetabolite <- BdDStandards[[i]]
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
25 ppm1M <- iMetabolite[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
26 ppm2M <- iMetabolite[, 2]
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
27 nbPeakMetabolite <- length(ppm1M)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
28 MetaboliteName <- names(BdDStandards[i])
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
29
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
30 ## Initialisation
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
31 k <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
32 presenceScore <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
33 annotatedPpmRef <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
34 annotatedPpmList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
35 annotatedPeakLength <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
36 metabolites <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
37 metabolitesList <- data.frame()
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
38
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
39 ## Boucle sur les couples de pics de la matrice a annoter
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
40 for (p in seq_len(PeakListLength)) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
41 ppmAnnotationF1 <- as.numeric(matriceComplexe[p, 3])
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
42 ppmAnnotationF2 <- as.numeric(matriceComplexe[p, 2])
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
43 e <- simpleMessage("end of file")
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
44 tryCatch({
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
45 if (!is.na(ppmAnnotationF1)) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
46 matrixAnnotation <- unique.data.frame(rbind.data.frame(matrixAnnotation, matriceComplexe[p, ]))
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
47 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
48 # Recherche du couple de pics de la matrice la liste des couples du metabolite standard
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
49 metaboliteIn <- (ppm1M >= (ppmAnnotationF2 - ppm1Tol) & ppm1M <= (ppmAnnotationF2 + ppm1Tol) &
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
50 ppm2M >= (ppmAnnotationF1 - ppm2Tol) & ppm2M <= (ppmAnnotationF1 + ppm2Tol))
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
51 WhichMetaboliteIn <- which(metaboliteIn)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
52 # Si au moins un couple de la matrice a annoter dans liste couples metabolite standard
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
53 if (length(WhichMetaboliteIn) > 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
54 for (a in seq_len(length(WhichMetaboliteIn))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
55 annotatedPpmList <- data.frame(ppm1 = ppm1M[WhichMetaboliteIn[a]], ppm2 = ppm2M[WhichMetaboliteIn[a]], theoricalLength = nbPeakMetabolite)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
56 annotatedPpmRef <- rbind(annotatedPpmRef, annotatedPpmList)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
57 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
58 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
59 }, error = function(e) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
60 cat("End of file \n");
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
61 })
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
62 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
63
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
64 # Au - 1 couple de ppm de la matrice complexe annote
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
65 if (nrow(annotatedPpmRef) >= 1) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
66 ## Nombre couples annotes
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
67 annotatedPeakLength <- nrow(annotatedPpmRef)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
68
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
69 ## Recherche doublons
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
70 annotatedDoublons <- duplicated(annotatedPpmRef)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
71 if (sum(duplicated(annotatedPpmRef)) > 0) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
72 annotatedPeakLength <- nrow(annotatedPpmRef) - sum(duplicated(annotatedPpmRef))
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
73 annotatedPpmRef <- annotatedPpmRef[-duplicated(annotatedPpmRef), ]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
74 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
75 presenceScore <- round(annotatedPeakLength / nbPeakMetabolite, 2)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
76 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
77
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
78 ## Conservation metabolites dont score > seuil
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
79 if (presenceScore > seuil_score) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
80 metabolites <- data.frame(Metabolite = MetaboliteName, score = presenceScore)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
81 metabolitesList <- cbind.data.frame(annotatedPpmRef, metabolites)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
82 allMetabolitesList <- rbind.data.frame(allMetabolitesList, metabolitesList)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
83 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
84 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
85
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
86 # Initialisation
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
87 commonPpm <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
88 commonPpmList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
89 metaboliteAdd <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
90 metaboliteAddList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
91 commonMetabolitesList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
92 commonMetabolitesPpmList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
93 commonMetabolitesPpmAllList1 <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
94 commonMetabolitesPpmAllList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
95 listeTotale_2D_unicite <- allMetabolitesList[, 1:4]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
96 allMetabolitesList <- allMetabolitesList[, -3]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
97 metabolitesAllUnicite <- data.frame()
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
98
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
99 ## Boucle sur tous couples annotes
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
100 for (j in seq_len(length(allMetabolitesList$ppm1))) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
101 ## Boucle sur metabolites dans BdD composes standards
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
102 for (i in seq_len(nbMetabolitesBdD)) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
103 ppmMetaboliteBdD <- BdDStandards[[i]]
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
104 ppm1M <- ppmMetaboliteBdD[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
105 ppm2M <- ppmMetaboliteBdD[, 2]
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
106 # Nombre de couples metabolite
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
107 nbPeakMetabolite <- length(ppm1M)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
108 MetaboliteName <- names(BdDStandards[i])
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
109
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
110 metabolitesInAll <- (ppm1M >= (allMetabolitesList[j, 1] - ppm1Tol) & ppm1M <= (allMetabolitesList[j, 1] + ppm1Tol) &
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
111 ppm2M >= (allMetabolitesList[j, 2] - ppm2Tol) & ppm2M <= (allMetabolitesList[j, 2] + ppm2Tol))
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
112 WhichMetabolitesInAll <- which(metabolitesInAll)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
113
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
114 if (MetaboliteName != allMetabolitesList[j, 3] & length(WhichMetabolitesInAll) > 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
115 metabolitesAllUnicite <- rbind.data.frame(metabolitesAllUnicite, listeTotale_2D_unicite[j, ])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
116 commonPpm <- data.frame(ppm1 = allMetabolitesList[j, 1], ppm2 = allMetabolitesList[j, 2])
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
117 commonPpmList <- rbind.data.frame(commonPpmList, commonPpm)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
118 commonPpmList <- unique(commonPpmList)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
119 metaboliteAdd <- data.frame(nom_metabolite = MetaboliteName)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
120 metaboliteAddList <- rbind.data.frame(metaboliteAddList, metaboliteAdd)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
121 commonMetabolitesList <- rbind.data.frame(data.frame(nom_metabolite = allMetabolitesList[j, 3]), metaboliteAddList)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
122 commonMetabolitesPpmList <- cbind.data.frame(commonPpm, commonMetabolitesList)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
123 commonMetabolitesPpmAllList1 <- rbind.data.frame(commonMetabolitesPpmAllList1, commonMetabolitesPpmList)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
124 commonMetabolitesPpmAllList1 <- unique.data.frame(commonMetabolitesPpmAllList1)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
125 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
126 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
127 commonMetabolitesPpmAllList <- rbind.data.frame(commonMetabolitesPpmAllList, commonMetabolitesPpmAllList1)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
128 commonMetabolitesPpmAllList <- unique.data.frame(commonMetabolitesPpmAllList)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
129
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
130 #initialisation des data.frame
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
131 commonPpm <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
132 metaboliteAdd <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
133 metaboliteAddList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
134 metabolite_ref <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
135 commonMetabolitesList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
136 commonMetabolitesPpmList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
137 commonMetabolitesPpmAllList1 <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
138 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
139
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
140 unicityAllList <- listeTotale_2D_unicite
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
141 if (nrow(listeTotale_2D_unicite) != 0 & nrow(metabolitesAllUnicite) != 0)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
142 unicityAllList <- setdiff(listeTotale_2D_unicite, metabolitesAllUnicite)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
143
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
144 unicitynbCouplesRectif <- data.frame()
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
145 for (g in seq_len(nrow(unicityAllList))) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
146 metaboliteUnicity <- (unicityAllList$Metabolite == unicityAllList$Metabolite[g])
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
147 WhichMetaboliteUnicity <- which(metaboliteUnicity)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
148 nb_occurence <- length(WhichMetaboliteUnicity)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
149 unicitynbCouplesRectif <- rbind.data.frame(unicitynbCouplesRectif, nb_occurence)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
150 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
151 names(unicitynbCouplesRectif) <- "NbCouplesAnnotes"
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
152 unicityAllList <- cbind.data.frame(unicityAllList, unicitynbCouplesRectif)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
153
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
154 unicityAllList <- cbind.data.frame(unicityAllList, score_unicite = unicityAllList$NbCouplesAnnotes / unicityAllList$theoricalLength)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
155 unicityAllList <- unicityAllList[, -3]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
156 unicityAllList <- unicityAllList[, -4]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
157
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
158 unicityAllList <- unicityAllList[unicityAllList$score_unicite > seuil_score, ]
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
159
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
160 listeTotale_metabo <- data.frame()
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
161 if (nrow(commonPpmList) != 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
162 for (o in seq_len(length(commonPpmList[, 1]))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
163 tf6 <- (commonMetabolitesPpmAllList$ppm1 == commonPpmList[o, 1] & commonMetabolitesPpmAllList$ppm2 == commonPpmList[o, 2])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
164 w6 <- which(tf6)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
165
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
166 for (s in seq_len(length(w6))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
167 metaboliteAdd <- data.frame(nom_metabolite = commonMetabolitesPpmAllList[w6[s], 3])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
168 commonMetabolitesList <- paste(commonMetabolitesList, metaboliteAdd[1, ], sep = " ")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
169 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
170 liste_metabo_ppm <- cbind.data.frame(ppm1 = commonPpmList[o, 1], ppm2 = commonPpmList[o, 2], commonMetabolitesList)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
171 listeTotale_metabo <- rbind.data.frame(listeTotale_metabo, liste_metabo_ppm)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
172 commonMetabolitesList <- data.frame()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
173 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
174 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
175
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
176 # Representation graphique
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
177 if (nom_sequence == "HSQC" | nom_sequence == "HMBC") {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
178 atome <- "13C"
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
179 indice_positif <- 1
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
180 indice_negatif <- -10
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
181 } else {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
182 atome <- "1H"
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
183 indice_positif <- 0.5
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
184 indice_negatif <- -0.5
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
185 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
186
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
187 matriceComplexe <- matrixAnnotation
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
188 ppm1 <- as.numeric(matriceComplexe[, 2])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
189 ppm2 <- as.numeric(matriceComplexe[, 3])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
190
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
191 if (unicite == "NO") {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
192 listeTotale_2D_a_utiliser <- allMetabolitesList
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
193 d1.ppm <- allMetabolitesList$ppm1
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
194 d2.ppm <- allMetabolitesList$ppm2
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
195 } else {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
196 listeTotale_2D_a_utiliser <- unicityAllList
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
197 d1.ppm <- listeTotale_2D_a_utiliser$ppm1
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
198 d2.ppm <- listeTotale_2D_a_utiliser$ppm2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
199 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
200
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
201 if (nrow(listeTotale_2D_a_utiliser) > 0) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
202 ## Taches de correlations
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
203 # Matrice biologique + Annotations
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
204 maxX <- max(round(max(as.numeric(matriceComplexe[, 2]))) + 0.5, round(max(as.numeric(matriceComplexe[, 2]))))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
205 maxY <- max(round(max(as.numeric(matriceComplexe[, 3]))) + indice_positif, round(max(as.numeric(matriceComplexe[, 3]))))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
206 probability.score <- as.factor(round(listeTotale_2D_a_utiliser[, 4], 2))
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
207 lgr <- length(unique(probability.score))
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
208 sp <- ggplot(matriceComplexe, aes(x = ppm1, y = ppm2))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
209 sp <- sp + geom_point(size = 2) + scale_x_reverse(breaks = seq(maxX, 0, -0.5)) +
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
210 scale_y_reverse(breaks = seq(maxY, 0, indice_negatif)) +
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
211 xlab("1H chemical shift (ppm)") + ylab(paste(atome, " chemical shift (ppm)")) + ggtitle(nom_sequence) +
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
212 geom_text(data = listeTotale_2D_a_utiliser, aes(d1.ppm, d2.ppm, label = str_to_lower(substr(listeTotale_2D_a_utiliser[, 3], 1, 3)), col = probability.score),
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
213 size = 4, hjust = 0, nudge_x = 0.02, vjust = 0, nudge_y = 0.2) + scale_colour_manual(values = viridis(lgr))
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
214 print(sp)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
215 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
216
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
217 # Liste des resultats (couples pmm / metabolite / score) + liste ppms metabolites communs
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
218 if (unicite == "NO") {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
219 return(list(liste_resultat = allMetabolitesList, listing_ppm_commun = listeTotale_metabo))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
220 } else {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
221 return(list(liste_resultat_unicite = unicityAllList, listing_ppm_commun_affichage = listeTotale_metabo))
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
222 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
223 }