annotate bih4maconda.pl @ 0:de13e2c45971 draft

Init repository for bih4maconda
author fgiacomoni
date Tue, 21 Jan 2020 15:49:00 -0500
parents
children 2744d20c830a
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::BloodExposome qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
65 use Metabolomics::Banks::MaConDa qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
66 use Metabolomics::Banks::AbInitioFragments qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
67 use Metabolomics::Utils qw( :all ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
68
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
69 ## Initialized values
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
70 my $ProgramName = basename($0) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
71 my $OptionHelp = undef ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
72 my $VERBOSE = undef ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
73
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
74 my ($inputFile, $mzCol, $asHeader, $ppmError, $mode, $instruments, $instrumentTypes) = (undef, undef, undef, undef, undef, undef, undef ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
75 my ($outputTabular, $outputXls, $outputHTML, $outputFull) = (undef, undef, undef, undef) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
76
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
77 my $QueryMode = undef ; # depending of the input data the query mode can be ION|NEUTRAL
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
78
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
79 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
80 # Manage EXCEPTIONS
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
81 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
82 &GetOptions ( "h|help" => \$OptionHelp, # HELP
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
83 "v|verbose=i" => \$VERBOSE, # Level of verbose (0 to 2)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
84 "i|input=s" => \$inputFile, # Input file containing a peak list (mz)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
85 "mzCol=i" => \$mzCol, # Column in CSV file for MZ
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
86 "header=i" => \$asHeader, # CSV file as header (1=true, 0=false)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
87 "ppmError=f" => \$ppmError, # ppm error
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
88 "m|mode=s" => \$mode, # indicate the ionisation mode (POS|NEG|NEUTRAL)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
89 "filterInstrument=s" => \$instruments, # instruments listing to apply filter
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
90 "filterInstrumentType=s" => \$instrumentTypes, # instrumentTypes listing to apply filter
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
91 "outputTab=s" => \$outputTabular, # output file in tabular format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
92 "outputXls=s" => \$outputXls, # output file in Xls format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
93 "outputHtml=s" => \$outputHTML, # output file in html format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
94 "outputFull=s" => \$outputFull, # output file in full format
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
95
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
96 ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
97
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
98 ## if you put the option -help or -h function help is started
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
99 if ( defined($OptionHelp) ){ &help ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
100
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
101 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
102 # MAIN SCRIPT
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
103 #=============================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
104
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
105 if ($VERBOSE == 3) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
106 print "The $ProgramName program is launched as:\n";
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
107 print "./$ProgramName " ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
108 print "--h " if (defined $OptionHelp) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
109 print "--input $inputFile " if (defined $inputFile) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
110 print "--mzCol $mzCol " if (defined $mzCol) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
111 print "--header $asHeader " if (defined $asHeader) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
112 print "--ppmError $ppmError " if (defined $ppmError) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
113 print "--mode $mode " if (defined $mode) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
114 print "--filterInstrument $instruments " if (defined $instruments) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
115 print "--filterInstrumentType $instrumentTypes " if (defined $instrumentTypes) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
116 # print "--outputXls $outputXls " if (defined $outputXls) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
117 print "--outputTab $outputTabular " if (defined $outputTabular) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
118 # print "--outputHtml $outputHTML " if (defined $outputHTML) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
119 print "--outputFull $outputFull " if (defined $outputFull) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
120 print "with verbose $VERBOSE" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
121 print "\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
122 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
123
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
124 ## Get conf
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
125 my ( $oCONF, $oTEMPLATE) = ( undef, undef ) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
126 foreach my $conf ( <$binPath/*.cfg> ) { $oCONF = Metabolomics::Utils->utilsAsConf($conf) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
127
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
128 foreach my $template ( <$binPath/_template.tabular> ) { $oTEMPLATE = $template ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
129
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
130 #print Dumper $oCONF ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
131
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
132
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
133 if ( ( defined $inputFile ) and ( $inputFile ne "" ) and ( -e $inputFile ) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
134
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
135 # create a empty bank object
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
136 my $oBank = Metabolomics::Banks::MaConDa->new() ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
137
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
138 # get contaminants bank
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
139 my ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = (undef, 0, 0) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
140
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
141 $oBank->getContaminantsExtensiveFromSource() ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
142
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
143 # Applying filters
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
144
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
145 ## Instrument #Filter01 (ALL|...)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
146 if ( defined $instruments ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
147 my @instruments = split(/,/, $instruments) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
148 ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = $oBank->filterContaminantInstruments(\@instruments) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
149 print "Only few instruments were selected: $fiteredEntryNum/$totalEntryNum entries were filtered.\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
150 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
151 ## Instrument type #Filter02 (ALL|...)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
152 if ( defined $instrumentTypes ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
153
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
154 my @instrumentTypes = split(/,/, $instrumentTypes) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
155 if (!defined $oFilteredContaminants){ ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = $oBank->filterContaminantInstrumentTypes(\@instrumentTypes) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
156 else { ($oFilteredContaminants, $totalEntryNum, $fiteredEntryNum) = $oFilteredContaminants->filterContaminantInstrumentTypes(\@instrumentTypes) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
157
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
158 print "Only few instrument types were selected: $fiteredEntryNum/$totalEntryNum entries were filtered.\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
159 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
160 ## Ion mode #Filter03 (POS|NEG|BOTH)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
161 if ( defined $mode) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
162
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
163 print "Mode selected is $mode..." ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
164
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
165 if (!defined $oFilteredContaminants){ $oFilteredContaminants = $oBank->filterContaminantIonMode($mode) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
166 else { $oFilteredContaminants = $oFilteredContaminants->filterContaminantIonMode($mode) ; }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
167
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
168 if ( ($mode eq 'POSITIVE') or ($mode eq 'NEGATIVE') or ($mode eq 'BOTH') ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
169 $QueryMode = 'ION' ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
170 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
171 elsif ($mode eq 'NEUTRAL') {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
172 $QueryMode = 'NEUTRAL' ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
173 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
174 else {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
175 croak "[ERROR] mode $mode is not recognize...Please defined a acceptable one\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
176 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
177 print "and detected query mode is $QueryMode...\n" ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
178 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
179 # in case no filter is defined beforr
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
180 if ( ( !defined $mode) and ( !defined $instruments) and ( !defined $instrumentTypes) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
181 $oFilteredContaminants = $oBank ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
182 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
183
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
184 # build the query object
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
185 $oFilteredContaminants->buildTheoPeakBankFromContaminants($QueryMode) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
186
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
187 # get experimental masses
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
188 if ( (defined $mzCol) and (defined $asHeader) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
189 $oFilteredContaminants->parsingMsFragments($inputFile, $asHeader, $mzCol) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
190 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
191
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
192 ## Analysis :
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
193 my $oAnalysis = Metabolomics::Fragment::Annotation->new($oFilteredContaminants) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
194
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
195
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
196 # Compare peaklists:
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
197 $oAnalysis->compareExpMzToTheoMzList('PPM', $ppmError) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
198
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
199 # print Dumper $oBank ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
200
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
201
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
202
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
203 # complete initial input tabular file
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
204 if ( (defined $outputFull) and (defined $inputFile) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
205 my $tabularfile = $oAnalysis->writeFullTabularWithPeakBankObject($inputFile, $oTEMPLATE, $outputFull)
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
206 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
207 # write a simple tabular output
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
208 if ( (defined $outputTabular) and (defined $inputFile) ) {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
209 my $tabularfile = $oAnalysis->writeTabularWithPeakBankObject($oTEMPLATE, $outputTabular) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
210 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
211 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
212 else {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
213 croak "Input file is not defined or is not exist.\n" ;
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
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
220 #====================================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
221 # Help subroutine called with -h option
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
222 # number of arguments : 0
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
223 # Argument(s) :
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
224 # Return : 1
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
225 #====================================================================================
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
226 sub help {
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
227
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
228
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
229 print STDERR <<EOF ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
230 ### $ProgramName ###
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
231 #
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
232 # AUTHOR: Franck Giacomoni
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
233 # VERSION: 1.0
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
234 # CREATED: 2019/08/21
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
235 # LAST MODIF:
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
236 # 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
237 # 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
238 EOF
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
239 exit(1) ;
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
240 }
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
241
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
242 ## END of script - F Giacomoni
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
243
de13e2c45971 Init repository for bih4maconda
fgiacomoni
parents:
diff changeset
244 __END__