# HG changeset patch # User jcb-mpl # Date 1619534885 0 # Node ID c0a2e5e78725f2a3225bb21dd1d76a474754793a Uploaded diff -r 000000000000 -r c0a2e5e78725 2018_07_extract_peaks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2018_07_extract_peaks.xml Tue Apr 27 14:48:05 2021 +0000 @@ -0,0 +1,203 @@ + + extracts the peaks (m/z x TR) from the EICs + + + scilab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +**Authors** Jean-Claude Boulet (INRA). + + +--------------------------------------------------- + +========================= +PEAKS:FEATURES EXTRACTION +========================= + +----------- +Description +----------- + +A feature or peak is a signal recorded for a given m/z value and a range of retention times. + +This function extracts the peaks of each EIC from an EIC matrix. + +Note: this features extraction algorithm does not claim novelty nor higher performances. But it corresponds well to our outputs. For a basic use. + + + +----- +Input +----- + +**EICs files** + +- a matrix from e.g. the function: EICs-synchronized -> EICs-merged + +- or a list yielded by the function: EICs -> checks reference mz + + +---------- +Parameters +---------- + +**Number** + +In case of a list, the number to select, from 1 to 5, corresponding to the m/z thresholds of 0.0005, 0.0010, 0.0030, 0.0050 and 0.0100 respectively + +**Maximum range of retention time** + +Default value: 0.3 + + +**Minimum range of retention time** + +Default value: 0.05 + +**Threshold for Durbin-Watson** + +Default value: 1 + + +------- +Outputs +------- + +**Peaks list** + +A file of 4 columns: RT min, RT max, m/z value and signal + +**Peaks detail** + +The file, format HDF5-scilab, contains a list. + +Each element of the list is associated to a peak, i.e. a line of the Peaks List output. + +Each element of the list contains a column vector of the signals recorded along a range of retention times, identified by the line labels. The column label is the m/z value of the peak. + + + + + + + + + + diff -r 000000000000 -r c0a2e5e78725 src/mz_6bis_durbin_watson.sci --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mz_6bis_durbin_watson.sci Tue Apr 27 14:48:05 2021 +0000 @@ -0,0 +1,21 @@ +function x_dw=mz_6bis_durbin_watson(x_tr_mz) + + // pas de calcul matriciel car pas assez de memoire + // x_dw doit varier entre 0 et 2 + // 0=ce qu on recherche + + [n,q]=size(x_tr_mz.d); + + // calcul de la norme des differences et des vect-colonne de x_tr_mz + x_diff=x_tr_mz.d(2:n,:)-x_tr_mz.d(1:n-1,:); + rmsce=zeros(q,1); + rmsce2=zeros(q,1); + for i=1:q; + rmsce(i)=sqrt((x_diff(:,i)'*x_diff(:,i))/(n-1)); + rmsce2(i)=sqrt((x_tr_mz.d(:,i)'*x_tr_mz.d(:,i))/(n)); + end + + x_dw=rmsce./rmsce2; + + +endfunction diff -r 000000000000 -r c0a2e5e78725 src/mz_8_peakpicking_dw.sci --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mz_8_peakpicking_dw.sci Tue Apr 27 14:48:05 2021 +0000 @@ -0,0 +1,140 @@ +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) + + // x_tr_mz3_trouves: un div (n x p) + // list_mz: les n° des m/z à traiter; valeurs entre 1 et p + // plage tr: une valeur; par defaut: +/- 0,2 minutes + // plage_min_tr: une valeur; par defaut: 0,05 + // dw_max: une valeur entre 0 et 2; par défaut: 0.5 + // signal_min: une valeur; par défaut: 100000 + // option_plot: 1=figures; 0= non (par défaut) + + if argn(2)<7 then + option_plot=0; + end + + if argn(2)<6 then + signal_min=100000; + end + + if argn(2)<5 then + dw_max=0.5; + end + + if argn(2)<4 then + plage_min_tr=0.05; + end + + if argn(2)<3 then + plage_tr=0.2; + end + + + no_eic=[]; + + n_mz=size(x_tr_mz3_trouves.d,2); + list_mz_possible=[1:n_mz]'; + list_mz=list_mz_possible(list_mz); // pour accepter le $ + + n=max(size(list_mz)); + + peaks_list.d=[]; + peaks_list.i=[]; + peaks_list.v=['TRmin';'TRmax';'TRmedian';'m/z';'signal']; + + peaks_detail=list(); + index_peaks_detail=1; + + // transformation de plage_tr (des valeurs de temps) en n_tr (un nbre de TR) + ntemp=100; // pour ne pas commencer au début + n_tr=0; + val_tr=0; + + while val_tr<=plage_tr; + n_tr=n_tr+1; + val_tr=strtod(x_tr_mz3_trouves.i(ntemp+n_tr))-strtod(x_tr_mz3_trouves.i(ntemp)); + end + + nbr_total_tr=size(x_tr_mz3_trouves.i,1); + + for i=1:n; + xi=x_tr_mz3_trouves(:,list_mz(i)); + + signal_max=max(xi.d) // 1 seule colonne + + index_selected=0*strtod((xi.i)); // un vecteur de 0 de même taille que xi.i + + while signal_max > signal_min; + // identification de la plage du pic + index=find(xi.d==signal_max & index_selected==0); + index_min=max(1,index-n_tr); + index_max=min(nbr_total_tr,index+n_tr); + //ajustement du min pour ne pas retomber sur une zone deja selectionnee + index_selected_min=index_selected(index_min); + while index_selected_min>0; + index_min=index_min+1; + index_selected_min=index_selected(index_min); + end + //ajustement du max pour ne pas retomber sur une zone deja selectionnee + index_selected_max=index_selected(index_max); + while index_selected_max>0; + index_max=index_max-1; + index_selected_max=index_selected(index_max); + end + + // options de tri: DW et plage_min_tr + xi_sel=xi(index_min:index_max,:); + + if (strtod(xi.i(index_max))-strtod(xi.i(index_min)))> plage_min_tr then + + dw=mz_6bis_durbin_watson(detrending(xi_sel')'); // car si ldb élevée et régulière: DW= faible + + if dw