annotate bih4maconda.pl @ 1:2744d20c830a draft default tip

" master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
author fgiacomoni
date Fri, 27 Nov 2020 11:21:58 +0000
parents de13e2c45971
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
1 #!c:\Perl\bin\perl.exe -w
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
2
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
3 =head1 NAME
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
4
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
5 bih4maconda.pl - Utility to detect potential contaminants in your peak list based on MaConDa database
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
6
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
7 =head1 USAGE
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
8
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
9
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
10 =head1 SYNOPSIS
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
11
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
12 =head1 DESCRIPTION
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
13
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
14 =over 4
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
15
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
16 =item B<function01>
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
17
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
18 =item B<function02>
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
19
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
20 =back
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
21
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
22 =head1 AUTHOR
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
23
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
24 Prenom Nom E<lt>franck.giacomoni@inra.frE<gt>
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
25
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
26 =head1 SUPPORT
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
27
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
28 You can find documentation for this module with the perldoc command.
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
29
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
30 perldoc bih4maconda.pl
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
31
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
32 =head1 LICENSE
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
33
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
34 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
35
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
36 =head1 VERSION
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
37
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
38 version 1 : 2019/07/24
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
39
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
40 version 2 : ??
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
41
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
42 =cut
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
43 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
44 # Included modules and versions
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
45 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
46 ## Perl modules
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
47 use strict ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
48 use warnings ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
49 use diagnostics ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
50 use Carp qw (cluck croak carp) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
51
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
52 use Data::Dumper ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
53 use Getopt::Long ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
54 use File::Basename ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
55 use FindBin ; ## Allows you to locate the directory of original perl script
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
56
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
57 ## Specific Perl Modules (PFEM)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
58 use lib $FindBin::Bin ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
59 my $binPath = $FindBin::Bin ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
60
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
61 ## Dedicate Perl Modules (Home made...)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
62 use Metabolomics::Fragment::Annotation qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
63 use Metabolomics::Banks qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
64 use Metabolomics::Banks::MaConDa qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
65 use Metabolomics::Utils qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
66
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
67 ## Initialized values
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
68 my $ProgramName = basename($0) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
69 my $OptionHelp = undef ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
70 my $VERBOSE = undef ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
71
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
72 my ($inputFile, $mzCol, $asHeader, $ppmError, $mode, $instruments, $instrumentTypes) = (undef, undef, undef, undef, undef, undef, undef ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
73 my ($outputTabular, $outputXls, $outputHTML, $outputFull) = (undef, undef, undef, undef) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
74
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
75 my $QueryMode = undef ; # depending of the input data the query mode can be ION|NEUTRAL
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
76
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
77 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
78 # Manage EXCEPTIONS
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
79 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
80 &GetOptions ( "h|help" => \$OptionHelp, # HELP
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
81 "v|verbose=i" => \$VERBOSE, # Level of verbose (0 to 2)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
82 "i|input=s" => \$inputFile, # Input file containing a peak list (mz)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
83 "mzCol=i" => \$mzCol, # Column in CSV file for MZ
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
84 "header=i" => \$asHeader, # CSV file as header (1=true, 0=false)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
85 "ppmError=f" => \$ppmError, # ppm error
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
86 "m|mode=s" => \$mode, # indicate the ionisation mode (POS|NEG|NEUTRAL)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
87 "filterInstrument=s" => \$instruments, # instruments listing to apply filter
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
88 "filterInstrumentType=s" => \$instrumentTypes, # instrumentTypes listing to apply filter
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
89 "outputTab=s" => \$outputTabular, # output file in tabular format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
90 "outputXls=s" => \$outputXls, # output file in Xls format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
91 "outputHtml=s" => \$outputHTML, # output file in html format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
92 "outputFull=s" => \$outputFull, # output file in full format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
93
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
94 ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
95
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
96 ## if you put the option -help or -h function help is started
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
97 if ( defined($OptionHelp) ){ &help ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
98
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
99 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
100 # MAIN SCRIPT
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
101 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
102
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
103 if ($VERBOSE == 3) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
104 print "The $ProgramName program is launched as:\n";
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
105 print "./$ProgramName " ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
106 print "--h " if (defined $OptionHelp) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
107 print "--input $inputFile " if (defined $inputFile) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
108 print "--mzCol $mzCol " if (defined $mzCol) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
109 print "--header $asHeader " if (defined $asHeader) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
110 print "--ppmError $ppmError " if (defined $ppmError) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
111 print "--mode $mode " if (defined $mode) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
112 print "--filterInstrument $instruments " if (defined $instruments) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
113 print "--filterInstrumentType $instrumentTypes " if (defined $instrumentTypes) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
114 # print "--outputXls $outputXls " if (defined $outputXls) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
115 print "--outputTab $outputTabular " if (defined $outputTabular) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
116 # print "--outputHtml $outputHTML " if (defined $outputHTML) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
117 print "--outputFull $outputFull " if (defined $outputFull) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
118 print "with verbose $VERBOSE" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
119 print "\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
120 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
121
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
122 ## Get conf
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
123 my ( $oCONF, $oTEMPLATE) = ( undef, undef ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
124 foreach my $conf ( <$binPath/*.cfg> ) { $oCONF = Metabolomics::Utils->utilsAsConf($conf) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
125
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
126 foreach my $template ( <$binPath/_template.tabular> ) { $oTEMPLATE = $template ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
127
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
128 #print Dumper $oCONF ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
129
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
130
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
131 if ( ( defined $inputFile ) and ( $inputFile ne "" ) and ( -e $inputFile ) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
132
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
133 # create a empty bank object
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
134 my $oBank = Metabolomics::Banks::MaConDa->new() ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
135
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
136 # get contaminants bank
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
137 my ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = (undef, 0, 0) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
138
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
139 $oBank->getContaminantsExtensiveFromSource() ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
140
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
141 # Applying filters
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
142
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
143 ## Instrument #Filter01 (ALL|...)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
144 if ( defined $instruments ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
145 my @instruments = split(/,/, $instruments) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
146 ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = $oBank->filterContaminantInstruments(\@instruments) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
147 print "Only few instruments were selected: $fiteredEntryNum/$totalEntryNum entries were filtered.\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
148 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
149 ## Instrument type #Filter02 (ALL|...)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
150 if ( defined $instrumentTypes ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
151
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
152 my @instrumentTypes = split(/,/, $instrumentTypes) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
153 if (!defined $oFilteredContaminants){ ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = $oBank->filterContaminantInstrumentTypes(\@instrumentTypes) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
154 else { ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = $oFilteredContaminants->filterContaminantInstrumentTypes(\@instrumentTypes) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
155
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
156 print "Only few instrument types were selected: $fiteredEntryNum/$totalEntryNum entries were filtered.\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
157 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
158 ## Ion mode #Filter03 (POS|NEG|BOTH)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
159 if ( defined $mode) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
160
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
161 print "Mode selected is $mode..." ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
162
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
163 if (!defined $oFilteredContaminants){ $oFilteredContaminants = $oBank->filterContaminantIonMode($mode) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
164 else { $oFilteredContaminants = $oFilteredContaminants->filterContaminantIonMode($mode) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
165
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
166 if ( ($mode eq 'POSITIVE') or ($mode eq 'NEGATIVE') or ($mode eq 'BOTH') ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
167 $QueryMode = 'ION' ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
168 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
169 elsif ($mode eq 'NEUTRAL') {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
170 $QueryMode = 'NEUTRAL' ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
171 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
172 else {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
173 croak "[ERROR] mode $mode is not recognize...Please defined a acceptable one\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
174 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
175 print "and detected query mode is $QueryMode...\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
176 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
177 # in case no filter is defined beforr
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
178 if ( ( !defined $mode) and ( !defined $instruments) and ( !defined $instrumentTypes) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
179 $oFilteredContaminants = $oBank ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
180 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
181
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
182 # build the query object
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
183 $oFilteredContaminants->buildTheoPeakBankFromContaminants($QueryMode) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
184
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
185 # get experimental masses
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
186 if ( (defined $mzCol) and (defined $asHeader) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
187 $oFilteredContaminants->parsingMsFragments($inputFile, $asHeader, $mzCol) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
188 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
189
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
190 ## Analysis :
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
191 my $oAnalysis = Metabolomics::Fragment::Annotation->new($oFilteredContaminants) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
192
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
193
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
194 # Compare peaklists:
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
195 $oAnalysis->compareExpMzToTheoMzList('PPM', $ppmError) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
196
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
197 # print Dumper $oBank ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
198
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
199
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
200
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
201 # complete initial input tabular file
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
202 if ( (defined $outputFull) and (defined $inputFile) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
203 my $tabularfile = $oAnalysis->writeFullTabularWithPeakBankObject($inputFile, $oTEMPLATE, $outputFull)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
204 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
205 # write a simple tabular output
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
206 if ( (defined $outputTabular) and (defined $inputFile) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
207 my $tabularfile = $oAnalysis->writeTabularWithPeakBankObject($oTEMPLATE, $outputTabular) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
208 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
209 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
210 else {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
211 croak "Input file is not defined or is not exist.\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
212 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
213
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
214
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
215
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
216
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
217
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
218 #====================================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
219 # Help subroutine called with -h option
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
220 # number of arguments : 0
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
221 # Argument(s) :
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
222 # Return : 1
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
223 #====================================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
224 sub help {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
225
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
226
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
227 print STDERR <<EOF ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
228 ### $ProgramName ###
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
229 #
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
230 # AUTHOR: Franck Giacomoni
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
231 # VERSION: 1.0
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
232 # CREATED: 2019/08/21
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
233 # LAST MODIF:
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
234 # PURPOSE: This program annotates any known contaminants from ms analysis depending some filters as instruments, ionisation mode from MaConDa database
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
235 # USAGE: $ProgramName or $ProgramName --input *.tabular --mzCol INT --header INT --ppmError 5 --mode POSITIVE|NEGATIVE|NEUTRAL --outputTab outTab.tabular --outputFull outFull.tabular --verbose 3
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
236 EOF
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
237 exit(1) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
238 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
239
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
240 ## END of script - F Giacomoni
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
241
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
242 __END__