annotate annotationRmn2D.R @ 2:dff7bde22102 draft

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