annotate wsdl_lipidmaps.pl @ 0:e8bd49794291 draft

Init repository with last lipidmaps_textsearch master version
author fgiacomoni
date Tue, 11 Apr 2017 03:47:06 -0400
parents
children 1276908e8fc4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
1 #! perl
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
2
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
3 use strict ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
4 no strict "refs" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
5 use warnings ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
6 use Carp qw (cluck croak carp confess) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
7 use Exporter ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
8 use diagnostics ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
9
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
10 use Data::Dumper ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
11 use POSIX ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
12 use XML::Twig;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
13 use Getopt::Long ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
14 use Time::HiRes;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
15
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
16
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
17 ## Permet de localisez le repertoire du script perl d'origine
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
18 use FindBin;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
19 ## permet de definir la localisation des .pm et .conf
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
20 use lib $FindBin::Bin ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
21 #my $libPath = $FindBin::Bin."/lib";
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
22 my $binPath = $FindBin::Bin ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
23
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
24 ## dedicated lib
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
25
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
26 use lib::lipidmaps ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
27 use lib::parser ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
28 use lib::writer ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
29 # more inra lib
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
30 use lib::conf qw( :ALL ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
31 use lib::csv qw( :ALL ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
32 use lib::operations qw( :ALL ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
33
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
34 ## Initialized values
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
35 #
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
36 my $version = '1.2';
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
37 my ( $help, $input_file, $line_header, $col_mass, $col_rt, $decimal, $round_type, $delta, $mode ) = ( undef, undef, undef, undef, undef, undef, undef, undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
38 my ( $list_oxidation, $list_neutral_loss ) = ( undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
39 my ( $col_classif_id, $selected_cat, $selected_cl, $selected_subcl ) = ( undef, undef, undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
40 my ( $output_csv_file, $output_html_file ) = ( undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
41
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
42 ## Verbose levels (1 OR 3)
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
43 my $verbose = 3 ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
44
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
45
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
46 &GetOptions ( "help|h" => \$help, # HELP
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
47 "input|i:s" => \$input_file, # path for input file (CSV format) -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
48 "lineheader:i" => \$line_header, ## header presence in tabular file
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
49 "colmass:i" => \$col_mass, # Input file Column containing Masses for query -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
50 # "colrt:i" => \$col_rt, # Input file Column containing Retention time
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
51 "decimal:i" => \$decimal , # Significante decimal on mass -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
52 "listoxidation:s" => \$list_oxidation, ## option : liste des atomes a gerer sur les masses experimentales
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
53 "listneutralloss:s" => \$list_neutral_loss, ## option : liste des atomes a gerer sur les masses experimentales
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
54 "round:s" => \$round_type, # Type of truncation -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
55 "delta:f" => \$delta, # delta of mass -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
56 "cat:s" => \$selected_cat, # Number corresponding to the main category in LIPIDMAPS -- Optional
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
57 "class:s" => \$selected_cl, # Number corresponding to the main classe in LIPIDMAPS -- Optional
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
58 "subclass:s" => \$selected_subcl, # Number corresponding to the sub class in LIPIDMAPS -- Optional
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
59 "output:s" => \$output_csv_file, # File+Path for the results (CVS) -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
60 "view:s" => \$output_html_file, # File+Path for the view results (HTML) -- Mandatory
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
61 "colclassif:i" => \$col_classif_id, # Input file Column containing LM classes ID for query -- Optional
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
62 "mode:s" => \$mode, # mode of the initial data
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
63 ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
64
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
65 #=============================================================================
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
66 # EXCEPTIONS
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
67 #=============================================================================
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
68 $help and &help ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
69
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
70 ## --------------- Global parameters ---------------- :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
71 my $nb_pages_for_html_out = 1 ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
72
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
73 ## Conf file
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
74 my ( $CONF, %RULES, %RECIPES, %TRANSFO ) = ( undef, (), (), () ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
75 foreach my $conf ( <$binPath/*.conf> ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
76 my $oConf = lib::conf::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
77 $CONF = $oConf->as_conf($conf) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
78 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
79
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
80 ## -------------- HTML template file ------------------------ :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
81 foreach my $html_template ( <$binPath/*.tmpl> ) { $CONF->{'HTML_TEMPLATE'} = $html_template ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
82
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
83 ## work with it :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
84 ## get RULES lists :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
85 foreach (keys (%$CONF)) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
86 if( $_ =~/^RULE/ ) { $RULES{$_} = $CONF->{$_} ; } ## rules for clustering
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
87 elsif( $_ =~/^RECIPE/ ) { $RECIPES{$_} = $CONF->{$_} ; } ## fields retrieved with each rule
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
88 elsif( $_ =~/^ANNOT/ ) { $TRANSFO{$_} = $CONF->{$_} ; } ## Transformation annotation in output files
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
89 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
90
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
91 ## Init var
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
92 my ( $init_csv_rows, $init_mzs, $init_rts, $classif_ids, $round_init_mzs ) = ( undef, undef, undef, undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
93 my ( @ox_or_loss_names, @ox_or_loss_values, @transfo_init_mzs, @transfo_annotations, @transfo_init_mz_queries, @transfo_init_mz_results, @entries_results, @clusters_results, @entries_total_nb ) = ( (), (), (), (), (), (), (), (), () ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
94 my ( $ox_names, $ox_values, $loss_names, $loss_values ) = ( [], [], [], [] ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
95 my ( $is_header, $tbody_object) = (undef, undef) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
96
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
97
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
98 print "-----------**********START of MAIN LIPIDMAPS -- version $version *********-------------\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
99
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
100 #### --------------------------------- 01 :: Prepare all and Parsing steps on inputs -------------------------------------
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
101
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
102 ## Open CVS FILE / Extract and transform Masses
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
103 if ( ( defined $input_file ) and ( -e $input_file ) ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
104 print "\n[INFO] Open input file and get values...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
105 ## parse all csv for later : output csv build
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
106 my $ocsv_input = lib::csv->new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
107 my $csv = $ocsv_input->get_csv_object( "\t" ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
108 $init_csv_rows = $ocsv_input->parse_csv_object($csv, \$input_file) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
109
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
110
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
111 if ( ( defined $line_header ) and ( $line_header > 0 ) ) { $is_header = 'yes' ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
112
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
113 ## parse masses
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
114 if ( defined $col_mass ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
115 print "[INFO] Get masses from input file $input_file ...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
116 # print "[INFO] Get RT from input file $input_file ...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
117 my $ocsv = lib::csv->new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
118 my $csv = $ocsv->get_csv_object( "\t" ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
119 $init_mzs = $ocsv->get_value_from_csv_multi_header( $csv, $input_file, $col_mass, $is_header, $line_header ) ; ## retrieve mz values on csv
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
120 # $init_rts = $ocsv->get_value_from_csv_multi_header( $csv, $input_file, $col_rt, $is_header, $line_header ) ; ## retrieve rt values on csv
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
121 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
122
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
123 ## Adjust the mz to the instrument mode (POS/NEG)
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
124 if ( ( defined $mode ) and ( ($mode eq 'POS') or ($mode eq 'NEG') ) ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
125 print "\t [INFO] Apply mass mode transforming (POS to NEU or NEG to NEU) ...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
126 my @mode_init_mzs = () ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
127 my $omode = lib::operations::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
128 foreach my $mz (@$init_mzs) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
129 push (@mode_init_mzs, ${$omode->manage_mode(\$mode, \1, \0.0005486, \1.007825, \$mz)} ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
130 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
131
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
132 if ( (scalar @$init_mzs) == (scalar @mode_init_mzs) ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
133 $init_mzs = \@mode_init_mzs ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
134 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
135 else {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
136 carp "[ERROR] The mode managing process failed and init mzs have been corrompted\n"
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
137 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
138 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
139 else {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
140 print "\t [INFO] Apply no mass mode transforming\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
141 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
142
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
143 ## round masses
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
144 if ( ( defined $round_type ) and ( defined $decimal ) ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
145 print "\t [INFO] Apply mass rounding ...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
146 my $oround = lib::operations::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
147 if ( $round_type eq 'truncation' ) { $round_init_mzs = $oround->truncate_nums( $init_mzs, $decimal ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
148 elsif ( $round_type eq 'round' ) { $round_init_mzs = $oround->round_nums( $init_mzs, $decimal ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
149 else { croak "The selected option for data transformation is unknown !\n" ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
150 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
151 ## parse classif ids -- optionnal
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
152 if ( defined $col_classif_id ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
153 print "\t [INFO] Get LM classification IDS from input file $input_file ...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
154 my $ocsv = lib::csv::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
155 my $csv = $ocsv->get_csv_object( "\t" ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
156 $classif_ids = $ocsv->get_value_from_csv( $csv, $input_file, $col_classif_id, $is_header, $line_header ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
157 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
158
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
159
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
160
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
161 ## Uses N mz and theirs entries per page (see config file).
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
162 # how many pages you need with your input mz list?
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
163 # $nb_pages_for_html_out = ceil( scalar(@{$init_mzs} ) / $CONF->{HTML_ENTRIES_PER_PAGE} ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
164 # print "[INFO] Your analysis will generate $nb_pages_for_html_out pages of results...\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
165
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
166 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
167 else {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
168 print "[ERROR] Can't find any input file $input_file\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
169 croak "Can't find any input file $input_file\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
170 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
171
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
172 #### ------------------- 02 :: optionnal work on masses with neutral loss and/or oxydation == modif : -------------------
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
173
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
174 # get and merge ox and neutral loss envt :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
175 my $oparser = lib::parser::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
176 if ( ( defined $list_oxidation ) and ( defined $CONF ) ) { ( $ox_names, $ox_values ) = $oparser->get_oxidation_ref( $CONF, $list_oxidation ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
177 if ( @{$ox_values} ) { push( @ox_or_loss_values, @{$ox_values} ) ; push( @ox_or_loss_names, @{$ox_names} ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
178 if ( ( defined $list_neutral_loss ) and ( defined $CONF ) ) { ( $loss_names, $loss_values ) = $oparser->get_neutral_loss_ref( $CONF, $list_neutral_loss ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
179 if ( @{$loss_values} ) { push( @ox_or_loss_values, @{$loss_values} ) ; push( @ox_or_loss_names, @{$loss_names} ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
180
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
181 # prepare a list of masses indpt of modif (ox/neutral loss) presence.
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
182 my $init_mz_index = 0 ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
183 my $i = 0 ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
184
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
185 foreach my $init_mz (@{$round_init_mzs}) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
186
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
187 my @transfo_values_list = () ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
188 my @transfo_name_list = () ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
189 my $init_annot = 'Init_MZ' ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
190
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
191 push ( @transfo_values_list, \$init_mz ) ; ## the submitted init mass
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
192 ## work on values
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
193 if ( @ox_or_loss_values ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
194 my $oround = lib::operations::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
195 my $round_transfo_mzs = $oround->round_nums( \@ox_or_loss_values, $decimal ) ; ## We choose to around the number.
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
196 foreach my $transfo_mz ( @{$round_transfo_mzs} ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
197 my $osub = lib::operations::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
198 my $transfo_init_mz = $osub->subtract_num( $init_mz, $transfo_mz ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
199 push ( @transfo_values_list, $transfo_init_mz ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
200 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
201 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
202
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
203 ## work on annotation for output
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
204 push ( @transfo_name_list, \$init_annot) ; ## init annot
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
205 if ( @ox_or_loss_names ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
206 foreach my $ox_or_loss_name (@ox_or_loss_names) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
207 if ( $TRANSFO{'ANNOT_'.$ox_or_loss_name} ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
208 my $transfo = $TRANSFO{'ANNOT_'.$ox_or_loss_name} ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
209 push ( @transfo_name_list, \$transfo ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
210 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
211 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
212
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
213 ## push final arrays
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
214 push ( @transfo_init_mzs, \@transfo_values_list ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
215 push ( @transfo_annotations, \@transfo_name_list ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
216
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
217 ## foreach transfo mass (round and/or modif)
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
218
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
219 my ( @queries, @query_results, @query_result_entries, @query_result_entry_nbs, @query_result_clusters ) = ( (), (), (), (), () ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
220
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
221 foreach my $transfo_mz ( @{$transfo_init_mzs[$init_mz_index]} ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
222 print "[INFO] Prepare the $i.th query with the mz: $$transfo_mz... \n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
223 ## LM recommandation : If you write a script to automate calls to LMSD,
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
224 # please be kind and do not hit our server more often than once per 20 seconds.
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
225 # We may have to kill scripts that hit our server more frequently.
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
226 Time::HiRes::sleep(0.1); #.1 seconds
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
227 my ( $cat, $cl, $subcl ) = ( undef, undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
228 # if ( $i >= ( scalar( @transfos_values )-1 ) ) { $i = 0 ; } ## manage the modif for each masses.
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
229
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
230 ## get the classif level :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
231 if ( defined $classif_ids ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
232
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
233 if ( $classif_ids->[$i] ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
234 my $olevel = lib::parser::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
235 $cat = $olevel->set_category( $classif_ids->[$i] ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
236 $cl = $olevel->set_class( $classif_ids->[$i] ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
237 $subcl = $olevel->set_subclass( $classif_ids->[$i] ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
238 # ( $cat, $cl, $subcl ) = ( $$cat, $$cl, $$subcl ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
239 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
240 else { croak "This information is not available in your parsing ids\n" ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
241 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
242 else {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
243 if ( ( defined $selected_subcl) or ( defined $selected_cl ) or ( defined $selected_cat ) ) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
244 if ( ( $selected_cat !~ /^NA/ ) ) { ( $cat ) = ( \$selected_cat ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
245 if ( ( $selected_cl !~ /^NA(.*)/ ) ) { ( $cl ) = ( \$selected_cl ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
246 if ( ( $selected_subcl !~ /^NA(.*)/ ) ) { ( $subcl ) = ( \$selected_subcl ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
247 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
248 else { croak "No selected category or classification ids list\n" ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
249 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
250
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
251 ## buid and get http query :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
252 my $oquery = lib::lipidmaps::new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
253 my $ref_http_query = $oquery->build_lm_mass_query( \$CONF->{'SEARCH_URL'}, \$delta, $cat, $cl, $subcl ) ; ## build the query for LM WS, return a list of http, get method
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
254 print "\t[INFO] Exec $$ref_http_query \n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
255
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
256 ## set entries clusters
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
257 my ( $http_result_mz, $http_query_mz ) = $oquery->get_lm_mass_query($ref_http_query, $transfo_mz) ; ## execute the query, return a list of non-splited lm_entries.
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
258 my ( $mz_entries_results, $mz_entries_nb, $mz_clusters_results ) = ( undef, undef, undef ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
259 if ( (defined $http_result_mz) and ( $$http_result_mz ne '' ) ) { # avoid empty LM results
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
260 ( $mz_entries_results, $mz_entries_nb ) = $oquery->get_lm_entry_object($http_result_mz, $transfo_mz) ; ## get all features of each entry and return a list of features keept in a hash
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
261 $mz_clusters_results = $oquery->get_cluster_object($mz_entries_results, \%RULES, \%RECIPES) ; ## clustering all entries and return a list of clusters keept in a hash
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
262 print "\t[INFO] The query return $$mz_entries_nb entries\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
263 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
264 else { # manage empty LM results
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
265 ( $mz_entries_results, $mz_entries_nb, $mz_clusters_results ) = ( [], \0, [] ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
266 print "\t[INFO] The query return none entry with LM\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
267 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
268
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
269 push( @queries, $http_query_mz ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
270 push( @query_results, $http_result_mz ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
271 push( @query_result_entries, $mz_entries_results ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
272 push( @query_result_entry_nbs, $mz_entries_nb ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
273 push( @query_result_clusters, $mz_clusters_results ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
274
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
275 } ## end foreach transfo_mz
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
276
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
277 $i++ ; # implem the mz rank
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
278
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
279 push( @transfo_init_mz_queries, \@queries ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
280 push( @transfo_init_mz_results, \@query_results ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
281 push( @entries_results, \@query_result_entries ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
282 push( @entries_total_nb, \@query_result_entry_nbs ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
283 push( @clusters_results, \@query_result_clusters ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
284
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
285 $init_mz_index++ ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
286 } ## end foreach init_mz
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
287
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
288
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
289 #### -------------------------------- 05 :: Writes LM results --------------------------------------------
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
290
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
291 # prepare data and write html output :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
292 if ( defined $output_html_file) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
293 ## Adjust html output with only mz with records
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
294 my ($nb_pages, $total_entries) = (0, 0) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
295 foreach (@entries_total_nb) {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
296 foreach my $nb ( @{$_} ) { $total_entries += $$nb ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
297 if ($total_entries > 0) { $nb_pages++ ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
298 $total_entries = 0 ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
299 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
300
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
301 $nb_pages_for_html_out = ceil( $nb_pages / $CONF->{HTML_ENTRIES_PER_PAGE} ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
302 print "[INFO] write HTML output file containing $nb_pages_for_html_out pages\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
303
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
304 my $ohtml = lib::writer->new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
305 $tbody_object = $ohtml->set_html_tbody_object( $nb_pages_for_html_out ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
306 $tbody_object = $ohtml->add_mz_to_tbody_object( $tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $init_mzs, \@entries_total_nb) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
307 $tbody_object = $ohtml->add_transformation_to_tbody_object( \@transfo_init_mzs, \@transfo_annotations, $tbody_object ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
308 $tbody_object = $ohtml->add_cluster_to_tbody_object( \@transfo_init_mzs, \@clusters_results, $tbody_object ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
309 $tbody_object = $ohtml->add_entry_to_tbody_object( \@transfo_init_mzs, \@clusters_results, \@entries_results, $tbody_object ) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
310
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
311 $tbody_object = $ohtml->sort_tbody_object($tbody_object) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
312
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
313 my $output_html = $ohtml->write_html_skel(\$output_html_file, $tbody_object, $nb_pages_for_html_out, $CONF->{'HTML_TEMPLATE'}, $CONF->{'JS_GALAXY_PATH'}, $CONF->{'CSS_GALAXY_PATH'}) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
314 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
315
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
316
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
317 #write csv ouput : add 'lipidmaps' column to input file
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
318 my $lm_matrix = undef ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
319 my $ocsv = lib::writer->new() ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
320 if ( defined $is_header ) { $lm_matrix = $ocsv->set_lm_matrix_object('LIPIDMAPS(score::name::mz::formula::adduct::id)', $init_mzs, \@transfo_annotations, \@clusters_results ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
321 else { $lm_matrix = $ocsv->set_lm_matrix_object( undef, $init_mzs, \@transfo_annotations, \@clusters_results ) ; }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
322
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
323
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
324 $lm_matrix = $ocsv->add_lm_matrix_to_input_matrix($init_csv_rows, $lm_matrix) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
325 $ocsv->write_csv_skel(\$output_csv_file, $lm_matrix) ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
326 print "[INFO] write CSV output file\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
327
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
328 print "-----------**********END of MAIN LIPIDMAPS -- version $version *********-------------\n" if ($verbose == 3);
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
329
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
330 #print "-----------**********RETURNS*********-------------\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
331 #print "\n----- Init Input Data in CSV -----\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
332 #print Dumper $init_csv_rows ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
333 #print "\n---- Init masses parsed ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
334 #print Dumper $init_mzs ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
335 #print "\n---- Init rts parsed ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
336 #print Dumper $init_rts ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
337 #print "\n---- Init masses arounded ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
338 #print Dumper $round_init_mzs ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
339 #print "\n---- Ox ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
340 #print Dumper $ox_names ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
341 #print Dumper $ox_values ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
342 #print "\n---- Neutral loss ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
343 #print Dumper $loss_names ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
344 #print Dumper $loss_values ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
345 #print "\n---- Applied transformations ('\@ox_or_loss_values') ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
346 #print Dumper @ox_or_loss_values ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
347 #print "\n---- Masses modif ('\@transfo_init_mzs') ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
348 #print Dumper @transfo_init_mzs ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
349 #print "\n---- Transfo annotation ('\@transfo_annotations') ...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
350 #print Dumper @transfo_annotations ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
351 #print "\n---- Queries ('\@transfo_init_mz_queries')...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
352 #print Dumper @transfo_init_mz_queries ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
353 #print "\n---- WS Results ('@transfo_init_mz_results')...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
354 #print Dumper @transfo_init_mz_results ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
355 #print "\n---- Entries results ('\@entries_results')...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
356 #print Dumper @entries_results ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
357 #print "\n---- Entries results numbers ('\@entries_total_nb')...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
358 #print Dumper @entries_total_nb ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
359 #print "\n---- Clusters results ('\@clusters_results')...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
360 #print Dumper @clusters_results ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
361 #print "\n---- Data model filed...\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
362 #print "...with csv->\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
363 #print Dumper $lm_matrix ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
364 #print "...with html->\n" ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
365 #print Dumper $tbody_object ;
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
366
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
367
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
368 #====================================================================================
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
369 # Help subroutine called with -h option
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
370 # number of arguments : 0
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
371 # Argument(s) :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
372 # Return : 1
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
373 #====================================================================================
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
374 sub help {
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
375 print STDERR "
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
376
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
377 # wsdl_lipidmaps
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
378 # Input :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
379 # Author : Franck GIACOMONI and Marion LANDI
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
380 # Email : fgiacomoni\@clermont.inra.fr
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
381 # Version : $version
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
382 # Created : 16/07/2012
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
383 # Updated: 09/06/2016 - REST implem
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
384 USAGE :
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
385 wsdl_lipidmaps.pl -help
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
386 wsdl_lipidmaps.pl
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
387 -input \$file_input -colmass \$col_mass -colrt \$col_rt -decimal \$decimal -round \$round_type -delta \$tolerance
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
388 -output \$output_result -view \$output_view
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
389 -cat -class -subclass OR -colclassif
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
390 -listneutralloss \$neutral_loss -listoxidation \$oxidation [optionnal]
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
391 ";
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
392 }
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
393
e8bd49794291 Init repository with last lipidmaps_textsearch master version
fgiacomoni
parents:
diff changeset
394