Mercurial > repos > fgiacomoni > bank_inhouse
comparison bank_inhouse.pl @ 0:be582bcd6585 draft
Master branch Updating - - Fxx
author | fgiacomoni |
---|---|
date | Thu, 04 Oct 2018 10:37:14 -0400 |
parents | |
children | 52798007c6b2 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:be582bcd6585 |
---|---|
1 #!perl | |
2 | |
3 ## script : bank_inhouse.pl | |
4 #============================================================================= | |
5 # Included modules and versions | |
6 #============================================================================= | |
7 ## Perl modules | |
8 use strict ; | |
9 use warnings ; | |
10 use Carp qw (cluck croak carp) ; | |
11 | |
12 use Data::Dumper ; | |
13 use Getopt::Long ; | |
14 use POSIX ; | |
15 use List::Util qw( min max ); | |
16 use FindBin ; ## Allows you to locate the directory of original perl script | |
17 | |
18 ## Specific Modules | |
19 use lib $FindBin::Bin ; | |
20 my $binPath = $FindBin::Bin ; | |
21 use lib::bih qw( :ALL ) ; | |
22 | |
23 ## PFEM Perl Modules | |
24 use lib::conf qw( :ALL ) ; | |
25 use lib::csv qw( :ALL ) ; | |
26 | |
27 ## Initialized values | |
28 my ( $help ) = ( undef ) ; | |
29 my ( $mass ) = ( undef ) ; | |
30 my ( $masses_file, $nbline_header, $col_mass ) = ( undef, undef, undef ) ; | |
31 my ( $col_rt, $manual_rt, $rt_delta, $mz_delta_type, $mz_delta, $rtdb ) = ( undef, undef, undef, undef, undef, undef ) ; | |
32 my ( $mode, $tissues, $bank_in, $bank_name, $col_mzdb) = ( undef, undef, undef, undef, undef ) ; | |
33 my ( $out_tab, $out_html, $out_xls, $out_json, $out_full ) = ( undef, undef, undef, undef, undef ) ; | |
34 my ($rest_mode) = ('no') ; | |
35 | |
36 my ( $verbose ) = ( 2 ) ; ## verbose level is 3 for debugg | |
37 | |
38 #============================================================================= | |
39 # Manage EXCEPTIONS | |
40 #============================================================================= | |
41 | |
42 &GetOptions ( "h" => \$help, # HELP | |
43 "masse:s" => \$mass, ## option : one masse | |
44 "input:s" => \$masses_file, ## option : path to the input | |
45 "rest:s" => \$rest_mode, ## option : allow uses of peakforest rest service | |
46 "nbheader:i" => \$nbline_header, ## numbre of header line present in file | |
47 "colrt:i" => \$col_rt, ## Column retention time for retrieve formula/masses list in tabular file | |
48 "rt:s" => \$manual_rt, ## Retention time for manual masses list | |
49 "rt_delta:f" => \$rt_delta, ## Delta for retention time | |
50 "colmass:i" => \$col_mass, ## Column id for retrieve formula list in tabular file | |
51 "mz_delta:s" => \$mz_delta_type, ## Delta type for masses | |
52 "mass_delta:f" => \$mz_delta, ## Delta for masses | |
53 "mode:s" => \$mode, ## Molecular species (positive/negative/neutral) | |
54 "tissues:s" => \$tissues, ## Restricted to certain characterization and localization (blood/plasma/urine/peptide) | |
55 "bank_in:s" => \$bank_in, ## option : path to a personal data bank | |
56 "bank_name:s" => \$bank_name, ## option : name of the bank | |
57 "mzdb:i" => \$col_mzdb, ## Column number in which is the masses of the personal data bank | |
58 "rtdb:i" => \$rtdb, ## Column number in which is the retention time of the personal data bank | |
59 "outputJson:s" => \$out_json, ## option : path to the ouput (results) | |
60 "outputXls:s" => \$out_xls, ## option : path to the ouput (tabular : results ) | |
61 "outputTab:s" => \$out_tab, ## path to the ouput (tabular : input+results (1 col) ) | |
62 "outputView:s" => \$out_html, ## option : path to the results view (output2) | |
63 "outputFull:s" => \$out_full, ## path to the ouput (tabular : input+results (x col) ) | |
64 ) ; | |
65 | |
66 #============================================================================= | |
67 # EXCEPTIONS | |
68 #============================================================================= | |
69 ## if you put the option -help or -h function help is started | |
70 if ( defined $help ) { &help() ; } | |
71 | |
72 #============================================================================= | |
73 # MAIN SCRIPT | |
74 #============================================================================= | |
75 | |
76 | |
77 print "The bank_inhouse program is launched as:\n"; | |
78 print "./bank_inhouse.pl " ; | |
79 print "--h " if (defined $help) ; | |
80 print "--masse $mass " if (defined $mass) ; | |
81 print "--input $masses_file " if (defined $masses_file) ; | |
82 print "--rest $rest_mode " if (defined $rest_mode) ; | |
83 print "--nbheader $nbline_header " if (defined $nbline_header) ; | |
84 print "--colrt $col_rt " if (defined $col_rt) ; | |
85 print "--rt $manual_rt " if (defined $manual_rt) ; | |
86 print "--colmass $col_mass " if (defined $col_mass) ; | |
87 print "--mz_delta $mz_delta_type " if (defined $mz_delta_type) ; | |
88 print "--mass_delta $mz_delta " if (defined $mz_delta) ; | |
89 print "--mode $mode " if (defined $mode) ; | |
90 print "--tissues $tissues " if (defined $tissues) ; | |
91 print "--bank_in $bank_in " if (defined $bank_in) ; | |
92 print "--bank_name $bank_name " if (defined $bank_name) ; | |
93 print "--mzdb $col_mzdb " if (defined $col_mzdb) ; | |
94 print "--rtdb $rtdb " if (defined $rtdb) ; | |
95 print "--outputJson $out_json " if (defined $out_json) ; | |
96 print "--outputXls $out_xls " if (defined $out_xls) ; | |
97 print "--outputTab $out_tab " if (defined $out_tab) ; | |
98 print "--outputView $out_html " if (defined $out_html) ; | |
99 print "--outputFull $out_full " if (defined $out_full) ; | |
100 print "\n" ; | |
101 | |
102 | |
103 | |
104 ## -------------- Conf file ------------------------ : | |
105 my ( $CONF, $PF_CONF ) = ( undef, undef ) ; | |
106 foreach my $conf ( <$binPath/*.cfg> ) { | |
107 my $oConf = lib::conf::new() ; | |
108 $CONF = $oConf->as_conf($conf) ; | |
109 } | |
110 | |
111 ## PForest dedicated conf | |
112 if ((defined $rest_mode ) and ( $rest_mode eq "yes" )) { | |
113 foreach my $ini ( <$binPath/*.ini> ) { | |
114 my $oConf = lib::conf::new() ; | |
115 $PF_CONF = $oConf->as_conf($ini) ; | |
116 } | |
117 } | |
118 | |
119 ## --------------- Global parameters ---------------- : | |
120 my ( $masses, $rt, $results, $header_choice ) = ( undef, undef, undef, undef, undef ) ; ############## | |
121 my ( $complete_rows, $nb_pages_for_html_out ) = ( undef, 1 ) ; | |
122 | |
123 my $oBih = lib::bih::new() ; | |
124 | |
125 ## --------------- retrieve input data -------------- : | |
126 | |
127 ## manage manual mass(es) | |
128 if ( ( defined $mass ) and ( $mass ne "" ) ) { | |
129 $mass =~ tr/,/./ ; | |
130 @$masses = split(' ', $mass); | |
131 if ( ( defined $manual_rt ) and ( $manual_rt ne "" ) ) { | |
132 $manual_rt =~ tr/,/./ ; | |
133 @$rt = split(' ', $manual_rt) ; | |
134 if ( $#$rt != $#$masses) { croak "You have not given the same number of masses and retention time\n" ; } | |
135 } | |
136 } ## END IF | |
137 | |
138 ## manage csv file containing list of masses | |
139 elsif ( ( defined $masses_file ) and ( $masses_file ne "" ) and ( -e $masses_file ) ) { | |
140 ## parse all csv for later : output csv build | |
141 my $ocsv_input = lib::csv->new() ; | |
142 my $complete_csv = $ocsv_input->get_csv_object( "\t" ) ; | |
143 $complete_rows = $ocsv_input->parse_csv_object($complete_csv, \$masses_file) ; | |
144 | |
145 ## parse csv ids and masses | |
146 my $ocsv = lib::csv->new() ; | |
147 my $csv = $ocsv->get_csv_object( "\t" ) ; | |
148 if ( ( defined $nbline_header ) and ( $nbline_header > 0 ) ) { $header_choice = 'yes' ; } else{ $header_choice = 'no' ; } | |
149 $masses = $ocsv->get_value_from_csv_multi_header( $csv, $masses_file, $col_mass, $header_choice, $nbline_header ) ; ## retrieve mz values on csv | |
150 if ( ( defined $col_rt ) and ( $col_rt ne "" ) ) { | |
151 $rt = $ocsv->get_value_from_csv_multi_header( $csv, $masses_file, $col_rt, $header_choice, $nbline_header ) ; ## retrieve rt values on csv | |
152 } | |
153 } | |
154 | |
155 # --------------- retrieve personal data bank input -------------- : | |
156 | |
157 my ($complete_bank, $bank_head) = (undef, undef) ; | |
158 | |
159 ## check up $bank_in and parse | |
160 if ( ( defined $bank_in ) and ( $bank_in ne '' ) and ( -e $bank_in ) and ( defined $col_mzdb ) and ( $col_mzdb ne '' ) ) { | |
161 ## parse csv bank_in | |
162 my $ocsv_input = lib::csv->new() ; | |
163 my $complete_csv = $ocsv_input->get_csv_object( "\t" ) ; | |
164 ($complete_bank, $bank_head)= $oBih->parse_bank_interest($complete_csv, \$bank_in, $col_mzdb-1) ; | |
165 } | |
166 ## manage rest service of PeakForest and set $masses and $rt with given databases | |
167 elsif ( ( defined $rest_mode ) and ( $rest_mode eq "yes" ) ) { | |
168 $bank_name = "PeakForest"; | |
169 if ( ( $PF_CONF->{PF_GLOBAL_TOKEN} ne "" ) and ( $PF_CONF->{PF_WS_URL} ne "" ) ) { | |
170 ## init | |
171 my $opfws = lib::bih::new() ; | |
172 ## get min and max values of user query | |
173 my ($min, $max) = (0, 0) ; | |
174 | |
175 if ( ( defined $masses ) and ( scalar (@{$masses}) > 0 ) ) { | |
176 $min = min @{$masses} ; | |
177 $max = max @{$masses} ; | |
178 # print Dumper $masses ; | |
179 ## TODO: adjust min and max with delta | |
180 my ( $min_delta, undef ) = $opfws->mz_delta_conversion(\$min, \$mz_delta_type, \$mz_delta) ; | |
181 my ( undef, $max_delta ) = $opfws->mz_delta_conversion(\$max, \$mz_delta_type, \$mz_delta) ; | |
182 | |
183 ## get clean range database json from PForest WS : | |
184 my $pf_json = $opfws->db_pforest_get_clean_range($PF_CONF->{PF_WS_URL}, $PF_CONF->{PF_REST_QUERY_CLEAN_RANGE}, $$min_delta, $$max_delta, $mode) ; | |
185 if (defined $pf_json) { | |
186 ($complete_bank, $bank_head) = $opfws->map_pfjson_bankobject($pf_json) ; | |
187 } | |
188 } ## End IF | |
189 else { | |
190 croak "Fatal error : your mass list is empty\n" ; | |
191 } | |
192 } ## End IF PForest param | |
193 else { croak "Can't work : missing a PForest REST paramater\n" ; } | |
194 } ## End ELSIF PForest | |
195 elsif ( ( defined $CONF->{'INHOUSE_BANK'} ) and ( $CONF->{'INHOUSE_BANK'} ne '' ) ) { | |
196 $col_mzdb = 4; | |
197 $bank_name = "internal_bank"; | |
198 if ( (defined $col_rt) or (defined $manual_rt) or (defined $rt_delta) ) { croak "No retention time in the internal bank, please use your own bank\n" ; } | |
199 my $html_file = $binPath.'/'.$CONF->{'INHOUSE_BANK'} ; | |
200 if ( -e $html_file ) { | |
201 ## parse all csv for later : output csv build | |
202 my $ocsv_input = lib::csv->new() ; | |
203 my $complete_csv = $ocsv_input->get_csv_object( "\t" ) ; | |
204 ($complete_bank, $bank_head)= $oBih->parse_bank_interest($complete_csv, \$html_file, $col_mzdb-1) ; | |
205 } | |
206 else { croak "Can't work : no local inhouse bank name '$html_file'\n" ; } | |
207 } | |
208 else { croak "Can't work : missing an inhouse bank\n" ; } | |
209 | |
210 ## ---------------- launch queries -------------------- : | |
211 | |
212 my $ionization = undef ; | |
213 my $characterization = undef ; | |
214 my $valH = undef ; | |
215 my $bank = undef ; | |
216 my $search_condition = undef ; | |
217 | |
218 #($valH, $ionization)= $oBih->manage_mode($mode, $CONF->{'PROTON_MZ'}, $CONF->{'ELECTRON_MZ'}) ; | |
219 | |
220 ######### Manage Tissues ############################################################################## | |
221 #if ( ( !defined $tissues ) or ( $tissues eq '' ) or ( $tissues eq 'none' ) ) { | |
222 # $characterization = ['None']; | |
223 #} else { @{$characterization} = split(",", $tissues); } | |
224 ######### End ######################################################################################### | |
225 | |
226 #if ( (@$ionization = (['None'])) and (@$characterization = (['None']))) { $bank = $complete_bank; } | |
227 #else { $bank = FILTER LA BANK; } | |
228 $bank = $complete_bank; | |
229 $valH = 0 ; | |
230 | |
231 #if ( ( defined $mz_delta ) and ( $mz_delta > 0 ) and ( defined $ionization ) and ( defined $characterization ) and ( defined $masses ) and ( defined $ids ) and ( defined $bank ) ) { | |
232 # $search_condition = "Search params : Molecular specie = $mode / delta = $mz_delta / characterization and localization = $tissues \n bank file = $bank_in" ; | |
233 | |
234 if ( ( defined $mz_delta ) and ( $mz_delta >= 0 ) and ( defined $masses ) and ( defined $bank ) ) { | |
235 ## prepare masses list and execute query | |
236 $results = [] ; | |
237 if ($mz_delta != 0){ | |
238 my @sort_masses_bank = sort { $a <=> $b } keys(%$bank); | |
239 | |
240 my $compt_masses = 0; | |
241 foreach my $mz (@$masses) { | |
242 $compt_masses++; | |
243 my ($MZmessage) = $oBih->check_interval($mz, 0, 10000) ; | |
244 if ( $MZmessage eq 'OK' ){ | |
245 my ( $min, $max ) = $oBih->mz_delta_conversion(\$mz, \$mz_delta_type, \$mz_delta) ; | |
246 | |
247 my ($marj_inf) = $oBih->dichotomi_search(\@sort_masses_bank, $min) ; | |
248 my ($marj_sup) = $oBih->dichotomi_search(\@sort_masses_bank, $max) ; | |
249 | |
250 my $result = []; | |
251 if($$marj_inf != $$marj_sup){ | |
252 if ($$marj_inf == -1){ $$marj_inf=0; } | |
253 for (my $i=$$marj_inf; $i<$$marj_sup; $i++){ | |
254 my $bank_tmp = $$bank{$sort_masses_bank[$i]}; | |
255 if ( ( defined $rt ) and ( $rt ne "" ) ) { | |
256 my ($RTmessage) = $oBih->check_interval($$rt[$compt_masses-1], 0, 60) ; | |
257 if ( $RTmessage eq 'OK' ){ | |
258 my $bank_rt = []; | |
259 for(my $nb_rt=0; $nb_rt<=$#$bank_tmp; $nb_rt++){ | |
260 my ($RTbank) = $oBih->check_interval($bank_tmp->[$nb_rt]->[$rtdb-1], 0, 60) ; | |
261 my ($RTsearch) = $oBih->check_interval($bank_tmp->[$nb_rt]->[$rtdb-1], $$rt[$compt_masses-1]-$rt_delta, $$rt[$compt_masses-1]+$rt_delta) ; | |
262 if ( ($RTbank eq 'OK') and ($RTsearch eq 'OK') ){ | |
263 push (@$result, $bank_tmp->[$nb_rt]) ; | |
264 } | |
265 elsif ($RTbank ne 'OK'){ croak "At least one retention time in bank is not valid : $RTbank\n" ; } | |
266 } | |
267 } | |
268 else { croak "The $compt_masses th analyzed retention time : $RTmessage\n" ; } | |
269 } | |
270 else { push (@$result, @$bank_tmp) ; } | |
271 } | |
272 } | |
273 else{ $result = []; } | |
274 push (@$results, [@$result]) ; | |
275 } | |
276 else { croak "The $compt_masses th value : $MZmessage\n" ; } | |
277 print Dumper $results if ($verbose>2) ; | |
278 } ## End FOREACH MZ queried | |
279 } ## End IF | |
280 else{ | |
281 my $result = []; | |
282 my $compt_masses = 0; | |
283 foreach my $mz (@$masses) { | |
284 $compt_masses++; | |
285 my ($MZmessage) = $oBih->check_interval($mz, 0, 10000) ; | |
286 if ( $MZmessage eq 'OK' ){ | |
287 if ($$bank{$mz}){ | |
288 my $bank_tmp = $$bank{$mz}; | |
289 if ( ( defined $rt ) and ( $rt ne "" ) ) { | |
290 my ($RTmessage) = $oBih->check_interval($$rt[$compt_masses-1], 0, 60) ; | |
291 if ( $RTmessage eq 'OK' ){my $bank_rt = []; | |
292 for(my $nb_rt=0; $nb_rt<=$#$bank_tmp; $nb_rt++){ | |
293 my ($RTbank) = $oBih->check_interval($bank_tmp->[$nb_rt]->[$rtdb-1], 0, 60) ; | |
294 my ($RTsearch) = $oBih->check_interval($bank_tmp->[$nb_rt]->[$rtdb-1], $$rt[$compt_masses-1]-$rt_delta, $$rt[$compt_masses-1]+$rt_delta) ; | |
295 if ( ($RTbank eq 'OK') and ($RTsearch eq 'OK') ){ | |
296 push (@$bank_rt, $bank_tmp->[$nb_rt]) ; | |
297 } | |
298 elsif ($RTbank ne 'OK'){ croak "At least one retention time in bank is not valid : $RTbank\n" ; } | |
299 } | |
300 if ($#$bank_rt>=0){ ## If there is at least one result | |
301 push (@$result, $bank_rt) ; | |
302 } ## else $bank_rt = [] as defined | |
303 } | |
304 else { croak "The $compt_masses th analyzed retention time : $RTmessage\n" ; } | |
305 } | |
306 else { push (@$result, [$bank_tmp]) ; } | |
307 } | |
308 else { push (@$result, [] ) ; } | |
309 } | |
310 else { croak "The $compt_masses th mass : $MZmessage\n" ; } | |
311 } | |
312 $results = [@$results, @$result] ; | |
313 } | |
314 } | |
315 else { | |
316 croak "Can't work : missing paramaters (list of ids, masses, delta, ionization, characterization or inhouse_bank)\n" ; | |
317 } ## end ELSE | |
318 | |
319 | |
320 if ( ( defined $rt ) and ( $rt ne "" ) ) { unshift (@$bank_head, ("DELTA_mass(".$mz_delta.$mz_delta_type.")", "MASS_Result", "DELTA_RT(".$rt_delta.")", "RT_Result")) ; } | |
321 else { unshift (@$bank_head, ("DELTA_mass(".$mz_delta.$mz_delta_type.")", "MASS_Result")) ; } | |
322 | |
323 | |
324 ## -------------- Produce JSON output ------------------ : | |
325 if ( ( defined $out_json ) and ( defined $results ) ) { | |
326 open(JSON, '>:utf8', "$out_json") or die "Cant' create the json file\n" ; | |
327 print JSON Dumper $results; | |
328 close(JSON) ; | |
329 } ## END IF | |
330 else { | |
331 #croak "Can't create a json output for Massbank : no result found or your output file is not defined\n" ; | |
332 } | |
333 | |
334 ## -------------- Produce HTML output ------------------ : | |
335 | |
336 #if ( ( defined $out_html ) and ( defined $results ) ) { | |
337 # ## Uses N mz and theirs entries per page (see config file). | |
338 # # how many pages you need with your input mz list? | |
339 # $nb_pages_for_html_out = ceil( scalar(@{$masses} ) / $CONF->{HTML_ENTRIES_PER_PAGE} ) ; | |
340 # | |
341 # my $oHtml = lib::bih::new() ; | |
342 # my ($tbody_object) = $oHtml->set_html_tbody_object( $nb_pages_for_html_out, $CONF->{HTML_ENTRIES_PER_PAGE} ) ; | |
343 # ($tbody_object) = $oHtml->add_mz_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $ids) ; | |
344 # ($tbody_object) = $oHtml->add_entries_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $results) ; | |
345 # print Dumper $tbody_object;exit; | |
346 # my $output_html = $oHtml->write_html_skel(\$out_html, $tbody_object, $nb_pages_for_html_out, $search_condition, $CONF->{'HTML_TEMPLATE'}, $CONF->{'JS_GALAXY_PATH'}, $CONF->{'CSS_GALAXY_PATH'}) ; | |
347 # | |
348 #} ## END IF | |
349 #else { croak "Can't create a HTML output for HMDB : no result found or your output file is not defined\n" ; } | |
350 | |
351 ## -------------- Produce XLS like output ------------------ : | |
352 if ( ( defined $out_xls ) and ( defined $results ) ) { | |
353 my $oxls = lib::bih::new() ; | |
354 $oxls->write_excel_like_mass($masses, $mz_delta_type, $mz_delta, $col_mzdb, $rt, $rt_delta, $rtdb, $results, $out_xls, $bank_head) ; | |
355 } ## END IF | |
356 else { croak "Can't create a tabular output for BiH (like xls): no result found or your output file is not defined\n" ; } | |
357 | |
358 ## -------------- Produce CSV output ------------------ : | |
359 if (defined $results) { | |
360 if ( defined $masses_file ) { # produce a csv based on METLIN format | |
361 if ( defined $out_tab ) { | |
362 my $sep = "#"; | |
363 my $ocsv = lib::bih::new() ; | |
364 my $lm_matrix = undef ; | |
365 if ( ( $header_choice eq 'yes' ) and ( defined $nbline_header ) and ( $nbline_header > 0 )) { | |
366 my $header = join("$sep", @$bank_head); | |
367 my $out_head = "BiH_".$bank_name."_(".$header.")"; | |
368 $lm_matrix = $ocsv->set_lm_matrix_object($out_head, $masses, $col_mzdb, $results, $rt, $rtdb, $bank_head, $sep ) ; | |
369 $lm_matrix = $ocsv->add_lm_matrix_to_input_matrix($complete_rows, $lm_matrix, $nbline_header-1) ; | |
370 } | |
371 elsif ( ( $header_choice eq 'no' ) or ( $nbline_header <= 0 )) { | |
372 $lm_matrix = $ocsv->set_lm_matrix_object(undef, $masses, $col_mzdb, $results, $rt, $rtdb, $bank_head, $sep ) ; | |
373 $lm_matrix = $ocsv->add_lm_matrix_to_input_matrix($complete_rows, $lm_matrix, 0) ; | |
374 } | |
375 else { croak "The number of header line is not identifiable\n" ; } | |
376 $ocsv->write_csv_skel(\$out_tab, $lm_matrix) ; | |
377 } | |
378 else { croak "Can't create a tabular output for BiH : your output file is not defined\n" ; } | |
379 } | |
380 elsif (defined $mass) { } ## no csv output for manual masses | |
381 else { croak "the input format is not identifiable or your output file is not defined\n" ; } | |
382 } ## END IF | |
383 else { croak "Can't create a tabular output for BiH : no result found\n" ; } | |
384 | |
385 ## -------------- Produce Full output ------------------ : | |
386 if (defined $results) { | |
387 if ( defined $masses_file ) { | |
388 if ( defined $out_full ) { | |
389 my $sep = "\t"; | |
390 my $ofull = lib::bih::new() ; | |
391 if ( ( $header_choice eq 'yes' ) and ( defined $nbline_header ) and ( $nbline_header > 0 )) { | |
392 $ofull->write_full_excel_like($complete_rows, $sep, $masses, $mz_delta_type, $mz_delta, $col_mzdb, $rt, $rt_delta, $rtdb, $results, $out_full, $nbline_header, $bank_head, "BiH_$bank_name") ; | |
393 } | |
394 elsif ( ( $header_choice eq 'no' ) or ( $nbline_header <= 0 )) { | |
395 $ofull->write_full_excel_like($complete_rows, $sep, $masses, $mz_delta_type, $mz_delta, $col_mzdb, $rt, $rt_delta, $rtdb, $results, $out_full, 0, undef, undef) ; | |
396 } | |
397 else { croak "The number of header line is not identifiable\n" ; } | |
398 } | |
399 } | |
400 elsif (defined $mass) { } ## no csv output for manual masses | |
401 else { croak "the input format is not identifiable or your output file is not defined\n" ; } | |
402 } ## END IF | |
403 else { croak "Can't create a full output for BiH : no result found\n" ; } | |
404 | |
405 | |
406 #==================================================================================== | |
407 # Help subroutine called with -h option | |
408 # number of arguments : 0 | |
409 # Argument(s) : | |
410 # Return : 1 | |
411 #==================================================================================== | |
412 sub help { | |
413 print STDERR " | |
414 bank_inhouse | |
415 | |
416 # bank_inhouse is a script to query a in house bank (file) using chemical mass and return a list of common names. | |
417 # Input : mass or list of masses | |
418 # Author : Marion LANDI and Franck Giacomoni (for the Rest part) | |
419 # Email : franck.giacomoni\@clermont.inra.fr | |
420 # Version : 1.1 | |
421 # Created : 15/10/2014 | |
422 # Updated : 15/12/2015 | |
423 USAGE : | |
424 bank_inhouse.pl -masse [mass] | |
425 -tolerance [Delta of mass (Da)] -mode [Ionization type: positive/negative/neutral] | |
426 -tissues [Restricted to certain tissues] -- optionnal | |
427 -bank_in [file for in personal house bank] -- optionnal | |
428 -outputTab [output file tabular format] -outputView [output file html format] | |
429 -verbose | |
430 OR | |
431 bank_inhouse.pl -input [path to list of masses file] | |
432 -nbHeader [nb of lines of headers : 0-n] -colId [Ids colunm number in input file] -colmass [masses col] -colrt [RT col] | |
433 -tolerance [Delta of mass (Da)] -mode [molecular type: positive/negative/neutral] | |
434 -bank_in [file for in house bank] | |
435 -tissues [Restricted to certain tissues] | |
436 -outputTab [output file tabular format] -outputView [output file html format] | |
437 | |
438 OR | |
439 bank_inhouse.pl -masse [mass] | |
440 -rest [get the PeakForest ref db : yes|no] | |
441 -mz_delta [Delta type for mass (Da or PPM)] -mass_delta [Delta for mass (Da or PPM)] -mode [molecular type: positive/negative/neutral] | |
442 -outputXls [output xls format] | |
443 | |
444 Others output formats: | |
445 -outputJson [output json format] -outputFull [output format is input+res] | |
446 "; | |
447 exit(1); | |
448 } | |
449 | |
450 ## END of script - M Landi | |
451 | |
452 __END__ | |
453 | |
454 =head1 NAME | |
455 | |
456 bank_inhouse.pl -- script for | |
457 | |
458 =head1 USAGE | |
459 | |
460 bank_inhouse.pl -precursors -arg1 [-arg2] | |
461 or bank_inhouse.pl -help | |
462 | |
463 =head1 SYNOPSIS | |
464 | |
465 This script manage ... | |
466 | |
467 =head1 DESCRIPTION | |
468 | |
469 This main program is a ... | |
470 | |
471 =over 4 | |
472 | |
473 =item B<function01> | |
474 | |
475 =item B<function02> | |
476 | |
477 =back | |
478 | |
479 =head1 AUTHOR | |
480 | |
481 Marion LANDI E<lt>marion.landi@clermont.inra.frE<gt> | |
482 | |
483 =head1 LICENSE | |
484 | |
485 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | |
486 | |
487 =head1 VERSION | |
488 | |
489 version 1 : 15 / 10 / 2014 | |
490 | |
491 version 2 : 21 / 11 / 2014 | |
492 | |
493 =cut |