line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finnigan::ScanEvent; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings FATAL => qw( all ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
205
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.0206; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
8
|
use Finnigan; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
43
|
|
8
|
2
|
|
|
2
|
|
8
|
use base 'Finnigan::Decoder'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
148
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
9
|
use overload ('""' => 'stringify'); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub decode { |
13
|
33
|
|
|
33
|
1
|
53
|
my ($class, $stream, $version) = @_; |
14
|
|
|
|
|
|
|
|
15
|
33
|
|
|
|
|
106
|
my @common_head = ( |
16
|
|
|
|
|
|
|
"preamble" => ['object', 'Finnigan::ScanEventPreamble'], |
17
|
|
|
|
|
|
|
"np" => ['V', 'UInt32'], |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
33
|
|
|
|
|
107
|
my $self = Finnigan::Decoder->read($stream, \@common_head, $version); |
21
|
33
|
|
|
|
|
80
|
bless $self, $class; |
22
|
|
|
|
|
|
|
|
23
|
33
|
100
|
|
|
|
83
|
if ( $self->np ) { |
24
|
23
|
|
|
|
|
43
|
$self->iterate_object($stream, $self->np, reaction => 'Finnigan::Reaction'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
33
|
|
|
|
|
140
|
my @common_middle = ( |
28
|
|
|
|
|
|
|
"unknown long[1]" => ['V', 'UInt32'], |
29
|
|
|
|
|
|
|
"fraction collector" => ['object', 'Finnigan::FractionCollector'], |
30
|
|
|
|
|
|
|
"nparam" => ['V', 'UInt32'], |
31
|
|
|
|
|
|
|
); |
32
|
33
|
|
|
|
|
112
|
$self->SUPER::decode($stream, \@common_middle, $version); |
33
|
|
|
|
|
|
|
|
34
|
33
|
100
|
|
|
|
79
|
if ( $self->nparam == 0 ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# do nothing |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( $self->nparam == 4 ) { |
38
|
0
|
|
|
|
|
0
|
my $fields = [ |
39
|
|
|
|
|
|
|
"unknown double" => ['d<', 'Float64'], |
40
|
|
|
|
|
|
|
"A" => ['d<', 'Float64'], |
41
|
|
|
|
|
|
|
"B" => ['d<', 'Float64'], |
42
|
|
|
|
|
|
|
"C" => ['d<', 'Float64'], |
43
|
|
|
|
|
|
|
]; |
44
|
0
|
|
|
|
|
0
|
$self->SUPER::decode($stream, $fields); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
elsif ( $self->nparam == 7 ) { |
47
|
10
|
|
|
|
|
83
|
my $fields = [ |
48
|
|
|
|
|
|
|
"unknown double" => ['d<', 'Float64'], |
49
|
|
|
|
|
|
|
"I" => ['d<', 'Float64'], |
50
|
|
|
|
|
|
|
"A" => ['d<', 'Float64'], |
51
|
|
|
|
|
|
|
"B" => ['d<', 'Float64'], |
52
|
|
|
|
|
|
|
"C" => ['d<', 'Float64'], |
53
|
|
|
|
|
|
|
"D" => ['d<', 'Float64'], |
54
|
|
|
|
|
|
|
"E" => ['d<', 'Float64'], |
55
|
|
|
|
|
|
|
]; |
56
|
10
|
|
|
|
|
37
|
$self->SUPER::decode($stream, $fields); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else { |
59
|
0
|
|
|
|
|
0
|
die "don't know how to interpret the set of " . $self->nparam . " conversion parameters"; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
33
|
|
|
|
|
119
|
my @common_tail = ( |
63
|
|
|
|
|
|
|
"unknown long[2]" => ['V', 'UInt32'], |
64
|
|
|
|
|
|
|
"unknown long[3]" => ['V', 'UInt32'], |
65
|
|
|
|
|
|
|
); |
66
|
33
|
|
|
|
|
94
|
$self->SUPER::decode($stream, \@common_tail, $version); |
67
|
|
|
|
|
|
|
|
68
|
33
|
|
|
|
|
2296
|
return $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub purge_unused_data { |
72
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
73
|
0
|
|
|
|
|
0
|
$self->SUPER::purge_unused_data; |
74
|
0
|
|
|
|
|
0
|
$self->preamble->purge_unused_data; |
75
|
0
|
|
|
|
|
0
|
$self->fraction_collector->purge_unused_data; |
76
|
0
|
0
|
|
|
|
0
|
if ($self->precursors) { |
77
|
0
|
|
|
|
|
0
|
foreach my $r ( @{$self->precursors} ) { |
|
0
|
|
|
|
|
0
|
|
78
|
0
|
|
|
|
|
0
|
$r->purge_unused_data; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
|
|
0
|
return $self; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub np { |
85
|
|
|
|
|
|
|
# the number of precrusor ions |
86
|
60
|
|
|
60
|
1
|
271
|
shift->{data}->{"np"}->{value}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub preamble { |
90
|
19
|
|
|
19
|
1
|
208
|
shift->{data}->{"preamble"}->{value}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub fraction_collector { |
94
|
4
|
|
|
4
|
1
|
18
|
shift->{data}->{"fraction collector"}->{value}; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub precursors { |
98
|
3
|
|
|
3
|
1
|
11
|
shift->{data}->{"reaction"}->{value}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub reaction { |
102
|
4
|
|
|
4
|
1
|
929
|
shift->{data}->{"reaction"}->{value}->[0]; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub nparam { |
106
|
53
|
|
|
53
|
1
|
161
|
shift->{data}->{"nparam"}->{value}; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub unknown_double { |
110
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"unknown double"}->{value}; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub I { |
114
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"I"}->{value}; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub A { |
118
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"A"}->{value}; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub B { |
122
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"B"}->{value}; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub C { |
126
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"C"}->{value}; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub D { |
130
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"D"}->{value}; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub E { |
134
|
0
|
|
|
0
|
1
|
0
|
shift->{data}->{"E"}->{value}; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub converter { |
138
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
139
|
1
|
50
|
|
|
|
10
|
if ( $self->{data}->{nparam}->{value} == 0 ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# no conversion parameters -- no conversion |
141
|
0
|
|
|
0
|
|
0
|
return sub{$_[0]}; # the null converter allows the M/z spectra to pass unchanged |
|
0
|
|
|
|
|
0
|
|
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
elsif ( $self->{data}->{nparam}->{value} == 4 ) { |
144
|
|
|
|
|
|
|
# LTQ-FT |
145
|
0
|
|
|
|
|
0
|
my $A = $self->{data}->{A}->{value}; |
146
|
0
|
|
|
|
|
0
|
my $B = $self->{data}->{B}->{value}; |
147
|
0
|
|
|
|
|
0
|
my $C = $self->{data}->{C}->{value}; |
148
|
0
|
|
|
0
|
|
0
|
return sub {$A + $B/$_[0] + $C/$_[0]/$_[0]}; # $_[0] = frequency |
|
0
|
|
|
|
|
0
|
|
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
elsif ( $self->{data}->{nparam}->{value} == 7 ) { |
151
|
|
|
|
|
|
|
# Orbitrap |
152
|
1
|
|
|
|
|
2
|
my $A = $self->{data}->{A}->{value}; |
153
|
1
|
|
|
|
|
4
|
my $B = $self->{data}->{B}->{value}; |
154
|
1
|
|
|
|
|
2
|
my $C = $self->{data}->{C}->{value}; |
155
|
1
|
|
|
7758
|
|
8
|
return sub {$A + $B/($_[0]**2) + $C/($_[0]**4)}; # $_[0] = frequency |
|
7758
|
|
|
|
|
37062
|
|
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
else { |
158
|
0
|
|
|
|
|
0
|
die "don't know how to convert with " . $self->nparam . " conversion parameters"; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub inverse_converter { |
163
|
1
|
|
|
1
|
1
|
229
|
my $self = shift; |
164
|
1
|
50
|
|
|
|
11
|
if ( $self->{data}->{nparam}->{value} == 0 ) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# no conversion parameters -- no conversion |
166
|
0
|
|
|
0
|
|
0
|
return sub{shift}; # the null converter allows the M/z spectra to pass unchanged |
|
0
|
|
|
|
|
0
|
|
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
elsif ( $self->{data}->{nparam}->{value} == 4 ) { |
169
|
|
|
|
|
|
|
# LTQ-FT |
170
|
0
|
|
|
|
|
0
|
my $A = $self->{data}->{A}->{value}; |
171
|
0
|
|
|
|
|
0
|
my $B = $self->{data}->{B}->{value}; |
172
|
0
|
|
|
|
|
0
|
my $C = $self->{data}->{C}->{value}; |
173
|
|
|
|
|
|
|
return sub { |
174
|
0
|
|
|
0
|
|
0
|
(-$B - sqrt($B**2 - 4*$C*($A - $_[0]))) # $_[0] == Mz |
175
|
|
|
|
|
|
|
/ |
176
|
|
|
|
|
|
|
(2*($A - $_[0])); |
177
|
0
|
|
|
|
|
0
|
}; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
elsif ( $self->{data}->{nparam}->{value} == 7 ) { |
180
|
|
|
|
|
|
|
# Orbitrap |
181
|
1
|
|
|
|
|
3
|
my $A = $self->{data}->{A}->{value}; |
182
|
1
|
|
|
|
|
3
|
my $B = $self->{data}->{B}->{value}; |
183
|
1
|
|
|
|
|
2
|
my $C = $self->{data}->{C}->{value}; |
184
|
|
|
|
|
|
|
return sub { |
185
|
|
|
|
|
|
|
sqrt( |
186
|
1
|
|
|
1
|
|
30
|
(-$B - sqrt($B**2 - 4*$C*($A - $_[0]))) # $_[0] == Mz |
187
|
|
|
|
|
|
|
/ |
188
|
|
|
|
|
|
|
(2*($A - $_[0])) |
189
|
|
|
|
|
|
|
); |
190
|
1
|
|
|
|
|
6
|
}; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
else { |
193
|
0
|
|
|
|
|
0
|
die "don't know how to convert with " . $self->nparam . " conversion parameters"; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub stringify { |
198
|
2
|
|
|
2
|
1
|
2
|
my $self = shift; |
199
|
|
|
|
|
|
|
|
200
|
2
|
|
|
|
|
6
|
my $p = $self->preamble; |
201
|
2
|
|
|
|
|
7
|
my $f = $self->fraction_collector; |
202
|
2
|
100
|
|
|
|
5
|
if ( $self->np ) { |
203
|
1
|
|
|
|
|
4
|
my $pr = $self->precursors; |
204
|
1
|
|
|
|
|
4
|
my $r = join ", ", map {"$_"} @$pr; |
|
1
|
|
|
|
|
4
|
|
205
|
1
|
|
|
|
|
4
|
return "$p $r $f"; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
else { |
208
|
1
|
|
|
|
|
6
|
return "$p $f"; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
1; |
214
|
|
|
|
|
|
|
__END__ |