annotate bih4bloodexposome.pl @ 0:94eeed7f737f draft default tip

planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
author fgiacomoni
date Fri, 27 Nov 2020 10:06:35 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
1 #!c:\Perl\bin\perl.exe -w
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
2
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
3 =head1 NAME
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
4
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
5 bih4bloodexposome.pl - Utility to detect potential contaminants in your peak list based on BloodExposome database
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
6
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
7 =head1 USAGE
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
8
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
9
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
10 =head1 SYNOPSIS
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
11
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
12 =head1 DESCRIPTION
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
13
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
14 =over 4
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
15
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
16 =item B<function01>
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
17
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
18 =item B<function02>
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
19
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
20 =back
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
21
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
22 =head1 AUTHOR
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
23
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
24 Prenom Nom E<lt>franck.giacomoni@inrae.frE<gt>
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
25
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
26 =head1 SUPPORT
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
27
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
28 You can find documentation for this module with the perldoc command.
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
29
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
30 perldoc bih4bloodexposome.pl
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
31
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
32 =head1 LICENSE
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
33
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
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.
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
35
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
36 =head1 VERSION
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
37
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
38 version 0.1.0 : 2020/01/21
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
39
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
40 version 2 : ??
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
41
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
42 =cut
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
43 #=============================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
44 # Included modules and versions
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
45 #=============================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
46 ## Perl modules
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
47 use strict ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
48 use warnings ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
49 use diagnostics ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
50 use Carp qw (cluck croak carp) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
51
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
52 use Data::Dumper ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
53 use Getopt::Long ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
54 use File::Basename ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
55 use FindBin ; ## Allows you to locate the directory of original perl script
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
56
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
57 ## Specific Perl Modules (PFEM)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
58 use lib $FindBin::Bin ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
59 my $binPath = $FindBin::Bin ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
60
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
61 ## Dedicate Perl Modules (Home made...)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
62 use Metabolomics::Fragment::Annotation qw( :all ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
63 use Metabolomics::Banks qw( :all ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
64 use Metabolomics::Banks::BloodExposome qw( :all ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
65 use Metabolomics::Utils qw( :all ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
66
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
67 ## Initialized values
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
68 my $ProgramName = basename($0) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
69 my $OptionHelp = undef ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
70 my $VERBOSE = undef ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
71
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
72 my ($inputFile, $mzCol, $asHeader, $ppmError, $mode ) = (undef, undef, undef, undef, undef, undef, undef ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
73 my ($outputTabular, $outputXls, $outputHTML, $outputFull) = (undef, undef, undef, undef) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
74
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
75 my $QueryMode = undef ; # depending of the input data the query mode can be ION|NEUTRAL
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
76
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
77 #=============================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
78 # Manage EXCEPTIONS
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
79 #=============================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
80 &GetOptions ( "h|help" => \$OptionHelp, # HELP
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
81 "v|verbose=i" => \$VERBOSE, # Level of verbose (0 to 2)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
82 "i|input=s" => \$inputFile, # Input file containing a peak list (mz)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
83 "mzCol=i" => \$mzCol, # Column in CSV file for MZ
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
84 "header=i" => \$asHeader, # CSV file as header (1=true, 0=false)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
85 "ppmError=f" => \$ppmError, # ppm error
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
86 "m|mode=s" => \$mode, # indicate the ionisation mode (POS|NEG|NEUTRAL)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
87 "outputTab=s" => \$outputTabular, # output file in tabular format
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
88 "outputXls=s" => \$outputXls, # output file in Xls format
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
89 "outputHtml=s" => \$outputHTML, # output file in html format
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
90 "outputFull=s" => \$outputFull, # output file in full format
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
91
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
92 ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
93
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
94 ## if you put the option -help or -h function help is started
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
95 if ( defined($OptionHelp) ){ &help ; }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
96
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
97 #=============================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
98 # MAIN SCRIPT
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
99 #=============================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
100
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
101 if ($VERBOSE == 3) {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
102 print "The $ProgramName program is launched as:\n";
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
103 print "./$ProgramName " ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
104 print "--h " if (defined $OptionHelp) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
105 print "--input $inputFile " if (defined $inputFile) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
106 print "--mzCol $mzCol " if (defined $mzCol) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
107 print "--header $asHeader " if (defined $asHeader) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
108 print "--ppmError $ppmError " if (defined $ppmError) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
109 print "--mode $mode " if (defined $mode) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
110 # print "--outputXls $outputXls " if (defined $outputXls) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
111 print "--outputTab $outputTabular " if (defined $outputTabular) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
112 # print "--outputHtml $outputHTML " if (defined $outputHTML) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
113 print "--outputFull $outputFull " if (defined $outputFull) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
114 print "with verbose $VERBOSE" ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
115 print "\n" ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
116 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
117
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
118 ## Get conf
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
119 my ( $oCONF, $oTEMPLATE) = ( undef, undef ) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
120 foreach my $conf ( <$binPath/*.cfg> ) { $oCONF = Metabolomics::Utils->utilsAsConf($conf) ; }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
121
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
122 foreach my $template ( <$binPath/_template.tabular> ) { $oTEMPLATE = $template ; }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
123
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
124 #print Dumper $oCONF ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
125
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
126
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
127 if ( ( defined $inputFile ) and ( $inputFile ne "" ) and ( -e $inputFile ) ) {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
128
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
129 # create a empty bank object
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
130 my $oBank = Metabolomics::Banks::BloodExposome->new() ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
131
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
132 # get contaminants bank
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
133 my ($validedMode, $totalEntryNum) = (undef, 0, 0) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
134
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
135 $oBank->getMetabolitesFromSource() ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
136
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
137 if ( ( defined $mode ) and ( ( $mode eq 'POSITIVE' ) | ( $mode eq 'NEGATIVE' ) | ( $mode eq 'NEUTRAL' ) ) ) {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
138 $validedMode = $mode ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
139 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
140 else {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
141 croak "[ERROR] Your ionisation mode is not defined or is different to POSITIVE or NEGATIVE\n"
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
142 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
143
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
144 # build the query object
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
145 $totalEntryNum = $oBank->buildTheoPeakBankFromEntries($validedMode) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
146
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
147 # get experimental masses
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
148 if ( (defined $mzCol) and (defined $asHeader) ) {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
149 $oBank->parsingMsFragments($inputFile, $asHeader, $mzCol) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
150 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
151
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
152 ## Analysis :
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
153 my $oAnalysis = Metabolomics::Fragment::Annotation->new($oBank) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
154
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
155 # print Dumper $oAnalysis ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
156
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
157 # Compare peaklists:
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
158 $oAnalysis->compareExpMzToTheoMzList('PPM', $ppmError) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
159
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
160 # print Dumper $oBank ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
161
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
162
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
163
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
164 # complete initial input tabular file
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
165 if ( (defined $outputFull) and (defined $inputFile) ) {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
166 my $tabularfile = $oAnalysis->writeFullTabularWithPeakBankObject($inputFile, $oTEMPLATE, $outputFull)
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
167 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
168 # write a simple tabular output
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
169 if ( (defined $outputTabular) and (defined $inputFile) ) {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
170 my $tabularfile = $oAnalysis->writeTabularWithPeakBankObject($oTEMPLATE, $outputTabular) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
171 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
172 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
173 else {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
174 croak "Input file is not defined or is not exist.\n" ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
175 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
176
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
177
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
178
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
179
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
180
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
181 #====================================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
182 # Help subroutine called with -h option
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
183 # number of arguments : 0
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
184 # Argument(s) :
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
185 # Return : 1
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
186 #====================================================================================
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
187 sub help {
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
188
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
189
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
190 print STDERR <<EOF ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
191 ### $ProgramName ###
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
192 #
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
193 # AUTHOR: Franck Giacomoni
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
194 # VERSION: 1.0
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
195 # CREATED: 2019/08/21
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
196 # LAST MODIF:
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
197 # PURPOSE: This program annotates any known or hypothetical metabolites (peak matching) from ms analysis with BloodExposome database
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
198 # USAGE: $ProgramName or $ProgramName --input *.tabular --mzCol INT --header INT --ppmError 5 --mode POSITIVE|NEGATIVE|NEUTRAL --outputTab outTab.tabular --outputFull outFull.tabular --verbose 3
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
199 EOF
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
200 exit(1) ;
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
201 }
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
202
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
203 ## END of script - F Giacomoni
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
204
94eeed7f737f planemo upload commit 399d2714dd85043f2ed8bdeff05bb1ccd4c5dd29
fgiacomoni
parents:
diff changeset
205 __END__