Mercurial > repos > fgiacomoni > massbank_ws_searchspectrum
annotate lib/massbank_parser.pm @ 0:023c380900ef draft default tip
Init repository with last massbank_ws_searchspectrum master version
author | fgiacomoni |
---|---|
date | Wed, 19 Apr 2017 11:31:58 -0400 |
parents | |
children |
rev | line source |
---|---|
0
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
1 package lib::massbank_parser ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
2 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
3 use strict; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
4 use warnings ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
5 use Exporter ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
6 use Carp ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
7 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
8 use File::Basename; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
9 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
10 use Data::Dumper ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
11 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
12 use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS); |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
13 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
14 our $VERSION = "1.0" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
15 our @ISA = qw(Exporter) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
16 our @EXPORT = qw( getChemNamesFromString getPeaksFromString ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
17 our %EXPORT_TAGS = ( ALL => [qw( getChemNamesFromString getPeaksFromString )] ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
18 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
19 =head1 NAME |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
20 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
21 parser::chem::massbank - An example module |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
22 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
23 =head1 SYNOPSIS |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
24 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
25 use parser::chem::massbank ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
26 my $object = parser::chem::massbank->new(); |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
27 print $object->as_string; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
28 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
29 =head1 DESCRIPTION |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
30 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
31 This module does not really exist, it |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
32 was made for the sole purpose of |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
33 demonstrating how POD works. |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
34 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
35 =head1 METHODS |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
36 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
37 Methods are : |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
38 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
39 =head2 METHOD new |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
40 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
41 ## Description : new |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
42 ## Input : $self |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
43 ## Ouput : bless $self ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
44 ## Usage : new() ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
45 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
46 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
47 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
48 sub new { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
49 ## Variables |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
50 my $self={}; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
51 bless($self) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
52 return $self ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
53 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
54 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
55 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
56 =head2 METHOD get_list_of_analysis_intrument_names |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
57 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
58 ## Description : permt de retourner la liste des nom uniques des instruments utilises |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
59 ## Input : $dir, $ms_files (a list of files) |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
60 ## Output : $names |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
61 ## Usage : my ( $names ) = get_list_of_analysis_intrument_names( $ms_files ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
62 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
63 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
64 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
65 sub get_list_of_analysis_intrument_names { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
66 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
67 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
68 my ( $dir, $ms_files ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
69 my (%tmp_names, @names) = ( (), () ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
70 foreach my $ms_file (@{$ms_files}) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
71 my $file = $dir.'\\'.$ms_file ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
72 if ( ( defined $file ) and ( -e $file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
73 open(MS, "<$file") or die "Cant' read the file $file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
74 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
75 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
76 if ($field =~/AC\$INSTRUMENT:(.*)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
77 if ( $tmp_names{$1} ) { last ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
78 else { $tmp_names{$1} = 1 ; push (@names, $1) ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
79 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
80 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
81 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
82 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
83 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
84 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
85 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
86 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
87 return(\@names) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
88 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
89 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
90 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
91 =head2 METHOD get_analysis_instruments_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
92 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
93 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
94 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
95 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
96 ## Usage : my ( $features ) = get_analysis_instruments_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
97 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
98 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
99 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
100 sub get_analysis_instruments_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
101 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
102 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
103 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
104 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
105 my $control = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
106 my %features = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
107 'name' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
108 'type' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
109 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
110 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
111 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
112 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
113 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
114 if ($field =~/AC\$INSTRUMENT: (.*)/) { $features{'name'} = $1 ; $control++; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
115 elsif ($field =~/AC\$INSTRUMENT_TYPE: (.*)/) { $features{'type'} = $1 ; $control++; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
116 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
117 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
118 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
119 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
120 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
121 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
122 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
123 if ($control == 0) { %features = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
124 return(\%features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
125 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
126 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
127 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
128 =head2 METHOD get_ms_methods_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
129 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
130 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
131 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
132 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
133 ## Usage : my ( $features ) = get_ms_methods_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
134 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
135 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
136 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
137 sub get_ms_methods_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
138 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
139 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
140 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
141 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
142 my $control = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
143 my %features = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
144 'ion_mode' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
145 'ms_type' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
146 'collision_energy' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
147 'collision_gas' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
148 'desolvation_gas_flow' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
149 'desolvation_temperature' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
150 'ionization_energy' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
151 'laser' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
152 'matrix' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
153 'mass_accuracy' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
154 'reagent_gas' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
155 'scanning' => undef |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
156 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
157 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
158 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
159 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
160 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
161 if ($field =~/AC\$MASS_SPECTROMETRY: ION_MODE:(.*)/) { $features{'ion_mode'} = $1 ; $control++; } # mandatory |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
162 elsif ($field =~/AC\$MASS_SPECTROMETRY: MS_TYPE:(.*)/) { $features{'ms_type'} = $1 ; $control++; } # mandatory |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
163 elsif ($field =~/AC\$MASS_SPECTROMETRY: COLLISION_ENERGY(.*)/) { $features{'collision_energy'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
164 elsif ($field =~/AC\$MASS_SPECTROMETRY: COLLISION_GAS(.*)/) { $features{'collision_gas'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
165 elsif ($field =~/AC\$MASS_SPECTROMETRY: DESOLVATION_GAS_FLOW(.*)/) { $features{'desolvation_gas_flow'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
166 elsif ($field =~/AC\$MASS_SPECTROMETRY: DESOLVATION_TEMPERATURE(.*)/) { $features{'desolvation_temperature'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
167 elsif ($field =~/AC\$MASS_SPECTROMETRY: IONIZATION_ENERGY(.*)/) { $features{'ionization_energy'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
168 elsif ($field =~/AC\$MASS_SPECTROMETRY: LASER(.*)/) { $features{'laser'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
169 elsif ($field =~/AC\$MASS_SPECTROMETRY: MATRIX(.*)/) { $features{'matrix'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
170 elsif ($field =~/AC\$MASS_SPECTROMETRY: MASS_ACCURACY(.*)/) { $features{'mass_accuracy'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
171 elsif ($field =~/AC\$MASS_SPECTROMETRY: REAGENT_GAS(.*)/) { $features{'reagent_gas'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
172 elsif ($field =~/AC\$MASS_SPECTROMETRY: SCANNING(.*)/) { $features{'scanning'} = $1 ; $control++; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
173 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
174 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
175 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
176 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
177 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
178 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
179 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
180 ## vide l'object si undef |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
181 if ($control == 0) { %features = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
182 return(\%features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
183 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
184 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
185 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
186 =head2 METHOD get_solvents_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
187 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
188 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
189 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
190 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
191 ## Usage : my ( $features ) = get_solvents_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
192 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
193 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
194 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
195 sub get_solvents_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
196 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
197 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
198 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
199 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
200 my @features = () ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
201 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
202 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
203 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
204 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
205 if ($field =~/AC\$CHROMATOGRAPHY: SOLVENT(.*)/) { push(@features, 'Solvent '.$1 ) ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
206 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
207 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
208 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
209 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
210 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
211 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
212 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
213 return(\@features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
214 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
215 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
216 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
217 =head2 METHOD get_sample_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
218 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
219 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
220 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
221 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
222 ## Usage : my ( $features ) = get_sample_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
223 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
224 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
225 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
226 sub get_sample_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
227 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
228 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
229 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
230 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
231 my $control = 0; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
232 my %features = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
233 'sample_type' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
234 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
235 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
236 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
237 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
238 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
239 if ($field =~/SP\$SAMPLE(.*)/) { $features{'sample_type'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
240 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
241 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
242 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
243 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
244 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
245 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
246 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
247 if ($control == 0) { %features = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
248 return(\%features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
249 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
250 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
251 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
252 =head2 METHOD get_chromato_methods_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
253 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
254 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
255 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
256 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
257 ## Usage : my ( $features ) = get_chromato_methods_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
258 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
259 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
260 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
261 sub get_chromato_methods_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
262 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
263 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
264 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
265 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
266 my $control = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
267 my %features = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
268 'capillary_voltage' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
269 'column_name' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
270 'column_temperature' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
271 'flow_gradient' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
272 'flow_rate' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
273 'retention_time' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
274 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
275 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
276 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
277 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
278 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
279 if ($field =~/AC\$CHROMATOGRAPHY: CAPILLARY_VOLTAGE (.*)/) { $features{'capillary_voltage'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
280 elsif ($field =~/AC\$CHROMATOGRAPHY: COLUMN_NAME (.*)/) { $features{'column_name'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
281 elsif ($field =~/AC\$CHROMATOGRAPHY: COLUMN_TEMPERATURE (.*)/) { $features{'column_temperature'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
282 elsif ($field =~/AC\$CHROMATOGRAPHY: FLOW_GRADIENT (.*)/) { $features{'flow_gradient'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
283 elsif ($field =~/AC\$CHROMATOGRAPHY: FLOW_RATE (.*)/) { $features{'flow_rate'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
284 elsif ($field =~/AC\$CHROMATOGRAPHY: RETENTION_TIME (.*)/) { $features{'retention_time'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
285 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
286 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
287 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
288 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
289 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
290 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
291 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
292 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
293 if ($control == 0) { %features = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
294 return(\%features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
295 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
296 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
297 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
298 =head2 METHOD get_analytical_conditions_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
299 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
300 ## Description : permet de recuperer tous les champs d'un object massbank .. for massbank version < 2.0 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
301 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
302 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
303 ## Usage : my ( $features ) = get_analytical_conditions_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
304 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
305 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
306 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
307 sub get_analytical_conditions_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
308 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
309 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
310 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
311 my $control_ms = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
312 my %features_ms = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
313 'ion_mode' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
314 'ms_type' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
315 'collision_energy' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
316 'collision_gas' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
317 'desolvation_gas_flow' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
318 'desolvation_temperature' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
319 'ionization_energy' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
320 'laser' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
321 'matrix' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
322 'mass_accuracy' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
323 'reagent_gas' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
324 'scanning' => undef |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
325 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
326 my $control_chrom = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
327 my %features_chrom = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
328 'capillary_voltage' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
329 'column_name' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
330 'column_temperature' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
331 'flow_gradient' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
332 'flow_rate' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
333 'retention_time' => undef |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
334 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
335 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
336 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
337 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
338 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
339 ## new = chromato_method |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
340 if ($field =~/AC\$ANALYTICAL_CONDITION: CAPILLARY_VOLTAGE (.*)/) { $features_chrom{'capillary_voltage'} = $1 ; $control_chrom++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
341 elsif ($field =~/AC\$ANALYTICAL_CONDITION: COLUMN_NAME (.*)/) { $features_chrom{'column_name'} = $1 ; $control_chrom++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
342 elsif ($field =~/AC\$ANALYTICAL_CONDITION: COLUMN_TEMPERATURE( .*)/) { $features_chrom{'column_temperature'} = $1 ; $control_chrom++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
343 elsif ($field =~/AC\$ANALYTICAL_CONDITION: FLOW_GRADIENT (.*)/) { $features_chrom{'flow_gradient'} = $1 ; $control_chrom++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
344 elsif ($field =~/AC\$ANALYTICAL_CONDITION: FLOW_RATE (.*)/) { $features_chrom{'flow_rate'} = $1 ; $control_chrom++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
345 elsif ($field =~/AC\$ANALYTICAL_CONDITION: RETENTION_TIME (.*)/) { $features_chrom{'retention_time'} = $1 ; $control_chrom++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
346 ## new = ms_method |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
347 elsif ($field =~/AC\$ANALYTICAL_CONDITION: ION_MODE (.*)/) { $features_ms{'ion_mode'} = $1 ; $control_ms++ ; } # mandatory |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
348 elsif ($field =~/AC\$ANALYTICAL_CONDITION: MS_TYPE (.*)/) { $features_ms{'ms_type'} = $1 ; $control_ms++ ; } # mandatory |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
349 elsif ($field =~/AC\$ANALYTICAL_CONDITION: COLLISION_ENERGY (.*)/) { $features_ms{'collision_energy'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
350 elsif ($field =~/AC\$ANALYTICAL_CONDITION: COLLISION_GAS (.*)/) { $features_ms{'collision_gas'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
351 elsif ($field =~/AC\$ANALYTICAL_CONDITION: DESOLVATION_GAS_FLOW (.*)/) { $features_ms{'desolvation_gas_flow'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
352 elsif ($field =~/AC\$ANALYTICAL_CONDITION: DESOLVATION_TEMPERATURE (.*)/) { $features_ms{'desolvation_temperature'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
353 elsif ($field =~/AC\$ANALYTICAL_CONDITION: IONIZATION_ENERGY (.*)/) { $features_ms{'ionization_energy'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
354 elsif ($field =~/AC\$ANALYTICAL_CONDITION: LASER (.*)/) { $features_ms{'laser'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
355 elsif ($field =~/AC\$ANALYTICAL_CONDITION: MATRIX (.*)/) { $features_ms{'matrix'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
356 elsif ($field =~/AC\$ANALYTICAL_CONDITION: MASS_ACCURACY (.*)/) { $features_ms{'mass_accuracy'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
357 elsif ($field =~/AC\$ANALYTICAL_CONDITION: REAGENT_GAS (.*)/) { $features_ms{'reagent_gas'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
358 elsif ($field =~/AC\$ANALYTICAL_CONDITION: SCANNING (.*)/) { $features_ms{'scanning'} = $1 ; $control_ms++ ; } # optionnal |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
359 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
360 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
361 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
362 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
363 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
364 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
365 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
366 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
367 if ($control_ms == 0) { %features_ms = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
368 if ($control_chrom == 0) { %features_chrom = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
369 return(\%features_chrom, \%features_ms) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
370 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
371 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
372 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
373 =head2 METHOD get_spectrums_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
374 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
375 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
376 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
377 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
378 ## Usage : my ( $features ) = get_spectrums_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
379 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
380 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
381 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
382 sub get_spectrums_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
383 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
384 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
385 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
386 my $control = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
387 my %features = ( |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
388 'ion_type' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
389 'precursor_mz' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
390 'precursor_type' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
391 'num_peaks' => undef, |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
392 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
393 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
394 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
395 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
396 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
397 if ($field =~/MS\$FOCUSED_ION: ION_TYPE(.*)/) { $features{'ion_type'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
398 elsif ($field =~/MS\$FOCUSED_ION: PRECURSOR_M\/Z(.*)/) { $features{'precursor_mz'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
399 elsif ($field =~/MS\$FOCUSED_ION: PRECURSOR_TYPE(.*)/) { $features{'precursor_type'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
400 elsif ($field =~/PK\$NUM_PEAK: (.*)/) { $features{'num_peaks'} = $1 ; $control++ ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
401 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
402 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
403 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
404 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
405 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
406 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
407 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
408 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
409 if ($control == 0) { %features = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
410 return(\%features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
411 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
412 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
413 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
414 =head2 METHOD get_peaks_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
415 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
416 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
417 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
418 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
419 ## Usage : my ( $features ) = get_peaks_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
420 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
421 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
422 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
423 sub get_peaks_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
424 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
425 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
426 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
427 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
428 my @features = () ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
429 my $peaks = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
430 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
431 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
432 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
433 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
434 if ($field =~/PK\$PEAK: m\/z int\. rel\.int\./) { $peaks = 1 ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
435 elsif ( $peaks == 1 ) { ## detected peak area |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
436 if ($field =~/\s+(\d+)\s+(\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
437 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
438 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
439 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
440 ## for int = xx.xxx and mz = xxx.xxx |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
441 elsif ($field =~/\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
442 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
443 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
444 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
445 ## for int = xx and mz = xxx.xxx |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
446 elsif ($field =~/\s+(\d+\.\d+)\s+(\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
447 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
448 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
449 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
450 ## for int = xxxxx.xxx and mz = xxx |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
451 elsif ($field =~/\s+(\d+)\s+(\d+\.\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
452 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
453 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
454 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
455 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
456 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
457 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
458 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
459 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
460 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
461 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
462 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
463 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
464 return(\@features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
465 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
466 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
467 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
468 =head2 METHOD getPeaksFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
469 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
470 ## Description : permet de recuperer la data peaks d'un record handler massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
471 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
472 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
473 ## Usage : my ( $features ) = getPeaksFromString( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
474 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
475 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
476 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
477 sub getPeaksFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
478 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
479 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
480 my ( $record ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
481 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
482 my @features = () ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
483 my $peaks = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
484 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
485 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
486 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
487 if ($field =~/PK\$PEAK: m\/z int\. rel\.int\./) { $peaks = 1 ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
488 elsif ( $peaks == 1 ) { ## detected peak area |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
489 if ($field =~/\s+(\d+)\s+(\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
490 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
491 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
492 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
493 ## for int = xx.xxx and mz = xxx.xxx |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
494 elsif ($field =~/\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
495 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
496 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
497 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
498 ## for int = xx and mz = xxx.xxx |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
499 elsif ($field =~/\s+(\d+\.\d+)\s+(\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
500 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
501 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
502 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
503 ## for int = xxxxx.xxx and mz = xxx |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
504 elsif ($field =~/\s+(\d+)\s+(\d+\.\d+)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
505 my %tmp = ( 'mz' => $1, 'intensity' => $2, 'relative_intensity' => $3 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
506 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
507 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
508 ## for int = x.xxxex and m/z = xxx.xxx (int with exposant) |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
509 elsif ($field =~/\s+(\d+\.\d+)\s+(\d+\.\d+)e(\d)\s+(\d+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
510 my %tmp = ( 'mz' => $1, 'intensity' => ($2*(10*$3)), 'relative_intensity' => $4 ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
511 push (@features, \%tmp) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
512 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
513 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
514 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
515 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
516 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
517 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
518 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
519 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
520 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
521 return(\@features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
522 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
523 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
524 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
525 =head2 METHOD getIdFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
526 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
527 ## Description : get the accesion id of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
528 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
529 ## Output : $id |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
530 ## Usage : my ( $id ) = getIdFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
531 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
532 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
533 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
534 sub getIdFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
535 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
536 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
537 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
538 my ( $id ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
539 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
540 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
541 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
542 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
543 if ($field =~/ACCESSION:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
544 $id = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
545 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
546 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
547 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
548 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
549 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
550 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
551 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
552 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
553 return ($id) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
554 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
555 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
556 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
557 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
558 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
559 =head2 METHOD getInstrumentTypeFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
560 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
561 ## Description : get the instrument type of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
562 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
563 ## Output : $instrumentType |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
564 ## Usage : my ( $instrumentType ) = getInstrumentTypeFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
565 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
566 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
567 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
568 sub getInstrumentTypeFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
569 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
570 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
571 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
572 my ( $instrumentType ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
573 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
574 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
575 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
576 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
577 if ($field =~/INSTRUMENT_TYPE:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
578 $instrumentType = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
579 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
580 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
581 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
582 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
583 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
584 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
585 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
586 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
587 return ($instrumentType) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
588 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
589 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
590 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
591 =head2 METHOD getFormulaFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
592 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
593 ## Description : get the elementar formula of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
594 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
595 ## Output : $formula |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
596 ## Usage : my ( $formula ) = getFormulaFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
597 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
598 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
599 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
600 sub getFormulaFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
601 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
602 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
603 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
604 my ( $formula ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
605 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
606 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
607 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
608 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
609 if ($field =~/CH\$FORMULA:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
610 $formula = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
611 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
612 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
613 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
614 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
615 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
616 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
617 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
618 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
619 return ($formula) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
620 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
621 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
622 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
623 =head2 METHOD getInchiFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
624 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
625 ## Description : get the IUPAC InCHi of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
626 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
627 ## Output : $inchi |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
628 ## Usage : my ( $inchi ) = getInchiFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
629 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
630 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
631 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
632 sub getInchiFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
633 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
634 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
635 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
636 my ( $inchi ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
637 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
638 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
639 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
640 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
641 if ($field =~/CH\$IUPAC:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
642 $inchi = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
643 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
644 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
645 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
646 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
647 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
648 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
649 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
650 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
651 return ($inchi) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
652 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
653 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
654 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
655 =head2 METHOD getExactMzFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
656 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
657 ## Description : get the exact mass of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
658 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
659 ## Output : $exactMass |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
660 ## Usage : my ( $exactMass ) = getExactMzFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
661 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
662 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
663 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
664 sub getExactMzFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
665 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
666 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
667 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
668 my ( $exactMass ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
669 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
670 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
671 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
672 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
673 if ($field =~/CH\$EXACT_MASS:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
674 $exactMass = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
675 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
676 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
677 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
678 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
679 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
680 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
681 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
682 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
683 return ($exactMass) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
684 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
685 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
686 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
687 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
688 =head2 METHOD getPrecursorTypeFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
689 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
690 ## Description : get the precursor type of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
691 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
692 ## Output : $precursorType |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
693 ## Usage : my ( $precursorType ) = getPrecursorTypeFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
694 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
695 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
696 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
697 sub getPrecursorTypeFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
698 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
699 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
700 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
701 my $id = undef ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
702 my $precursorType = undef ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
703 my $precursorType_first = undef ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
704 my $ionType_first = undef ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
705 my $precursorType_optionnal = undef ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
706 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
707 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
708 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
709 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
710 if ($field =~/ACCESSION:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
711 $id = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
712 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
713 if ($field =~/RECORD_TITLE:\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
714 my @title = split(/;/, $1) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
715 $precursorType_optionnal = $title[-1] ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
716 $precursorType_optionnal =~ s/\s//g ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
717 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
718 if ($field =~/PRECURSOR_TYPE(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
719 $precursorType_first = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
720 last; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
721 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
722 if ($field =~/ION_TYPE(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
723 $ionType_first = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
724 last; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
725 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
726 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
727 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
728 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
729 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
730 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
731 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
732 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
733 ## manage undef precursor/ion type field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
734 # print "ID:$id-//-$precursorType_first-//-$ionType_first-//-$precursorType_optionnal\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
735 if (defined $precursorType_first) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
736 $precursorType = $precursorType_first ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
737 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
738 elsif ( (!defined $precursorType_first) and (defined $ionType_first) ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
739 $precursorType = $ionType_first ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
740 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
741 elsif ( (!defined $precursorType_first) and (!defined $ionType_first) and (defined $precursorType_optionnal) ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
742 $precursorType = $precursorType_optionnal ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
743 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
744 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
745 $precursorType = 'NA' ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
746 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
747 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
748 return ($precursorType) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
749 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
750 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
751 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
752 =head2 METHOD getMsTypeFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
753 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
754 ## Description : get the MS type of massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
755 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
756 ## Output : $msType |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
757 ## Usage : my ( $msType ) = getMsTypeFromString ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
758 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
759 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
760 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
761 sub getMsTypeFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
762 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
763 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
764 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
765 my ( $msType ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
766 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
767 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
768 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
769 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
770 if ($field =~/AC\$MASS_SPECTROMETRY:\s+MS_TYPE\s+(.+)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
771 $msType = $1; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
772 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
773 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
774 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
775 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
776 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
777 croak "Can't work with a undef / none existing massbank handler\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
778 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
779 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
780 return ($msType) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
781 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
782 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
783 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
784 =head2 METHOD getChemNamesFromString |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
785 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
786 ## Description : get lits of names of a massbank record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
787 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
788 ## Output : $names |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
789 ## Usage : my ( $names ) = getChemNamesFromString( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
790 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
791 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
792 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
793 sub getChemNamesFromString { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
794 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
795 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
796 my ( $record ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
797 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
798 my @names = () ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
799 if ( defined $record ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
800 my @tmp = split(/\n/, $record) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
801 foreach my $field (@tmp) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
802 if ($field =~/CH\$NAME: (.*)/) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
803 push(@names, $1 ) ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
804 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
805 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
806 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
807 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
808 croak "Can't work with a undef / none existing massbank record (string)\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
809 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
810 return(\@names) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
811 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
812 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
813 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
814 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
815 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
816 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
817 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
818 =head2 METHOD getMassBankHandler |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
819 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
820 ## Description : get a massbank handler from a file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
821 ## Input : $record |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
822 ## Output : $massbankHandler |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
823 ## Usage : my ( $massbankHandler ) = getMassBankHandler ( $record ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
824 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
825 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
826 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
827 sub getMassBankHandler { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
828 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
829 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
830 my ( $record ) = @_; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
831 my ( $massbankHandler ) = ( undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
832 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
833 ## TODO... |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
834 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
835 return ($massbankHandler) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
836 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
837 ### END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
838 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
839 =head2 METHOD get_annotations_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
840 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
841 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
842 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
843 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
844 ## Usage : my ( $features ) = get_annotations_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
845 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
846 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
847 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
848 sub get_annotations_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
849 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
850 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
851 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
852 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
853 my @features = () ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
854 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
855 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
856 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
857 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
858 if ($field =~/PK\$ANNOTATION:(.*)/) { push( @features, $1) ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
859 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
860 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
861 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
862 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
863 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
864 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
865 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
866 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
867 return(\@features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
868 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
869 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
870 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
871 =head2 METHOD get_links_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
872 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
873 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
874 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
875 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
876 ## Usage : my ( $features ) = get_annotations_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
877 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
878 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
879 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
880 sub get_links_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
881 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
882 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
883 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
884 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
885 my %features = () ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
886 my $control = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
887 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
888 my ( @CAS, @KEGG, @PUBCHEM ) = ((), (), ()) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
889 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
890 if ( ( defined $ms_file ) and ( -e $ms_file )) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
891 open(MS, "<$ms_file") or die "Cant' read the file $ms_file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
892 while ( my $field = <MS> ){ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
893 chomp $field ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
894 if ($field =~/CH\$LINK: CAS (.*)/) { push (@CAS, $1) ; $control++; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
895 elsif ($field =~/CH\$LINK: KEGG (.*)/) { push (@KEGG, $1) ; $control++; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
896 elsif ($field =~/CH\$LINK: PUBCHEM CID (.*)/) { push (@PUBCHEM, $1) ; $control++; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
897 ## others !!? |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
898 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
899 else { next ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
900 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
901 close(MS) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
902 # for db field |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
903 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
904 else { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
905 croak "Can't work with a undef / none existing massbank file\n" ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
906 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
907 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
908 $features{'CAS'} = \@CAS ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
909 $features{'KEGG'} = \@KEGG ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
910 $features{'PUBCHEM'} = \@PUBCHEM ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
911 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
912 return(\%features) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
913 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
914 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
915 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
916 =head2 METHOD get_ms_record_links_data |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
917 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
918 ## Description : permet de recuperer tous les champs d'un object massbank |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
919 ## Input : $ms_file |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
920 ## Output : $features |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
921 ## Usage : my ( $features ) = get_ms_record_links_data( $ms_file ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
922 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
923 =cut |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
924 ## START of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
925 sub get_ms_record_links_data { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
926 ## Retrieve Values |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
927 my $self = shift ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
928 my ( $ms_file ) = @_ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
929 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
930 ## Internal reference for MASSBANK and RESPECT |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
931 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
932 my @massbank_id = ( 'TUE', 'GLS', 'AU', 'MSJ', 'ML','FIO', 'UF', 'CO', 'UO', 'TT', 'OUF', 'MCH', 'NU', 'KNA', 'MT', 'CE', 'KO', 'KZ', 'JEL', 'JP', 'PR', 'BML', 'CA', 'TY', 'PB', 'FU', 'EA', 'UT', 'BSU', 'WA' ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
933 my @respect_id = ( 'PS', 'PT', 'PM' ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
934 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
935 my $dabase_used = undef ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
936 my %db = ( 'accession' => undef, 'name' => undef ) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
937 my $control = 0 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
938 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
939 if ( $ms_file ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
940 my $filename = basename("$ms_file", ".txt"); |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
941 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
942 if ( $filename =~ /(\w+)$/ ) { # keep only record id (0001-PS0002 => PS0002 or BJ0045 => BJ0045) |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
943 $db{'accession'} = $1 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
944 $control++ ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
945 if ( ( defined $db{'accession'} ) and ( $db{'accession'} =~ /(\D+)(\d+)/) ) { |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
946 my ($key, $eval) = ($1, 0) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
947 foreach (@respect_id) { if ($_ eq $key) { $db{'name'} = 'RESPECT' ; $eval = 1 ; last ; } } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
948 foreach (@massbank_id) { if ($_ eq $key) { $db{'name'} = 'MASSBANK' ; $eval = 1 ; last ; } } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
949 if ( $eval == 0 ){ carp "The following key ($key) for $db{'accession'} has an unknown reference (not a Massbank or ReSpect source)\n" ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
950 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
951 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
952 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
953 if ($control == 0) { %db = () ; } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
954 return(\%db) ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
955 } |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
956 ## END of SUB |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
957 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
958 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
959 1 ; |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
960 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
961 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
962 __END__ |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
963 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
964 =head1 SUPPORT |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
965 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
966 You can find documentation for this module with the perldoc command. |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
967 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
968 perldoc parser::chem::massbank.pm |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
969 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
970 =head1 Exports |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
971 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
972 =over 4 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
973 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
974 =item :ALL is ... |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
975 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
976 =back |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
977 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
978 =head1 AUTHOR |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
979 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
980 Franck Giacomoni E<lt>franck.giacomoni@clermont.inra.frE<gt> |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
981 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
982 =head1 LICENSE |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
983 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
984 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
985 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
986 =head1 VERSION |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
987 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
988 version 1 : 25 / 06 / 2013 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
989 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
990 version 2 : ?? |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
991 |
023c380900ef
Init repository with last massbank_ws_searchspectrum master version
fgiacomoni
parents:
diff
changeset
|
992 =cut |