Mercurial > repos > fgiacomoni > golm_ws_lib_search
annotate lib/msp.pm @ 3:28d579fa1718 draft default tip
Master branch Updating - - Fxx
author | fgiacomoni |
---|---|
date | Wed, 03 Oct 2018 05:35:16 -0400 |
parents | e3d43b8c987b |
children |
rev | line source |
---|---|
0
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
1 package lib::msp ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
2 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
3 use strict; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
4 use warnings ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
5 use Exporter ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
6 use Carp ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
7 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
8 use Data::Dumper ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
9 use List::MoreUtils qw(uniq); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
10 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
11 use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
12 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
13 our $VERSION = "1.0"; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
14 our @ISA = qw(Exporter); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
15 our @EXPORT = qw( get_mzs get_intensities get_masses_from_string get_intensities_from_string keep_only_max_masses keep_only_max_intensities encode_spectrum_for_query sorting_descending_intensities round_num apply_relative_intensity remove_redundants); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
16 our %EXPORT_TAGS = ( ALL => [qw( get_mzs get_intensities get_masses_from_string get_intensities_from_string keep_only_max_masses keep_only_max_intensities encode_spectrum_for_query sorting_descending_intensities round_num apply_relative_intensity remove_redundants)] ); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
17 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
18 =head1 NAME |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
19 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
20 My::Module - An example module |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
21 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
22 =head1 SYNOPSIS |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
23 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
24 use My::Module; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
25 my $object = My::Module->new(); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
26 print $object->as_string; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
27 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
28 =head1 DESCRIPTION |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
29 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
30 This module does not really exist, it |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
31 was made for the sole purpose of |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
32 demonstrating how POD works. |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
33 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
34 =head1 METHODS |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
35 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
36 Methods are : |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
37 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
38 =head2 METHOD new |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
39 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
40 ## Description : new |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
41 ## Input : $self |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
42 ## Ouput : bless $self ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
43 ## Usage : new() ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
44 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
45 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
46 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
47 sub new { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
48 ## Variables |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
49 my $self={}; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
50 bless($self) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
51 return $self ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
52 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
53 ### END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
54 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
55 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
56 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
57 =head2 METHOD get_mzs |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
58 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
59 ## Description : parse msp file and get mzs |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
60 ## Input : $msp_file, $mzRes, $maxIon |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
61 ## Output : \@total_spectra_mzs |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
62 ## Usage : my ( $mzs ) = get_mzs( $msp_file , $mzRes, $maxIon) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
63 ## Structure of res: [ $arr_ref1 , $arr_ref2 ... $arr_refN ] |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
64 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
65 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
66 sub get_mzs { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
67 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
68 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
69 my ( $msp_file, $mzRes ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
70 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
71 my @ions = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
72 my @temp_mzs = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
73 my @uniq_masses ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
74 my @mzs = (); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
75 my @total_spectra_mzs = (); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
76 my $mz ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
77 my $i = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
78 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
79 open (MSP , "<" , $msp_file) or die $! ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
80 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
81 { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
82 local $/ = 'Name' ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
83 my @infos = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
84 # One line is : "Name -> Name" englobing a whole spectrum with all infos |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
85 while(my $line = <MSP>) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
86 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
87 chomp $line; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
88 @infos = split (/\n/ , $line) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
89 # Loop over all lines of a spectrum |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
90 for (my $i=0 ; $i<@infos ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
91 # Detect spectrum lines only |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
92 if ($infos[$i] =~ /(\d+\.?\d*)\s+(\d+\.?\d*)\s*;\s*/) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
93 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
94 @ions = split ( /;/ , $infos[$i] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
95 # Retrieve mzs according to maxIons value |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
96 foreach my $ion (@ions) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
97 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
98 if ($ion =~ /^\s*(\d+\.?\d*)\s+(\d+\.?\d*)$/) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
99 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
100 $mz = $1 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
101 # Truncate/round mzs depending on $mzRes wanted |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
102 if ($mzRes == 0) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
103 my $mz_rounded = sprintf("%.".$mzRes."f", $mz) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
104 push (@temp_mzs , $mz_rounded) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
105 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
106 # Check that $mzRes is not greater than the number of digits after comma |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
107 elsif ($mzRes > 0) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
108 if ($mz !~ /^\d+\.\d+$/) { croak "*********\n\nYou are trying to specify $mzRes significant decimals, but one or more masses in the input file are unitary masses.\nYou should try again with mzRes = 0\n\n\n"; } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
109 elsif($mzRes > length(( $mz =~ /.+\.(.*)/)[0] )) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
110 $mz = sprintf("%.".$mzRes."f" , $mz) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
111 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
112 my $mz_rounded = _round_num($mz,$mzRes) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
113 push (@temp_mzs , $$mz_rounded) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
114 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
115 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
116 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
117 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
118 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
119 if($line ne '') { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
120 @{ $total_spectra_mzs[$i] } = @temp_mzs ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
121 $i++ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
122 @temp_mzs = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
123 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
124 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
125 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
126 #print Dumper \@total_spectra_mzs ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
127 close (MSP) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
128 return(\@total_spectra_mzs) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
129 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
130 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
131 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
132 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
133 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
134 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
135 =head2 METHOD get_intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
136 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
137 ## Description : parse msp file and get intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
138 ## Input : $msp_file, $maxIons |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
139 ## Output : \@total_spectra_intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
140 ## Usage : my ( $intensities ) = get_mzs( $msp_file, $maxIons ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
141 ## Structure of res: [ $arr_ref1 , $arr_ref2 ... $arr_refN ] |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
142 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
143 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
144 sub get_intensities { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
145 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
146 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
147 my ( $msp_file ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
148 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
149 my @ions = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
150 my @temp_intensities = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
151 my @intensities = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
152 my @total_spectra_intensities = (); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
153 my $i = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
154 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
155 open (MSP , "<" , $msp_file) or die $! ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
156 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
157 { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
158 local $/ = 'Name' ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
159 my @infos = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
160 # Extract spectrum |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
161 while(my $line = <MSP>) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
162 chomp $line; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
163 @infos = split (/\n/ , $line) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
164 #Detect spectrum |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
165 for (my $i=0 ; $i<@infos ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
166 if ($infos[$i] =~ /(\d+\.?\d*)\s+(\d+\.?\d*)\s*;\s*?/) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
167 @ions = split ( /;/ , $infos[$i] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
168 # Retrieve intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
169 foreach my $ion (@ions) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
170 if ($ion =~ /^\s*(\d+\.?\d*)\s+(\d+\.?\d*)$/) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
171 my $intensity = $2 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
172 push ( @temp_intensities , $intensity ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
173 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
174 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
175 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
176 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
177 if($line ne '') { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
178 @{ $total_spectra_intensities[$i] } = @temp_intensities ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
179 $i++ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
180 @temp_intensities = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
181 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
182 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
183 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
184 close (MSP) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
185 return(\@total_spectra_intensities) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
186 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
187 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
188 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
189 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
190 =head2 METHOD get_masses_from_string |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
191 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
192 ## Description : parse a spectrum string and get mzs and intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
193 ## Input : $spectrum_string, $mzRes |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
194 ## Output : \@spectrum_intensities_mzs |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
195 ## Usage : my ( $spectrum_mzs ) = get_masses_from_string( $spectrum_string , $mzRes ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
196 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
197 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
198 sub get_masses_from_string { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
199 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
200 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
201 my ( $spectrum_string, $mzRes ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
202 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
203 my @intensities = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
204 my @mzs = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
205 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
206 if (defined $spectrum_string) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
207 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
208 if ($spectrum_string ne '') { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
209 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
210 if ($spectrum_string =~ /\s*(\d+\.?\d*)\s+(\d+\.?\d*)\s*/ ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
211 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
212 my @val = split (/\s+/ , $spectrum_string) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
213 for (my $i=0 ; $i<@val ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
214 if ($i%2 == 0) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
215 my $mz = $val[$i] ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
216 # Truncate/round mzs depending on $mzRes wanted |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
217 if ($mzRes == 0) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
218 $mz = int($mz) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
219 push ( @mzs , $val[$i] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
220 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
221 # Check that $mzRes is not greater than the number of digits after comma |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
222 elsif ($mzRes > 0) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
223 if($mzRes > length(( $mz =~ /.+\.(.*)/)[0] )) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
224 $mz = sprintf("%.".$mzRes."f" , $mz) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
225 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
226 my $mz_rounded = _round_num($mz,$mzRes) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
227 push ( @mzs , $$mz_rounded ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
228 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
229 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
230 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
231 return (\@mzs) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
232 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
233 else { croak "Wrong format of the spectrum. See help\n" } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
234 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
235 else { croak "Spectrum is empty, the service will stop\n" } ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
236 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
237 else { croak "Spectrum is not defined, service will stop\n" } ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
238 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
239 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
240 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
241 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
242 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
243 =head2 METHOD get_intensities_from_string |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
244 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
245 ## Description : parse a spectrum string and get intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
246 ## Input : $spectrum_string |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
247 ## Output : \@spectrum_intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
248 ## Usage : my ( $spectrum_intensities ) = get_intensities_from_string( $spectrum_string ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
249 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
250 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
251 sub get_intensities_from_string { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
252 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
253 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
254 my ( $spectrum_string ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
255 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
256 my @intensities = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
257 my @mzs = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
258 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
259 if (defined $spectrum_string) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
260 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
261 if ($spectrum_string ne '') { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
262 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
263 if ($spectrum_string =~ /\s*(\d+\.?\d*)\s+(\d+\.?\d*)\s*/ ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
264 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
265 my @val = split (/\s+/ , $spectrum_string) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
266 for (my $i=0 ; $i<@val ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
267 if ($i%2 != 0) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
268 my $int = $val[$i] ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
269 push ( @intensities , $int ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
270 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
271 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
272 return (\@intensities) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
273 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
274 else { croak "Wrong format of the spectrum. See help\n" } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
275 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
276 else { croak "Spectrum is empty, the service will stop\n" } ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
277 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
278 else { croak "Spectrum is not defined, service will stop\n" } ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
279 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
280 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
281 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
282 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
283 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
284 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
285 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
286 =head2 METHOD sorting_descending_intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
287 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
288 ## Description : sort mzs and intensities arrays by descending intensity values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
289 ## Input : $ref_mzs_res, $ref_ints_res |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
290 ## Output : \@mzs_res, \@ints_res |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
291 ## Usage : my ( \@mzs_res, \@ints_res ) = sorting_descending_intensities( $ref_mzs_res, $ref_ints_res ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
292 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
293 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
294 sub sorting_descending_intensities { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
295 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
296 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
297 my ( $ref_mzs_res, $ref_ints_res ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
298 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
299 my @mzs_res = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
300 my @ints_res = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
301 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
302 if ( defined $ref_mzs_res && defined $ref_ints_res ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
303 if ( (scalar @$ref_mzs_res) != 0 && (scalar @$ref_ints_res) != 0 ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
304 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
305 @mzs_res = @$ref_mzs_res ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
306 @ints_res = @$ref_ints_res ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
307 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
308 # Case when we have only one array of masses (input is a string of masses and not a file) |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
309 if ( ref(@$ref_ints_res[0]) ne "ARRAY") { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
310 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
311 my @sorted_indices = sort { $ints_res[$b] <=> $ints_res[$a] } 0..$#ints_res; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
312 @$_ = @{$_}[@sorted_indices] for \(@mzs_res, @ints_res); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
313 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
314 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
315 else { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
316 ## Sorting ions by decreasing intensity values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
317 for (my $i=0 ; $i<@ints_res ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
318 my @sorted_indices = sort { @{$ints_res[$i]}[$b] <=> @{$ints_res[$i]}[$a] } 0..$#{$ints_res[$i]}; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
319 @$_ = @{$_}[@sorted_indices] for \(@{$ints_res[$i]},@{$mzs_res[$i]}); |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
320 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
321 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
322 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
323 else { carp "Cannot sort intensities, mzs or intensities are empty" ; return (\@mzs_res, \@ints_res) ; } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
324 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
325 else { carp "Cannot sort intensities, mzs or intensities are undef" ; return (\@mzs_res, \@ints_res) ; } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
326 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
327 return (\@mzs_res, \@ints_res) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
328 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
329 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
330 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
331 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
332 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
333 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
334 =head2 METHOD keep_only_max_masses |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
335 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
336 ## Description : keep only $maxIons masses |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
337 ## Input : $mzs_res_sorted, $maxIons |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
338 ## Output : \@mzs |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
339 ## Usage : my ( $mzs ) = keep_only_max_masses( $mzs_res_sorted, $ints_res_sorted, $maxIons ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
340 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
341 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
342 sub keep_only_max_masses { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
343 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
344 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
345 my ( $ref_mzs_res, $maxIons ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
346 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
347 my @mzs = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
348 my @tot_mzs = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
349 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
350 if ( ref(@$ref_mzs_res[0]) ne "ARRAY") { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
351 my $i = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
352 while (scalar @tot_mzs < $maxIons && $i < @$ref_mzs_res){ |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
353 push (@tot_mzs , $$ref_mzs_res[$i++]) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
354 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
355 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
356 else { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
357 for (my $i=0 ; $i<@$ref_mzs_res ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
358 my $j = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
359 while (scalar @mzs < $maxIons && $j < @$ref_mzs_res[$i]){ |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
360 push (@mzs , $ref_mzs_res->[$i][$j++]) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
361 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
362 push (@tot_mzs , \@mzs) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
363 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
364 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
365 return (\@tot_mzs) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
366 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
367 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
368 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
369 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
370 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
371 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
372 =head2 METHOD keep_only_max_intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
373 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
374 ## Description : keep only $maxIons intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
375 ## Input : $ints_res_sorted, $maxIons |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
376 ## Output : \@ints |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
377 ## Usage : my ( $ints ) = keep_only_max_intensities( $ints_res_sorted, $maxIons ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
378 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
379 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
380 sub keep_only_max_intensities { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
381 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
382 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
383 my ( $ref_ints_res, $maxIons ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
384 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
385 my @ints = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
386 my @tot_ints = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
387 if ( ref(@$ref_ints_res[0]) ne "ARRAY") { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
388 my $i = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
389 while (scalar @tot_ints < $maxIons && $i < @$ref_ints_res){ |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
390 push (@tot_ints , $$ref_ints_res[$i++]) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
391 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
392 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
393 else { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
394 for (my $i=0 ; $i<@$ref_ints_res ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
395 my $j = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
396 while (scalar @ints < $maxIons && $j < @$ref_ints_res[$i]){ |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
397 push (@ints , $ref_ints_res->[$i][$j++]) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
398 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
399 push (@tot_ints , \@ints) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
400 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
401 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
402 return (\@tot_ints) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
403 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
404 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
405 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
406 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
407 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
408 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
409 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
410 =head2 METHOD encode_spectrum_for_query |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
411 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
412 ## Description : get mzs and intensities values and generate the spectra strings formatted for the WS query (html) |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
413 ## Input : $mzs, $intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
414 ## Output : \@encoded_spectra |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
415 ## Usage : my ( $encoded_spectra ) = get_spectra( $mzs, $intensities ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
416 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
417 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
418 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
419 sub encode_spectrum_for_query { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
420 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
421 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
422 my ( $mzs, $intensities ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
423 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
424 my @encoded_spectra = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
425 my $spectrum = "" ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
426 my $k = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
427 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
428 #print Dumper $mzs ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
429 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
430 if ( defined $mzs && defined $intensities ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
431 if ( @$mzs && @$intensities ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
432 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
433 # Case when we have only one array of masses (input is a string of masses and not a file) |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
434 if ( ref(@$mzs[0]) ne "ARRAY") { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
435 for (my $i=0 ; $i< @$mzs ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
436 $spectrum = $spectrum . @$mzs[$i] . " " . @$intensities[$i] . " "; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
437 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
438 push ( @encoded_spectra , $spectrum ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
439 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
440 else { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
441 for (my $i=0 ; $i< @$mzs ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
442 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
443 for ( my $j=0 ; $j< @{ @$mzs[$i] } ; $j++ ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
444 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
445 $spectrum = $spectrum . $$mzs[$i][$j] . " " . $$intensities[$i][$j] . " "; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
446 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
447 $encoded_spectra[$k] = $spectrum ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
448 $k++ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
449 $spectrum = '' ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
450 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
451 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
452 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
453 else { carp "Cannot encode spectrum, mzs and intensities arrays are empty" ; return \@encoded_spectra ; } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
454 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
455 else { carp "Cannot encode spectrum, mzs and intensities are undef" ; return \@encoded_spectra ; } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
456 return \@encoded_spectra ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
457 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
458 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
459 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
460 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
461 =head2 METHOD round_num |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
462 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
463 ## Description : round a number by the sended decimal |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
464 ## Input : $number, $decimal |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
465 ## Output : $round_num |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
466 ## Usage : my ( $round_num ) = round_num( $number, $decimal ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
467 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
468 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
469 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
470 sub _round_num { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
471 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
472 my ( $number, $decimal ) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
473 my $round_num = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
474 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
475 if ( ( defined $decimal ) and ( $decimal > 0 ) and ( defined $number ) and ( $number > 0 ) ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
476 $round_num = sprintf("%.".$decimal."f", $number); ## a rounding is used : 5.3 -> 5 and 5.5 -> 6 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
477 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
478 else { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
479 croak "Can't round any number : missing value or decimal\n" ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
480 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
481 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
482 return(\$round_num) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
483 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
484 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
485 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
486 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
487 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
488 =head2 METHOD apply_relative_intensity |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
489 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
490 ## Description : transform absolute intensities into relative intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
491 ## Input : $intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
492 ## Output : \@intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
493 ## Usage : my ( $intensities ) = apply_relative_intensity( $intensities ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
494 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
495 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
496 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
497 sub apply_relative_intensity { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
498 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
499 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
500 my ($intensities) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
501 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
502 my @intensities = @$intensities ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
503 my @relative_intensities ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
504 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
505 foreach my $ints (@intensities) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
506 my @relative_ints = map { ($_ * 100)/@$ints[0] } @$ints ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
507 push (@relative_intensities , \@relative_ints) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
508 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
509 return \@relative_intensities ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
510 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
511 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
512 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
513 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
514 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
515 =head2 METHOD remove_redundants |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
516 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
517 ## Description : removes ions with redundant masses |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
518 ## Input : $masses $intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
519 ## Output : \@intensities |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
520 ## Usage : my ( $uniq_masses, $uniq_intensities ) = remove_redundants( $masses, $intensities ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
521 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
522 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
523 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
524 sub remove_redundants { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
525 ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
526 my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
527 my ($masses, $intensities) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
528 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
529 my %uniq = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
530 my @uniq_intensities = () ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
531 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
532 ## Create hash with key = mass and value = intensity |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
533 for (my $i=0 ; $i<@$masses ; $i++) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
534 $uniq{ @$masses[$i] } = @$intensities[$i] ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
535 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
536 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
537 ## Remove redundant masses |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
538 my @uniq_masses = uniq(@$masses) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
539 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
540 ## Keep intensities corresponding to uniq masses |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
541 foreach my $mass (@uniq_masses) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
542 push (@uniq_intensities , $uniq{ $mass }) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
543 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
544 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
545 return (\@uniq_masses , \@uniq_intensities) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
546 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
547 } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
548 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
549 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
550 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
551 #******************************************************************************************************** |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
552 # FONCTION DU SEUIL POUR LE BRUIT, A DECOMMENTER SI FINALEMENT CE N'EST PAS GERE DANS LA BRIQUE MetaMS |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
553 #******************************************************************************************************** |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
554 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
555 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
556 =head2 METHOD keep_ions_above_threshold |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
557 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
558 ## Description : keep only ions which intensities are above the threshold |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
559 ## Input : $mzs_res_sorted, $ints_res_sorted, $noiseThreshold |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
560 ## Output : $mzs_res_noise_threshold, $ints_res_noise_threshold |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
561 ## Usage : my ( $mzs_res_noise_threshold, $ints_res_noise_threshold ) = keep_ions_above_threshold( $mzs_res_sorted, $ints_res_sorted, $noiseThreshold ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
562 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
563 =cut |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
564 ## START of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
565 #sub keep_ions_above_threshold { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
566 # ## Retrieve Values |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
567 # my $self = shift ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
568 # my ($mzs_res_sorted, $ints_res_sorted, $noiseThreshold) = @_ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
569 # |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
570 # my (@mzs_res_noise_threshold, @ints_res_noise_threshold) = ( (),() ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
571 # my (@mzs_res_noise_threshold_temp, @ints_res_noise_threshold_temp) = ( (),() ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
572 # my $i = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
573 # my $j = 0 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
574 # # Case when we have only one array of masses (input is a string of masses and not a file) |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
575 # if ( ref(@$mzs_res_sorted[0]) ne "ARRAY") { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
576 # |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
577 # while( @$ints_res_sorted[$i] > $noiseThreshold && $i < scalar @$mzs_res_sorted) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
578 # |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
579 # push ( @mzs_res_noise_threshold , @$mzs_res_sorted[$i] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
580 # push ( @ints_res_noise_threshold , @$ints_res_sorted[$i] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
581 # $i++ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
582 # } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
583 # } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
584 # else { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
585 # while( $i < @$ints_res_sorted ) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
586 # |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
587 # while( $$ints_res_sorted[$i][$j] > $noiseThreshold && $j < scalar @$ints_res_sorted[$i]) { |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
588 # |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
589 # push ( @mzs_res_noise_threshold_temp , $$mzs_res_sorted[$i][$j] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
590 # push ( @ints_res_noise_threshold_temp , $$ints_res_sorted[$i][$j] ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
591 # $j++ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
592 # } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
593 # push ( @mzs_res_noise_threshold , \@mzs_res_noise_threshold_temp ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
594 # push ( @ints_res_noise_threshold , \@ints_res_noise_threshold_temp ) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
595 # $i++ ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
596 # } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
597 # } |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
598 # |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
599 # return (\@mzs_res_noise_threshold, \@ints_res_noise_threshold) ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
600 #} |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
601 ## END of SUB |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
602 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
603 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
604 #******************************************************************************************************** |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
605 #******************************************************************************************************** |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
606 #******************************************************************************************************** |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
607 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
608 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
609 1 ; |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
610 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
611 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
612 __END__ |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
613 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
614 =head1 SUPPORT |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
615 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
616 You can find documentation for this module with the perldoc command. |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
617 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
618 perldoc csv.pm |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
619 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
620 =head1 Exports |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
621 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
622 =over 4 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
623 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
624 =item :ALL is get_spectra |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
625 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
626 =back |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
627 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
628 =head1 AUTHOR |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
629 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
630 Gabriel Cretin E<lt>gabriel.cretin@clermont.inra.frE<gt> |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
631 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
632 =head1 LICENSE |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
633 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
634 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
635 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
636 =head1 VERSION |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
637 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
638 version 1 : 03 / 06 / 2016 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
639 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
640 version 2 : 24 / 06 / 2016 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
641 |
e3d43b8c987b
Init repository with last tool-bank-golm-lib_search master version
fgiacomoni
parents:
diff
changeset
|
642 =cut |