Mercurial > repos > fgiacomoni > hmdb_ms_search
comparison wsdl_hmdb.pl @ 23:2d8a310e86ce draft
Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
author | fgiacomoni |
---|---|
date | Thu, 19 May 2022 13:43:09 +0000 |
parents | 453fbe98925a |
children | d8e2ede293a6 |
comparison
equal
deleted
inserted
replaced
22:453fbe98925a | 23:2d8a310e86ce |
---|---|
47 "mode:s" => \$molecular_species, ## Molecular species (positive/negative/neutral) | 47 "mode:s" => \$molecular_species, ## Molecular species (positive/negative/neutral) |
48 "maxquery:i" => \$max_query, ## Maximum query return (default is 20 entries by query // min 1 & max 50 ) | 48 "maxquery:i" => \$max_query, ## Maximum query return (default is 20 entries by query // min 1 & max 50 ) |
49 "output_tabular:s" => \$out_tab, ## option : path to the ouput (tabular : input+results ) | 49 "output_tabular:s" => \$out_tab, ## option : path to the ouput (tabular : input+results ) |
50 "output_html|v:s" => \$out_html, ## option : path to the results view (output2) | 50 "output_html|v:s" => \$out_html, ## option : path to the results view (output2) |
51 "output_xlsx:s" => \$out_xls, ## option : path to the xls-like format output | 51 "output_xlsx:s" => \$out_xls, ## option : path to the xls-like format output |
52 "advancedFeatures:i"=> \$advancedFeatures, ## option : set to 1 to get advanced options or 0 to get first level only. | 52 #"advancedFeatures:i"=> \$advancedFeatures, ## option : set to 1 to get advanced options or 0 to get first level only. |
53 "verbose:i" => \$VERBOSE, ## VERBOSE Of the tool | 53 "verbose:i" => \$VERBOSE, ## VERBOSE Of the tool |
54 ) ; | 54 ) ; |
55 | 55 |
56 #============================================================================= | 56 #============================================================================= |
57 # EXCEPTIONS | 57 # EXCEPTIONS |
135 my $submasses = $oHmdb->extract_sub_mz_lists($masses, $CONF->{HMDB_LIMITS} ) ; | 135 my $submasses = $oHmdb->extract_sub_mz_lists($masses, $CONF->{HMDB_LIMITS} ) ; |
136 | 136 |
137 print "\tand ".scalar(@$masses)." masses are submitted as ".scalar(@$submasses)." queries to HMDB \n\n" if ($VERBOSE>1) ; | 137 print "\tand ".scalar(@$masses)." masses are submitted as ".scalar(@$submasses)." queries to HMDB \n\n" if ($VERBOSE>1) ; |
138 | 138 |
139 ## get the hmdb server status by a test query - continuous queries or kill script. | 139 ## get the hmdb server status by a test query - continuous queries or kill script. |
140 $status = $oHmdb->testMatchesFromHmdbWithUA() ; | 140 $status = $oHmdb->testMatchesFromHmdb5WithUA() ; |
141 $oHmdb->check_state_from_hmdb_ua($status) ; ## can kill the script execution | 141 $oHmdb->check_state_from_hmdb_ua($status) ; ## can kill the script execution |
142 | 142 |
143 my $cluster = 1 ; | 143 my $cluster = 1 ; |
144 foreach my $mzs ( @{$submasses} ) { | 144 foreach my $mzs ( @{$submasses} ) { |
145 # print Dumper $mzs ; | 145 # print Dumper $mzs ; |
149 my ( $hmdb_masses, $nb_masses_to_submit ) = $oHmdb->prepare_multi_masses_query($mzs) ; | 149 my ( $hmdb_masses, $nb_masses_to_submit ) = $oHmdb->prepare_multi_masses_query($mzs) ; |
150 my ($hmdb_adducts, $nb_selected_adducts) = $oHmdb->prepareAdductListFormat($adductType) ; | 150 my ($hmdb_adducts, $nb_selected_adducts) = $oHmdb->prepareAdductListFormat($adductType) ; |
151 | 151 |
152 print "\n\tSubmission of m/z cluster ".sprintf '%04s',$cluster."" if ($VERBOSE>1) ; | 152 print "\n\tSubmission of m/z cluster ".sprintf '%04s',$cluster."" if ($VERBOSE>1) ; |
153 | 153 |
154 ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdbWithUA($hmdb_masses, $delta, $molecular_species, $hmdb_adducts) ; | 154 ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_masses, $delta, $molecular_species, $hmdb_adducts) ; |
155 print "...HMDB reply results with status: $status\n" if ($VERBOSE>1) ; | 155 print "...HMDB reply results with status: $status\n" if ($VERBOSE>1) ; |
156 | 156 |
157 # print Dumper $hmdb_pages ; | 157 # print Dumper $hmdb_pages ; |
158 | 158 |
159 sleep(1) ; | 159 sleep(1) ; |
160 | 160 |
161 ## hard modification with $max_query fixed at 1000 !!! Need to be refactoring | 161 ## hard modification with $max_query fixed at 1000 !!! Need to be refactoring |
162 ## Cutof will be done in next method after URI check | 162 ## Cutof will be done in next method after URI check |
163 ($result) = $oHmdb->parse_hmdb_csv_results($hmdb_pages, $mzs, 1000) ; ## hash format result | 163 ($result) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_pages, $mzs, 1000) ; ## hash format result |
164 | 164 |
165 ## This previous step return results with cutoff on the number of entries returned ! | 165 ## This previous step return results with cutoff on the number of entries returned ! |
166 | 166 |
167 ## clean/max result by testing each HMDB_ID page in HMDB | 167 ## clean/max result by testing each HMDB_ID page in HMDB |
168 ($cleanedResult) = $oHmdb->checkHmdbUrlEntries($CONF->{'HMDB_METABOCARD_URL'}, $result, $max_query ) ; | 168 ($cleanedResult) = $oHmdb->checkHmdbUrlEntries($CONF->{'HMDB_METABOCARD_URL'}, $result, $max_query ) ; |
213 if ( ( defined $out_html ) and ( defined $results ) ) { | 213 if ( ( defined $out_html ) and ( defined $results ) ) { |
214 my $oHtml = lib::hmdb::new() ; | 214 my $oHtml = lib::hmdb::new() ; |
215 my ($tbody_object) = $oHtml->set_html_tbody_object( $nb_pages_for_html_out, $CONF->{HTML_ENTRIES_PER_PAGE} ) ; | 215 my ($tbody_object) = $oHtml->set_html_tbody_object( $nb_pages_for_html_out, $CONF->{HTML_ENTRIES_PER_PAGE} ) ; |
216 ($tbody_object) = $oHtml->add_mz_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $ids) ; | 216 ($tbody_object) = $oHtml->add_mz_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $ids) ; |
217 ($tbody_object) = $oHtml->add_entries_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $results) ; | 217 ($tbody_object) = $oHtml->add_entries_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $results) ; |
218 | |
219 print Dumper $tbody_object ; | |
220 | |
221 | |
218 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'}) ; | 222 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'}) ; |
219 | 223 |
220 } ## END IF | 224 } ## END IF |
221 else { | 225 else { |
222 warn "Can't create a HTML output for HMDB : no result found or your output file is not defined\n" ; | 226 warn "Can't create a HTML output for HMDB : no result found or your output file is not defined\n" ; |
303 wsdl_hmdb.pl -masses [an input file of mzs] -colfactor [col of mz] -header_choice [yes|no] -nblineheader [nb of lines containing file header : 0-n] | 307 wsdl_hmdb.pl -masses [an input file of mzs] -colfactor [col of mz] -header_choice [yes|no] -nblineheader [nb of lines containing file header : 0-n] |
304 -delta [mz delta] -mode [molecular species: positive|negative|neutral] -output [output tabular file] -view [output html file] | 308 -delta [mz delta] -mode [molecular species: positive|negative|neutral] -output [output tabular file] -view [output html file] |
305 | 309 |
306 =head1 SYNOPSIS | 310 =head1 SYNOPSIS |
307 | 311 |
308 This script manages batch queries on HMDB server. | 312 This script manages batch queries on HMDB server (v5.0). |
309 | 313 |
310 =head1 DESCRIPTION | 314 =head1 DESCRIPTION |
311 | 315 |
312 This main program is a script to query HMDB website using mz and return a list of candidates sent by HMDB based on the ms search tool. | 316 This main program is a script to query HMDB website using mz and return a list of candidates sent by HMDB based on the ms search tool. |
313 | 317 |
341 | 345 |
342 version 1.6 : 23 / 01 / 2019 - Manage UA http error and advanced feature from hmdb. | 346 version 1.6 : 23 / 01 / 2019 - Manage UA http error and advanced feature from hmdb. |
343 | 347 |
344 version 1.6.1 : 30 / 01 / 2019 - Adding adducts and fixxing minors bugs and requirements | 348 version 1.6.1 : 30 / 01 / 2019 - Adding adducts and fixxing minors bugs and requirements |
345 | 349 |
350 version 1.7.0 : 19/ 05 / 2022 - Update HMDB API client - compliant with HMDB 5.0 web portal | |
351 | |
346 =cut | 352 =cut |