annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
1 #!perl
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
2
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
3 ## script : wsdl_hmdb.pl
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
4 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
5 # Included modules and versions
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
6 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
7 ## Perl modules
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
8 use strict ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
9 use warnings ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
10 use Carp qw (cluck croak carp) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
11
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
12 use Data::Dumper ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
13 use Getopt::Long ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
14 use POSIX ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
15 use FindBin ; ## Permet de localisez le repertoire du script perl d'origine
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
16
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
17 ## Specific Modules (Home made...)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
18 use lib $FindBin::Bin ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
19 my $binPath = $FindBin::Bin ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
20 use lib::hmdb qw( :ALL ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
21 ## PFEM Perl Modules
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
22 use lib::conf qw( :ALL ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
23 use lib::csv qw( :ALL ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
24
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
25 ## Initialized values
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
26 my ( $help ) = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
27 my ( $mass ) = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
28 my ( $masses_file, $col_id, $col_mass, $header_choice, $nbline_header ) = ( undef, undef, undef, undef, undef ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
29 my $max_query = undef ;
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
30 my ( $adductType, $delta, $molecular_species, $out_tab, $out_html, $out_xls ) = ( undef, undef, undef, undef, undef, undef ) ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
31 my $advancedFeatures = 0 ;
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
32 my $VERBOSE = ( 3 ) ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
33
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
34
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
35 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
36 # Manage EXCEPTIONS
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
37 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
38
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
39 &GetOptions ( "h" => \$help, # HELP
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
40 "mass:s" => \$mass, ## option : one masse
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
41 "masses:s" => \$masses_file, ## option : path to the input
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
42 "header_choice:s" => \$header_choice, ## Presence or not of header in tabular file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
43 "nblineheader:i" => \$nbline_header, ## numbre of header line present in file
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
44 "colfactor:i" => \$col_mass, ## Column id for retrieve formula list in tabular file
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
45 "adduct_type:s" => \$adductType, ## A list of selected adducts
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
46 "delta:f" => \$delta,
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
47 "mode:s" => \$molecular_species, ## Molecular species (positive/negative/neutral)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
48 "maxquery:i" => \$max_query, ## Maximum query return (default is 20 entries by query // min 1 & max 50 )
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
49 "output_tabular:s" => \$out_tab, ## option : path to the ouput (tabular : input+results )
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
50 "output_html|v:s" => \$out_html, ## option : path to the results view (output2)
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
51 "output_xlsx:s" => \$out_xls, ## option : path to the xls-like format output
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
52 #"advancedFeatures:i"=> \$advancedFeatures, ## option : set to 1 to get advanced options or 0 to get first level only.
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
53 "verbose:i" => \$VERBOSE, ## VERBOSE Of the tool
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
54 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
55
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
56 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
57 # EXCEPTIONS
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
58 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
59 $help and &help ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
60
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
61 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
62 # MAIN SCRIPT
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
63 #=============================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
64
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
65 print "* * * The hmdb client program is launched: * * *\n" if ($VERBOSE>1) ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
66
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
67 ## -------------- Conf file ------------------------ :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
68 my ( $CONF ) = ( undef ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
69 foreach my $conf ( <$binPath/*.cfg> ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
70 my $oConf = lib::conf::new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
71 $CONF = $oConf->as_conf($conf) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
72 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
73
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
74 ## -------------- HTML template file ------------------------ :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
75 foreach my $html_template ( <$binPath/*.tmpl> ) { $CONF->{'HTML_TEMPLATE'} = $html_template ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
76
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
77 if (!defined $max_query) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
78 $max_query = $CONF->{'HMDB_MAX_QUERY'} ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
79 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
80
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
81
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
82 ## --------------- Global parameters ---------------- :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
83 my ( $ids, $masses, $results ) = ( undef, undef, undef ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
84 my ( $complete_rows, $nb_pages_for_html_out ) = ( undef, 1 ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
85 my $metabocard_features = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
86 my $search_condition = "Search params : Molecular specie = $molecular_species / delta (mass-to-charge ratio) = $delta" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
87
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
88 print "\twith $search_condition\n" if ($VERBOSE>1) ;
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
89
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
90 ## $adductType
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
91 if (defined $adductType ) {
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
92 print "\twith Adducts: $adductType\n" if ($VERBOSE>1) ;
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
93 }
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
94
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
95
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
96 ## --------------- retrieve input data -------------- :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
97
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
98 ## manage only one mass
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
99 if ( ( defined $mass ) and ( $mass ne '' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
100 my @masses = split(" ", $mass);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
101 $masses = \@masses ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
102 for (my $i=1 ; $i<=$#masses+1 ; $i++){ push (@$ids,"mz_0".sprintf("%04s", $i ) ); }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
103 } ## END IF
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
104 ## manage csv file containing list of masses
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
105 elsif ( ( defined $masses_file ) and ( $masses_file ne "" ) and ( -e $masses_file ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
106 ## parse all csv for later : output csv build
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
107 my $ocsv_input = lib::csv->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
108 my $complete_csv = $ocsv_input->get_csv_object( "\t" ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
109 $complete_rows = $ocsv_input->parse_csv_object($complete_csv, \$masses_file) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
110
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
111 ## parse masses and set ids
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
112 my $ocsv = lib::csv->new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
113 my $csv = $ocsv->get_csv_object( "\t" ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
114 if ( ( !defined $nbline_header ) or ( $nbline_header < 0 ) ) { $nbline_header = 0 ; }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
115 $masses = $ocsv->get_value_from_csv_multi_header( $csv, $masses_file, $col_mass, $header_choice, $nbline_header ) ; ## retrieve mz values on csv
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
116 my $nbmz = @$masses ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
117 for (my $i=1 ; $i<=$nbmz+1 ; $i++){ push (@$ids,"mz_0".sprintf("%04s", $i ) ); }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
118 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
119 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
120 warn "[warning] Input data are missing : none mass or file of masses\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
121 &help ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
122 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
123 #print Dumper $masses ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
124
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
125 ## ---------------- launch queries -------------------- :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
126
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
127 if ( ( defined $delta ) and ( $delta > 0 ) and ( defined $molecular_species ) and ( $molecular_species ne '' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
128 ## prepare masses list and execute query
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
129 my $oHmdb = lib::hmdb::new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
130 my $hmdb_pages = undef ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
131 my $status = undef ;
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
132 my ($hmdb_ids, $idsNumber) = (undef, 0) ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
133
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
134 $results = [] ; # prepare arrays ref
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
135 my $submasses = $oHmdb->extract_sub_mz_lists($masses, $CONF->{HMDB_LIMITS} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
136
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
137 print "\tand ".scalar(@$masses)." masses are submitted as ".scalar(@$submasses)." queries to HMDB \n\n" if ($VERBOSE>1) ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
138
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
139 ## get the hmdb server status by a test query - continuous queries or kill script.
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
140 $status = $oHmdb->testMatchesFromHmdb5WithUA() ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
141 $oHmdb->check_state_from_hmdb_ua($status) ; ## can kill the script execution
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
142
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
143 my $cluster = 1 ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
144 foreach my $mzs ( @{$submasses} ) {
10
4eb2de7c24d1 Master branch Updating - - Fxx
fgiacomoni
parents: 8
diff changeset
145 # print Dumper $mzs ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
146 my $result = undef ;
22
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
147 my $cleanedResult = undef ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
148
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
149 my ( $hmdb_masses, $nb_masses_to_submit ) = $oHmdb->prepare_multi_masses_query($mzs) ;
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
150 my ($hmdb_adducts, $nb_selected_adducts) = $oHmdb->prepareAdductListFormat($adductType) ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
151
20
b5a1d5e43685 Master branch Updating - - Fxx
fgiacomoni
parents: 19
diff changeset
152 print "\n\tSubmission of m/z cluster ".sprintf '%04s',$cluster."" if ($VERBOSE>1) ;
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 10
diff changeset
153
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
154 ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_masses, $delta, $molecular_species, $hmdb_adducts) ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
155 print "...HMDB reply results with status: $status\n" if ($VERBOSE>1) ;
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 10
diff changeset
156
16
8b2fbd449ffd Master branch Updating - - Fxx
fgiacomoni
parents: 15
diff changeset
157 # print Dumper $hmdb_pages ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
158
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
159 sleep(1) ;
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 10
diff changeset
160
22
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
161 ## hard modification with $max_query fixed at 1000 !!! Need to be refactoring
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
162 ## Cutof will be done in next method after URI check
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
163 ($result) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_pages, $mzs, 1000) ; ## hash format result
22
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
164
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
165 ## This previous step return results with cutoff on the number of entries returned !
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
166
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
167 ## clean/max result by testing each HMDB_ID page in HMDB
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
168 ($cleanedResult) = $oHmdb->checkHmdbUrlEntries($CONF->{'HMDB_METABOCARD_URL'}, $result, $max_query ) ;
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
169
453fbe98925a " master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
fgiacomoni
parents: 21
diff changeset
170 $results = [ @$results, @$cleanedResult ] ;
14
625fa968d99a Master branch Updating - - Fxx
fgiacomoni
parents: 10
diff changeset
171
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
172 # sleep(1) ;
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
173 $cluster ++ ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
174 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
175
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
176 ## Add more information of each found metabolite (1 for extra or 0 by default)
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
177 if ($advancedFeatures > 0) {
19
f8c8a990688a Master branch Updating - - Fxx
fgiacomoni
parents: 17
diff changeset
178
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
179 ## foreach metabolite get its own metabocard
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
180 ($hmdb_ids, $idsNumber) = $oHmdb->get_unik_ids_from_results($results) ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
181
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
182 print "\tComplementary annotation: asking for $idsNumber metabocards\n" if ($VERBOSE>1) ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
183
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
184 # $hmdb_ids->{'HMDB03125'} = 1 ,
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
185 $metabocard_features = $oHmdb->get_hmdb_metabocard_from_id($hmdb_ids, $CONF->{'HMDB_METABOCARD_URL'}) ; ## Try to multithread the querying
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
186 # print Dumper $results ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
187 # print Dumper $hmdb_ids ;
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
188 # print Dumper $metabocard_features ;
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
189 ## Map metabocards with results (add supplementary data)
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
190 if ( ( defined $results ) and ( defined $metabocard_features ) ) {
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
191 $results = $oHmdb->map_suppl_data_on_hmdb_results($results, $metabocard_features) ;
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
192 }
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
193 }
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
194 else {
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
195 print "\tNo complementary annotation asked\n" if ($VERBOSE>1) ;
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
196 ## Fill with msg not asked advanced annotation
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
197 $results = $oHmdb->map_suppl_data_on_hmdb_results($results, undef) ;
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
198 }
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
199
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
200 ## Uses N mz and theirs entries per page (see config file).
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
201 # how many pages you need with your input mz list?
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
202 $nb_pages_for_html_out = ceil( scalar(@{$masses} ) / $CONF->{HTML_ENTRIES_PER_PAGE} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
203
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
204 # print Dumper $results ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
205 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
206 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
207 croak "Can't work with HMDB : missing paramaters (list of masses, delta or molecular species)\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
208 } ## end ELSE
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
209
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
210 ## -------------- Produce HTML/CSV output ------------------ :
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
211 print "\n\tProducing html and tabular outputs\n" if ($VERBOSE>1) ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
212
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
213 if ( ( defined $out_html ) and ( defined $results ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
214 my $oHtml = lib::hmdb::new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
215 my ($tbody_object) = $oHtml->set_html_tbody_object( $nb_pages_for_html_out, $CONF->{HTML_ENTRIES_PER_PAGE} ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
216 ($tbody_object) = $oHtml->add_mz_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $ids) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
217 ($tbody_object) = $oHtml->add_entries_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $results) ;
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
218
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
219 print Dumper $tbody_object ;
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
220
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
221
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
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'}) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
223
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
224 } ## END IF
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
225 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
226 warn "Can't create a HTML output for HMDB : no result found or your output file is not defined\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
227 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
228
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
229 if ( ( defined $out_tab ) and ( defined $results ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
230 # produce a csv based on METLIN format
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
231 my $ocsv = lib::hmdb::new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
232 if (defined $masses_file) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
233 my $lm_matrix = undef ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
234 if ( ( defined $nbline_header ) and ( $header_choice eq 'yes' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
235 # $lm_matrix = $ocsv->set_lm_matrix_object('hmdb', $masses, $results ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
236 $lm_matrix = $ocsv->set_hmdb_matrix_object_with_ids('hmdb', $masses, $results ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
237 $lm_matrix = $ocsv->add_lm_matrix_to_input_matrix($complete_rows, $lm_matrix, $nbline_header-1) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
238 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
239 elsif ( ( $header_choice eq 'no' ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
240 # $lm_matrix = $ocsv->set_lm_matrix_object(undef, $masses, $results ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
241 $lm_matrix = $ocsv->set_hmdb_matrix_object_with_ids(undef, $masses, $results ) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
242 $lm_matrix = $ocsv->add_lm_matrix_to_input_matrix($complete_rows, $lm_matrix, 0) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
243 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
244 $ocsv->write_csv_skel(\$out_tab, $lm_matrix) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
245 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
246 elsif (defined $mass) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
247 $ocsv->write_csv_one_mass($masses, $ids, $results, $out_tab) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
248 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
249 } ## END IF
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
250 else {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
251 warn "Can't create a tabular output for HMDB : no result found or your output file is not defined\n" ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
252 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
253
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
254 ## Write XLS like format
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
255 if ( ( defined $out_xls ) and ( defined $results ) ) {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
256 my $ocsv = lib::hmdb::new() ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
257 $ocsv->write_csv_one_mass($masses, $ids, $results, $out_xls) ;
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
258 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
259
15
beb9619263b0 Master branch Updating - - Fxx
fgiacomoni
parents: 14
diff changeset
260 print "\n* * * The hmdb client program ended * * *\n" if ($VERBOSE>1) ;
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
261
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
262 #====================================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
263 # Help subroutine called with -h option
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
264 # number of arguments : 0
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
265 # Argument(s) :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
266 # Return : 1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
267 #====================================================================================
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
268 sub help {
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
269 print STDERR "
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
270 help of wsdl_hmdb
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
271
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
272 # wsdl_hmdb is a script to query HMDB website using mz and return a list of candidates sent by HMDB based on the ms search tool.
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
273 # Input : accurate mz or list of accurate masses
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
274 # Author : Franck Giacomoni and Marion Landi
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
275 # Email : fgiacomoni\@inra.fr
17
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
276 # Version : 1.6
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
277 # Created : 08/07/2012
17
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
278 # Updated : 23/01/2019 - 1.6
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
279 USAGE :
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
280 wsdl_hmdb.pl -mass [one mass or a string list of exact masses] -delta [mz delta] -mode [molecular species: positive|negative|neutral] -output [output tabular file] -view [output html file]
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
281
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
282 or
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
283 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]
17
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
284 -delta [mz delta] -mode [molecular species: positive|negative|neutral] -output [output tabular file] -view [output html file]
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
285 -advancedFeatures [Default 0, set to 1 for advanced features as logp, inchi, ...]
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
286
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
287 or
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
288 wsdl_hmdb.pl -h for help
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
289
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
290 ";
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
291 exit(1);
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
292 }
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
293
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
294 ## END of script - F Giacomoni
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
295
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
296 __END__
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
297
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
298 =head1 NAME
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
299
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
300 wsdl_hmdb.pl -- script to query HMDB website using mz and return a list of candidates sent by HMDB based on the ms search tool.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
301
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
302 =head1 USAGE
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
303
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
304 wsdl_hmdb.pl -mass [one mass or a string list of exact masses] -delta [mz delta] -mode [molecular species: positive|negative|neutral] -output [output tabular file] -view [output html file]
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
305
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
306 or
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
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]
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
308 -delta [mz delta] -mode [molecular species: positive|negative|neutral] -output [output tabular file] -view [output html file]
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
309
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
310 =head1 SYNOPSIS
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
311
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
312 This script manages batch queries on HMDB server (v5.0).
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
313
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
314 =head1 DESCRIPTION
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
315
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
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.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
317
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
318 =over 4
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
319
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
320 =item B<function01>
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
321
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
322 =item B<function02>
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
323
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
324 =back
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
325
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
326 =head1 AUTHOR
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
327
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
328 Franck Giacomoni E<lt>franck.giacomoni@inra.frE<gt>
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
329
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
330 =head1 LICENSE
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
331
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
332 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
333
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
334 =head1 VERSION
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
335
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
336 version 1.0 : 06 / 06 / 2013
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
337
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
338 version 1.2 : 27 / 01 / 2014
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
339
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
340 version 1.3 : 19 / 11 / 2014
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
341
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
342 version 1.4 : 21 / 01 / 2016 - a clean version for community
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
343
17
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
344 version 1.5 : 19 / 01 / 2018 - modify parser to match HMDB V4.0 formats
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
345
49f87ddb2c78 Master branch Updating - - Fxx
fgiacomoni
parents: 16
diff changeset
346 version 1.6 : 23 / 01 / 2019 - Manage UA http error and advanced feature from hmdb.
4
6091a80df951 planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
fgiacomoni
parents: 1
diff changeset
347
21
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
348 version 1.6.1 : 30 / 01 / 2019 - Adding adducts and fixxing minors bugs and requirements
63ba1cb240b7 Prod branch Updating - - Fxx
fgiacomoni
parents: 20
diff changeset
349
23
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
350 version 1.7.0 : 19/ 05 / 2022 - Update HMDB API client - compliant with HMDB 5.0 web portal
2d8a310e86ce Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
fgiacomoni
parents: 22
diff changeset
351
1
6d0a0f8f672a planemo upload commit f67323ae4fa7fdbd9f4518ede105a7d7cd44b471
fgiacomoni
parents:
diff changeset
352 =cut