0
|
1 function [peaks_list,peaks_detail,no_eic]=mz_8_peakpicking_dw(x_tr_mz3_trouves,list_mz,plage_tr,plage_min_tr,dw_max,signal_min,option_plot)
|
|
2
|
|
3 // x_tr_mz3_trouves: un div (n x p)
|
|
4 // list_mz: les n° des m/z à traiter; valeurs entre 1 et p
|
|
5 // plage tr: une valeur; par defaut: +/- 0,2 minutes
|
|
6 // plage_min_tr: une valeur; par defaut: 0,05
|
|
7 // dw_max: une valeur entre 0 et 2; par défaut: 0.5
|
|
8 // signal_min: une valeur; par défaut: 100000
|
|
9 // option_plot: 1=figures; 0= non (par défaut)
|
|
10
|
|
11 if argn(2)<7 then
|
|
12 option_plot=0;
|
|
13 end
|
|
14
|
|
15 if argn(2)<6 then
|
|
16 signal_min=100000;
|
|
17 end
|
|
18
|
|
19 if argn(2)<5 then
|
|
20 dw_max=0.5;
|
|
21 end
|
|
22
|
|
23 if argn(2)<4 then
|
|
24 plage_min_tr=0.05;
|
|
25 end
|
|
26
|
|
27 if argn(2)<3 then
|
|
28 plage_tr=0.2;
|
|
29 end
|
|
30
|
|
31
|
|
32 no_eic=[];
|
|
33
|
|
34 n_mz=size(x_tr_mz3_trouves.d,2);
|
|
35 list_mz_possible=[1:n_mz]';
|
|
36 list_mz=list_mz_possible(list_mz); // pour accepter le $
|
|
37
|
|
38 n=max(size(list_mz));
|
|
39
|
|
40 peaks_list.d=[];
|
|
41 peaks_list.i=[];
|
|
42 peaks_list.v=['TRmin';'TRmax';'TRmedian';'m/z';'signal'];
|
|
43
|
|
44 peaks_detail=list();
|
|
45 index_peaks_detail=1;
|
|
46
|
|
47 // transformation de plage_tr (des valeurs de temps) en n_tr (un nbre de TR)
|
|
48 ntemp=100; // pour ne pas commencer au début
|
|
49 n_tr=0;
|
|
50 val_tr=0;
|
|
51
|
|
52 while val_tr<=plage_tr;
|
|
53 n_tr=n_tr+1;
|
|
54 val_tr=strtod(x_tr_mz3_trouves.i(ntemp+n_tr))-strtod(x_tr_mz3_trouves.i(ntemp));
|
|
55 end
|
|
56
|
|
57 nbr_total_tr=size(x_tr_mz3_trouves.i,1);
|
|
58
|
|
59 for i=1:n;
|
|
60 xi=x_tr_mz3_trouves(:,list_mz(i));
|
|
61
|
|
62 signal_max=max(xi.d) // 1 seule colonne
|
|
63
|
|
64 index_selected=0*strtod((xi.i)); // un vecteur de 0 de même taille que xi.i
|
|
65
|
|
66 while signal_max > signal_min;
|
|
67 // identification de la plage du pic
|
|
68 index=find(xi.d==signal_max & index_selected==0);
|
|
69 index_min=max(1,index-n_tr);
|
|
70 index_max=min(nbr_total_tr,index+n_tr);
|
|
71 //ajustement du min pour ne pas retomber sur une zone deja selectionnee
|
|
72 index_selected_min=index_selected(index_min);
|
|
73 while index_selected_min>0;
|
|
74 index_min=index_min+1;
|
|
75 index_selected_min=index_selected(index_min);
|
|
76 end
|
|
77 //ajustement du max pour ne pas retomber sur une zone deja selectionnee
|
|
78 index_selected_max=index_selected(index_max);
|
|
79 while index_selected_max>0;
|
|
80 index_max=index_max-1;
|
|
81 index_selected_max=index_selected(index_max);
|
|
82 end
|
|
83
|
|
84 // options de tri: DW et plage_min_tr
|
|
85 xi_sel=xi(index_min:index_max,:);
|
|
86
|
|
87 if (strtod(xi.i(index_max))-strtod(xi.i(index_min)))> plage_min_tr then
|
|
88
|
|
89 dw=mz_6bis_durbin_watson(detrending(xi_sel')'); // car si ldb élevée et régulière: DW= faible
|
|
90
|
|
91 if dw<dw_max then
|
|
92
|
|
93 // calcul du signal de la plage
|
|
94 vect_tr=[index_min:index_max]
|
|
95 signal=sum(xi.d(vect_tr));
|
|
96
|
|
97 // enregistrement du resultat
|
|
98 if peaks_list.d==[] then
|
|
99 peaks_list.d=[strtod(xi.i(index_min)) strtod(xi.i(index_max)) strtod(xi.i(index)) strtod(xi.v) signal];
|
|
100 peaks_list.i=i;
|
|
101 else
|
|
102 peaks_list.d=[peaks_list.d; [strtod(xi.i(index_min)) strtod(xi.i(index_max)) strtod(xi.i(index)) strtod(xi.v) signal]];
|
|
103 peaks_list.i=[peaks_list.i;i];
|
|
104 end
|
|
105
|
|
106 peaks_detail(index_peaks_detail)=xi([index_min:index_max],:);
|
|
107 index_peaks_detail=index_peaks_detail+1;
|
|
108
|
|
109 // edition de figure (selon option)
|
|
110 if option_plot==1 then
|
|
111 figure;
|
|
112 curves(xi([index_min:index_max],:));
|
|
113 end
|
|
114
|
|
115 // rajout des n° d'EICs de x_tr_mz3_trouves ou x_tr_mz4
|
|
116 if no_eic==[] then
|
|
117 no_eic=i;
|
|
118 else
|
|
119 no_eic=[no_eic;i];
|
|
120 end
|
|
121 end
|
|
122
|
|
123 end
|
|
124 // neutralisation de la plage precedente
|
|
125 index_selected(index_min:index_max)=1; // on supprime
|
|
126 xi.d(index_min:index_max)=0;
|
|
127
|
|
128 signal_max=max(xi.d);
|
|
129 end
|
|
130
|
|
131 end
|
|
132
|
|
133
|
|
134 // préparation des sorties
|
|
135 peaks_list=div(peaks_list);
|
|
136
|
|
137
|
|
138
|
|
139
|
|
140 endfunction
|