Mercurial > repos > fgiacomoni > hr2
comparison hr2_manager.pl @ 3:78afd7f439f3 draft default tip
master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author | fgiacomoni |
---|---|
date | Wed, 15 Feb 2023 15:57:49 +0000 |
parents | 23970530a518 |
children |
comparison
equal
deleted
inserted
replaced
2:23970530a518 | 3:78afd7f439f3 |
---|---|
2 | 2 |
3 ## script : hr2_manager.pl | 3 ## script : hr2_manager.pl |
4 ## VERSIONS : | 4 ## VERSIONS : |
5 # - 01/03/2019 : Fix P issue, permit more flexible atom settings and add requirements for conda auto managing. | 5 # - 01/03/2019 : Fix P issue, permit more flexible atom settings and add requirements for conda auto managing. |
6 # - 09/12/2022 : Fix "Additional atomes not taken into account" - Ticket issue #7 | 6 # - 09/12/2022 : Fix "Additional atomes not taken into account" - Ticket issue #7 |
7 # - 15/02/2023 : New feature - optionnal managing max atom value | |
7 | 8 |
8 #============================================================================= | 9 #============================================================================= |
9 # Included modules and versions | 10 # Included modules and versions |
10 #============================================================================= | 11 #============================================================================= |
11 ## Perl modules | 12 ## Perl modules |
30 use vars qw(%parametre); | 31 use vars qw(%parametre); |
31 my $help = undef ; | 32 my $help = undef ; |
32 my ( $input_file, $line_header, $col_id, $col_mass ) = ( undef, undef, undef, undef ) ; # manage input option file of masses | 33 my ( $input_file, $line_header, $col_id, $col_mass ) = ( undef, undef, undef, undef ) ; # manage input option file of masses |
33 my ( $mass ) = ( undef ) ; # manage input option masses list | 34 my ( $mass ) = ( undef ) ; # manage input option masses list |
34 my ( $tolerance, $mode, $charge, $has_golden_rules, $atomes, $atomes_basic ) = ( undef, undef, undef, undef, undef, undef ) ; # manage params | 35 my ( $tolerance, $mode, $charge, $has_golden_rules, $atomes, $atomes_basic ) = ( undef, undef, undef, undef, undef, undef ) ; # manage params |
36 my ( $C13_max_value, $C12_max_value, $H_max_value, $N_max_value, $O_max_value, $P_max_value, $S_max_value, $F_max_value, $Cl_max_value, $K_max_value, $Br_max_value, $Na_max_value) = (undef, undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef) ; | |
37 my ($customAtomValues) = (undef) ; | |
35 my ( $output_csv, $output_html ) = ( undef, undef) ; # manage ouputs | 38 my ( $output_csv, $output_html ) = ( undef, undef) ; # manage ouputs |
36 my $verbose = 2 ; | 39 my $verbose = 2 ; |
37 | 40 |
38 #============================================================================= | 41 #============================================================================= |
39 # Manage EXCEPTIONS | 42 # Manage EXCEPTIONS |
48 "mode:s" => \$mode, | 51 "mode:s" => \$mode, |
49 "charge:i" => \$charge, | 52 "charge:i" => \$charge, |
50 "regleOr:s" => \$has_golden_rules, | 53 "regleOr:s" => \$has_golden_rules, |
51 "atomes_basic:s"=> \$atomes_basic, # [basic atoms like CNOHP] | 54 "atomes_basic:s"=> \$atomes_basic, # [basic atoms like CNOHP] |
52 "atomes_sup:s" => \$atomes, | 55 "atomes_sup:s" => \$atomes, |
56 #"customAtomValues:s"=> \$customAtomValues, | |
57 | |
58 "C12_max_value:i" => \$C12_max_value, # OPTIONNAL | |
59 "C13_max_value:i" => \$C13_max_value, | |
60 "H_max_value:i" => \$H_max_value, | |
61 "N_max_value:i" => \$N_max_value, | |
62 "O_max_value:i" => \$O_max_value, | |
63 "P_max_value:i" => \$P_max_value, | |
64 "S_max_value:i" => \$S_max_value, | |
65 "F_max_value:i" => \$F_max_value, | |
66 "Cl_max_value:i" => \$Cl_max_value, | |
67 "K_max_value:i" => \$K_max_value, | |
68 "Br_max_value:i" => \$Br_max_value, | |
69 "Na_max_value:i" => \$Na_max_value, | |
70 | |
53 "output1:s" => \$output_csv, | 71 "output1:s" => \$output_csv, |
54 "outputView:s" => \$output_html, | 72 "outputView:s" => \$output_html, |
55 "verbose:i" => \$verbose, | 73 "verbose:i" => \$verbose, |
56 ) ; | 74 ) ; |
57 | 75 |
61 $help and &help ; | 79 $help and &help ; |
62 | 80 |
63 #============================================================================= | 81 #============================================================================= |
64 # MAIN SCRIPT | 82 # MAIN SCRIPT |
65 #============================================================================= | 83 #============================================================================= |
66 my %atomsConf = () ; | 84 |
67 $atomsConf{'C'} = {'min' => 0, 'max' => 0} ; | 85 #print "CUSTOM C12: $C12_max_value\n" if (defined $C12_max_value) ; |
68 $atomsConf{ 'H'} = {'min' => 0, 'max' => 0} ; | 86 #print "CUSTOM H: $H_max_value if (defined $H_max_value) ; |
69 $atomsConf{ 'N'} = {'min' => 0, 'max' => 0} ; | 87 #print "CUSTOM N: $N_max_value if (defined $N_max_value) ; |
70 $atomsConf{ 'O'} = {'min' => 0, 'max' => 0} ; | 88 #print "CUSTOM O: $O_max_value if (defined $O_max_value) ; |
71 $atomsConf{ 'P'} = {'min' => 0, 'max' => 0} ; | 89 #print "CUSTOM P: $P_max_value if (defined $P_max_value) ; |
72 $atomsConf{ 'S'} = {'min' => 0, 'max' => 0} ; | 90 #print "CUSTOM S: $S_max_value if (defined $S_max_value) ; |
73 $atomsConf{ 'F'} = {'min' => 0, 'max' => 0} ; | 91 #print "CUSTOM F: $F_max_value if (defined $F_max_value) ; |
74 $atomsConf{ 'L'} = {'min' => 0, 'max' => 0} ; | 92 #print "CUSTOM Cl: $Cl_max_value if (defined $Cl_max_value) ; |
75 $atomsConf{ 'K'} = {'min' => 0, 'max' => 0} ; | 93 #print "CUSTOM K: $K_max_value if (defined $K_max_value) ; |
76 $atomsConf{ 'B'} = {'min' => 0, 'max' => 0} ; | 94 #print "CUSTOM Br: $Br_max_value if (defined $Br_max_value) ; |
77 $atomsConf{ 'A'} = {'min' => 0, 'max' => 0} ; | 95 #print "CUSTOM Na: $Na_max_value if (defined $Na_max_value) ; |
78 $atomsConf{ '1'} = {'min' => 0, 'max' => 0} ; | 96 #print "CUSTOM C13: $C13_max_value if (defined $C13_max_value) ; |
79 | 97 |
80 ## -------------- Conf file and verbose ------------------------ : | 98 ## -------------- Conf file and verbose ------------------------ : |
81 my ( $CONF ) = ( undef ) ; ## verbose level is 3 for debugg | 99 my ( $CONF ) = ( undef ) ; ## verbose level is 3 for debugg |
82 my $time_start = time ; | 100 my $time_start = time ; |
83 | 101 |
102 | 120 |
103 ## manage atoms and their ranges | 121 ## manage atoms and their ranges |
104 #$hr_atoms_list = $ohr->manage_atoms(\$atomes, \$CONF->{'DEFAULT_ATOMS'}) ; ## DEPRECATED | 122 #$hr_atoms_list = $ohr->manage_atoms(\$atomes, \$CONF->{'DEFAULT_ATOMS'}) ; ## DEPRECATED |
105 | 123 |
106 # manage atoms and their ranges with a hash structure | 124 # manage atoms and their ranges with a hash structure |
107 my $atomsCurrentConf = $ohr->manage_atoms_and_ranges(\%atomsConf, $CONF, $atomes_basic, $atomes) ; | 125 |
108 | 126 my $AtomsFullConf = $ohr->manageAtomsConf($CONF, $C12_max_value, $C13_max_value, $H_max_value, $N_max_value, $O_max_value, $P_max_value, $S_max_value, $F_max_value, $Cl_max_value, $K_max_value, $Br_max_value, $Na_max_value ) ; |
109 #if ( defined $hr_atoms_list ) { | 127 |
110 # ## implements range foreach atom | 128 my $atomsCurrentConf = $ohr->manage_atoms_and_ranges($AtomsFullConf, $atomes_basic, $atomes) ; |
111 # foreach my $atom ( (split(",", $$hr_atoms_list )) ) { | |
112 # my $range_max = $CONF->{'DEFAULT_MAX'} ; # manage max value in case of | |
113 # if ( exists $CONF->{$atom} ) { $range_max = $CONF->{$atom} ; } | |
114 # my $ref_range = $ohr->manage_atom_and_range(\$atom, \$CONF->{'DEFAULT_MIN'}, \$range_max ) ; | |
115 # $hr_atoms_and_ranges .= $$ref_range ; ## concat ranges | |
116 # } | |
117 #} | |
118 #else { croak "No atom detected with input params\n" ; } | |
119 | 129 |
120 ## Parsing input file with masses/ids or unik mass : | 130 ## Parsing input file with masses/ids or unik mass : |
121 ## manage only one mass | 131 ## manage only one mass |
122 if ( ( defined $mass ) and ( $mass ne "" ) and ( $mass > 0 ) ) { | 132 if ( ( defined $mass ) and ( $mass ne "" ) and ( $mass > 0 ) ) { |
123 $ids = ['mass_01'] ; | 133 $ids = ['mass_01'] ; |
153 ## prepare cmd | 163 ## prepare cmd |
154 foreach my $mz (@{ $masses }) { | 164 foreach my $mz (@{ $masses }) { |
155 ## computes mass | 165 ## computes mass |
156 my $ohr_mode = lib::hr->new() ; | 166 my $ohr_mode = lib::hr->new() ; |
157 my ( $exact_mass ) = $ohr_mode->manage_mode( \$mode, \$charge, \$CONF->{'electron'}, \$CONF->{'proton'}, \$mz ) ; | 167 my ( $exact_mass ) = $ohr_mode->manage_mode( \$mode, \$charge, \$CONF->{'electron'}, \$CONF->{'proton'}, \$mz ) ; |
158 print "Current MZ send to HR\n" if $verbose == 3 ; | 168 print "Current MZ $$exact_mass send to HR\n" if $verbose == 3 ; |
159 print Dumper $exact_mass if $verbose == 3 ; | |
160 ## build exe line | 169 ## build exe line |
161 my $ohr_exe = lib::hr->new() ; | 170 my $ohr_exe = lib::hr->new() ; |
162 my $hr_cmd = $ohr_exe->config_hr_exe( \$CONF->{'HR2_EXE'}, \$tolerance, $exact_mass, \$has_golden_rules, \$atomsCurrentConf ) ; | 171 my $hr_cmd = $ohr_exe->config_hr_exe( \$CONF->{'HR2_EXE'}, \$tolerance, $exact_mass, \$has_golden_rules, \$atomsCurrentConf ) ; |
163 print "$$hr_cmd\n" if $verbose == 3 ; | 172 print "\t$$hr_cmd\n" if $verbose == 3 ; |
164 push(@{$hr_cmds}, $$hr_cmd) ; | 173 push(@{$hr_cmds}, $$hr_cmd) ; |
165 } | 174 } |
166 | 175 |
167 ## MultiThreading execution of Hr : | 176 ## MultiThreading execution of Hr : |
168 my $threads = lib::hr->new() ; | 177 my $threads = lib::hr->new() ; |
223 | 232 |
224 | 233 |
225 | 234 |
226 ### VERBOSE OUTPUTs | 235 ### VERBOSE OUTPUTs |
227 if ( $verbose == 3 ) { | 236 if ( $verbose == 3 ) { |
228 print "-- Conf file contains :\n" ; | 237 print "\n\n-- Conf file contains :\n" ; |
229 print Dumper $CONF ; | 238 print Dumper $CONF ; |
230 print "-- Atoms input list :\n" ; | 239 print "-- Atoms input list :\n" ; |
231 print Dumper $atomes_basic ; | 240 print Dumper $atomes_basic ; |
232 print "-- Suppl. atoms input list :\n" ; | 241 print "-- Suppl. atoms input list :\n" ; |
233 print Dumper $atomes ; | 242 print Dumper $atomes ; |
338 | 347 |
339 version 4 : 01/03/2019 | 348 version 4 : 01/03/2019 |
340 | 349 |
341 version 5 : 09/12/2022 | 350 version 5 : 09/12/2022 |
342 | 351 |
352 version 6 : 15/02/2023 | |
353 | |
343 =cut | 354 =cut |