| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PepXML::Parser; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
15726
|
use 5.010; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
32
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
21
|
|
|
6
|
1
|
|
|
1
|
|
183
|
use XML::Twig; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Moose; |
|
8
|
|
|
|
|
|
|
use namespace::autoclean; |
|
9
|
|
|
|
|
|
|
use PepXML::PepXMLFile; |
|
10
|
|
|
|
|
|
|
use PepXML::MsmsPipelineAnalysis; |
|
11
|
|
|
|
|
|
|
use PepXML::Enzyme; |
|
12
|
|
|
|
|
|
|
use PepXML::RunSummary; |
|
13
|
|
|
|
|
|
|
use PepXML::SearchSummary; |
|
14
|
|
|
|
|
|
|
use PepXML::SearchDatabase; |
|
15
|
|
|
|
|
|
|
use PepXML::AAModification; |
|
16
|
|
|
|
|
|
|
use PepXML::SpectrumQuery; |
|
17
|
|
|
|
|
|
|
use PepXML::SearchHit; |
|
18
|
|
|
|
|
|
|
use PepXML::SearchScore; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#globals |
|
23
|
|
|
|
|
|
|
my $package; |
|
24
|
|
|
|
|
|
|
my $global_file; |
|
25
|
|
|
|
|
|
|
my @enzyme_list; |
|
26
|
|
|
|
|
|
|
my @aamod_list; |
|
27
|
|
|
|
|
|
|
my @param_list; |
|
28
|
|
|
|
|
|
|
my @spec_query_list; |
|
29
|
|
|
|
|
|
|
my @search_hit_list; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'pepxmlfile' => ( |
|
33
|
|
|
|
|
|
|
is => 'rw', |
|
34
|
|
|
|
|
|
|
isa => 'PepXML::PepXMLFile', |
|
35
|
|
|
|
|
|
|
default => sub { |
|
36
|
|
|
|
|
|
|
my $self = shift; |
|
37
|
|
|
|
|
|
|
return my $obj = PepXML::PepXMLFile->new(); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub parse { |
|
43
|
|
|
|
|
|
|
my $self = shift; |
|
44
|
|
|
|
|
|
|
my $file = shift; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$package = $self; |
|
47
|
|
|
|
|
|
|
$global_file = $file; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $parser = XML::Twig->new( |
|
50
|
|
|
|
|
|
|
twig_handlers => |
|
51
|
|
|
|
|
|
|
{ |
|
52
|
|
|
|
|
|
|
msms_pipeline_analysis => \&parse_msms_pipeline_analysis, |
|
53
|
|
|
|
|
|
|
sample_enzyme => \&parse_sample_enzyme, |
|
54
|
|
|
|
|
|
|
msms_run_summary => \&parse_msms_run_summary, |
|
55
|
|
|
|
|
|
|
search_summary => \&parse_search_summary, |
|
56
|
|
|
|
|
|
|
search_hit => \&parse_search_hit, |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
}, |
|
59
|
|
|
|
|
|
|
pretty_print => 'indented', |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$parser->parsefile($file); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#from globals to object |
|
65
|
|
|
|
|
|
|
$package->pepxmlfile->sample_enzyme(\@enzyme_list); |
|
66
|
|
|
|
|
|
|
$package->pepxmlfile->search_hit(\@search_hit_list); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
return $self->pepxmlfile; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub parse_msms_pipeline_analysis { |
|
73
|
|
|
|
|
|
|
my ( $parser, $node ) = @_; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $mpa = PepXML::MsmsPipelineAnalysis->new(); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$mpa->date($node->{'att'}->{'date'}); |
|
78
|
|
|
|
|
|
|
$mpa->xmlns($node->{'att'}->{'xmlns'}); |
|
79
|
|
|
|
|
|
|
$mpa->xmlns_xsi($node->{'att'}->{'xmlns:xsi'}); |
|
80
|
|
|
|
|
|
|
$mpa->xmlns_schemaLocation($node->{'att'}->{'xsi:schemaLocation'}); |
|
81
|
|
|
|
|
|
|
$mpa->summary_xml($node->{'att'}->{'summary_xml'}); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$package->pepxmlfile->msms_pipeline_analysis($mpa); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub parse_sample_enzyme { |
|
88
|
|
|
|
|
|
|
my ( $parser, $node ) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $enz = PepXML::Enzyme->new(); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$enz->name($node->{'att'}->{'name'}); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my @subnodes = $node->children; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
for my $sn ( @subnodes ) { |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$enz->cut($sn->{'att'}->{'cut'}); |
|
99
|
|
|
|
|
|
|
$enz->no_cut($sn->{'att'}->{'no_cut'}); |
|
100
|
|
|
|
|
|
|
$enz->sense($sn->{'att'}->{'sense'}); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
push(@enzyme_list, $enz); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub parse_msms_run_summary { |
|
108
|
|
|
|
|
|
|
my ( $parser, $node ) = @_; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $rs = PepXML::RunSummary->new(); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
$rs->base_name($node->{'att'}->{'base_name'}); |
|
113
|
|
|
|
|
|
|
$rs->msManufacturer($node->{'att'}->{'msManufacturer'}); |
|
114
|
|
|
|
|
|
|
$rs->msModel($node->{'att'}->{'msModel'}); |
|
115
|
|
|
|
|
|
|
$rs->raw_data_type($node->{'att'}->{'raw_data_type'}); |
|
116
|
|
|
|
|
|
|
$rs->raw_data($node->{'att'}->{'raw_data'}); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$package->pepxmlfile->msms_run_summary($rs); |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub parse_search_summary { |
|
123
|
|
|
|
|
|
|
my ( $parser, $node ) = @_; |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
my $sm = PepXML::SearchSummary->new(); |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$sm->base_name($node->{'att'}->{'base_name'}); |
|
128
|
|
|
|
|
|
|
$sm->search_engine($node->{'att'}->{'search_engine'}); |
|
129
|
|
|
|
|
|
|
$sm->search_engine_version($node->{'att'}->{'search_engine_version'}); |
|
130
|
|
|
|
|
|
|
$sm->precursor_mass_type($node->{'att'}->{'precursor_mass_type'}); |
|
131
|
|
|
|
|
|
|
$sm->fragment_mass_type($node->{'att'}->{'fragment_mass_type'}); |
|
132
|
|
|
|
|
|
|
$sm->search_id($node->{'att'}->{'search_id'}); |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
my @subnodes = $node->children; |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
for my $sn ( @subnodes ) { |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
if ( $sn->name eq 'search_database' ) { |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my $sb = PepXML::SearchDatabase->new(); |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$sb->local_path($sn->{'att'}->{'local_path'}); |
|
143
|
|
|
|
|
|
|
$sb->type($sn->{'att'}->{'type'}); |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
$sm->search_database($sb); |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} elsif ( $sn->name eq 'enzymatic_search_constraint' ) { |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
my $esc = PepXML::EnzSearchConstraint->new(); |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
$esc->enzyme($sn->{'att'}->{'enzyme'}); |
|
152
|
|
|
|
|
|
|
$esc->max_num_internal_cleavages($sn->{'att'}->{'max_num_internal_cleavages'}); |
|
153
|
|
|
|
|
|
|
$esc->min_number_termini($sn->{'att'}->{'min_number_termini'}); |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$sm->enzymatic_search_constraint($esc); |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
} elsif ( $sn->name eq 'aminoacid_modification' ) { |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
my $aam = PepXML::AAModification->new(); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$aam->aminoacid($sn->{'att'}->{'aminoacid'}); |
|
162
|
|
|
|
|
|
|
$aam->massdiff($sn->{'att'}->{'massdiff'}); |
|
163
|
|
|
|
|
|
|
$aam->mass($sn->{'att'}->{'mass'}); |
|
164
|
|
|
|
|
|
|
$aam->variable($sn->{'att'}->{'variable'}); |
|
165
|
|
|
|
|
|
|
$aam->symbol($sn->{'att'}->{'symbol'}) if defined $sn->{'att'}->{'symbol'}; |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
push(@aamod_list, $aam); |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
$sm->aminoacid_modification(\@aamod_list); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
} elsif ( $sn->name eq 'parameter' ) { |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $pm = PepXML::Parameter->new(); |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
$pm->name($sn->{'att'}->{'name'}); |
|
176
|
|
|
|
|
|
|
$pm->value($sn->{'att'}->{'value'}); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
push(@param_list, $pm); |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
$sm->parameter(\@param_list); |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
$package->pepxmlfile->search_summary($sm); |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub parse_search_hit { |
|
191
|
|
|
|
|
|
|
my ( $parser, $node ) = @_; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
my $sh = PepXML::SearchHit->new(); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$sh->spectrum($node->parent->parent->{'att'}->{'spectrum'}); |
|
196
|
|
|
|
|
|
|
$sh->start_scan($node->parent->parent->{'att'}->{'start_scan'}); |
|
197
|
|
|
|
|
|
|
$sh->end_scan($node->parent->parent->{'att'}->{'end_scan'}); |
|
198
|
|
|
|
|
|
|
$sh->precursor_neutral_mass($node->parent->parent->{'att'}->{'precursor_neutral_mass'}); |
|
199
|
|
|
|
|
|
|
$sh->assumed_charge($node->parent->parent->{'att'}->{'assumed_charge'}); |
|
200
|
|
|
|
|
|
|
$sh->index($node->parent->parent->{'att'}->{'index'}); |
|
201
|
|
|
|
|
|
|
$sh->retention_time_sec($node->parent->parent->{'att'}->{'retention_time_sec'}); |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
$sh->hit_rank($node->{'att'}->{'hit_rank'}); |
|
204
|
|
|
|
|
|
|
$sh->peptide($node->{'att'}->{'peptide'}); |
|
205
|
|
|
|
|
|
|
$sh->peptide_prev_aa($node->{'att'}->{'peptide_prev_aa'}); |
|
206
|
|
|
|
|
|
|
$sh->peptide_next_aa($node->{'att'}->{'peptide_next_aa'}); |
|
207
|
|
|
|
|
|
|
$sh->protein($node->{'att'}->{'protein'}); |
|
208
|
|
|
|
|
|
|
$sh->num_tot_proteins($node->{'att'}->{'num_tot_proteins'}); |
|
209
|
|
|
|
|
|
|
$sh->num_matched_ions($node->{'att'}->{'num_matched_ions'}); |
|
210
|
|
|
|
|
|
|
$sh->tot_num_ions($node->{'att'}->{'tot_num_ions'}); |
|
211
|
|
|
|
|
|
|
$sh->calc_neutral_pep_mass($node->{'att'}->{'calc_neutral_pep_mass'}); |
|
212
|
|
|
|
|
|
|
$sh->massdiff($node->{'att'}->{'massdiff'}); |
|
213
|
|
|
|
|
|
|
$sh->num_tol_term($node->{'att'}->{'num_tol_term'}); |
|
214
|
|
|
|
|
|
|
$sh->num_missed_cleavages($node->{'att'}->{'num_missed_cleavages'}); |
|
215
|
|
|
|
|
|
|
$sh->num_matched_peptides($node->{'att'}->{'num_matched_peptides'}); |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my @subnodes = $node->children; |
|
218
|
|
|
|
|
|
|
my %score; |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
{ |
|
221
|
|
|
|
|
|
|
no warnings; |
|
222
|
|
|
|
|
|
|
%score = ( |
|
223
|
|
|
|
|
|
|
$subnodes[0]->{'att'}->{'name'} => $subnodes[0]->{'att'}->{'value'}, |
|
224
|
|
|
|
|
|
|
$subnodes[1]->{'att'}->{'name'} => $subnodes[1]->{'att'}->{'value'}, |
|
225
|
|
|
|
|
|
|
$subnodes[2]->{'att'}->{'name'} => $subnodes[2]->{'att'}->{'value'}, |
|
226
|
|
|
|
|
|
|
$subnodes[3]->{'att'}->{'name'} => $subnodes[3]->{'att'}->{'value'}, |
|
227
|
|
|
|
|
|
|
$subnodes[4]->{'att'}->{'name'} => $subnodes[4]->{'att'}->{'value'}, |
|
228
|
|
|
|
|
|
|
$subnodes[5]->{'att'}->{'name'} => $subnodes[5]->{'att'}->{'value'}, |
|
229
|
|
|
|
|
|
|
#$subnodes[6]->{'att'}->{'name'} => $subnodes[6]->{'att'}->{'value'}, |
|
230
|
|
|
|
|
|
|
#$subnodes[7]->{'att'}->{'name'} => $subnodes[7]->{'att'}->{'value'}, |
|
231
|
|
|
|
|
|
|
#$subnodes[8]->{'att'}->{'name'} => $subnodes[8]->{'att'}->{'value'}, |
|
232
|
|
|
|
|
|
|
#$subnodes[9]->{'att'}->{'name'} => $subnodes[9]->{'att'}->{'value'}, |
|
233
|
|
|
|
|
|
|
); |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
$sh->search_score(\%score); |
|
237
|
|
|
|
|
|
|
push(@search_hit_list, $sh); |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
1; |