line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::SearchIO::hmmer |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Kai Blin |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Kai Blin |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::SearchIO::hmmer - A parser for HMMER2 and HMMER3 output (hmmscan, hmmsearch, hmmpfam) |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# do not use this class directly it is available through Bio::SearchIO |
21
|
|
|
|
|
|
|
use Bio::SearchIO; |
22
|
|
|
|
|
|
|
my $in = Bio::SearchIO->new(-format => 'hmmer', |
23
|
|
|
|
|
|
|
-file => 't/data/L77119.hmmer'); |
24
|
|
|
|
|
|
|
while( my $result = $in->next_result ) { |
25
|
|
|
|
|
|
|
# this is a Bio::Search::Result::HMMERResult object |
26
|
|
|
|
|
|
|
print $result->query_name(), " for HMM ", $result->hmm_name(), "\n"; |
27
|
|
|
|
|
|
|
while( my $hit = $result->next_hit ) { |
28
|
|
|
|
|
|
|
print $hit->name(), "\n"; |
29
|
|
|
|
|
|
|
while( my $hsp = $hit->next_hsp ) { |
30
|
|
|
|
|
|
|
print "length is ", $hsp->length(), "\n"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This object implements a parser for HMMER output. It works with both HMMER2 and HMMER3 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 FEEDBACK |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 Mailing Lists |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
44
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
45
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
48
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 Support |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
I |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
57
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
58
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
59
|
|
|
|
|
|
|
with code and data examples if at all possible. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 Reporting Bugs |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
64
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via the |
65
|
|
|
|
|
|
|
web: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR - Kai Blin |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Email kai.blin-at-biotech.uni-tuebingen.de |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 APPENDIX |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
76
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Let the code begin... |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package Bio::SearchIO::hmmer; |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
1
|
|
4
|
use Bio::Factory::ObjectFactory; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
1
|
|
4
|
use base qw(Bio::SearchIO); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
329
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub new { |
91
|
29
|
|
|
29
|
1
|
88
|
my ( $caller, @args ) = @_; |
92
|
29
|
|
33
|
|
|
110
|
my $class = ref($caller) || $caller; |
93
|
|
|
|
|
|
|
|
94
|
29
|
|
|
|
|
109
|
my $self = $class->SUPER::new(@args); |
95
|
29
|
|
|
|
|
72
|
$self->_initialize(@args); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Try to guess the hmmer format version if it's not specified. |
98
|
29
|
|
|
|
|
46
|
my $version; |
99
|
29
|
|
|
|
|
90
|
my %param = @args; |
100
|
|
|
|
|
|
|
|
101
|
29
|
|
|
|
|
84
|
@param{ map { lc $_ } keys %param } = values %param; # lowercase keys |
|
72
|
|
|
|
|
172
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# If the caller specified a version, go for that |
104
|
29
|
100
|
|
|
|
99
|
if (defined($param{"-version"})) { |
105
|
5
|
|
|
|
|
12
|
$version = $param{"-version"}; |
106
|
|
|
|
|
|
|
} else { |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# read second line of the file |
109
|
24
|
|
|
|
|
79
|
my $first_line = $self->_readline; |
110
|
24
|
|
|
|
|
55
|
$_ = $self->_readline; |
111
|
|
|
|
|
|
|
|
112
|
24
|
100
|
|
|
|
117
|
if ( m/HMMER\s3/ ) { |
113
|
11
|
|
|
|
|
27
|
$version = "3"; |
114
|
|
|
|
|
|
|
} else { |
115
|
13
|
|
|
|
|
24
|
$version = "2"; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
24
|
|
|
|
|
88
|
$self->_pushback($_); |
119
|
24
|
|
|
|
|
49
|
$self->_pushback($first_line); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
29
|
|
|
|
|
72
|
my $format = "hmmer$version"; |
123
|
29
|
50
|
|
|
|
162
|
return unless( $class->_load_format_module($format) ); |
124
|
|
|
|
|
|
|
|
125
|
29
|
|
|
|
|
112
|
bless($self, "Bio::SearchIO::$format"); |
126
|
|
|
|
|
|
|
|
127
|
29
|
|
|
|
|
226
|
return $self; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub _initialize { |
131
|
58
|
|
|
58
|
|
139
|
my ( $self, @args ) = @_; |
132
|
58
|
|
|
|
|
173
|
$self->SUPER::_initialize(@args); |
133
|
58
|
|
|
|
|
123
|
my $handler = $self->_eventHandler; |
134
|
58
|
|
|
|
|
166
|
$handler->register_factory( |
135
|
|
|
|
|
|
|
'result', |
136
|
|
|
|
|
|
|
Bio::Factory::ObjectFactory->new( |
137
|
|
|
|
|
|
|
-type => 'Bio::Search::Result::HMMERResult', |
138
|
|
|
|
|
|
|
-interface => 'Bio::Search::Result::ResultI' |
139
|
|
|
|
|
|
|
) |
140
|
|
|
|
|
|
|
); |
141
|
|
|
|
|
|
|
|
142
|
58
|
|
|
|
|
189
|
$handler->register_factory( |
143
|
|
|
|
|
|
|
'hit', |
144
|
|
|
|
|
|
|
Bio::Factory::ObjectFactory->new( |
145
|
|
|
|
|
|
|
-type => 'Bio::Search::Hit::HMMERHit', |
146
|
|
|
|
|
|
|
-interface => 'Bio::Search::Hit::HitI' |
147
|
|
|
|
|
|
|
) |
148
|
|
|
|
|
|
|
); |
149
|
|
|
|
|
|
|
|
150
|
58
|
|
|
|
|
172
|
$handler->register_factory( |
151
|
|
|
|
|
|
|
'hsp', |
152
|
|
|
|
|
|
|
Bio::Factory::ObjectFactory->new( |
153
|
|
|
|
|
|
|
-type => 'Bio::Search::HSP::HMMERHSP', |
154
|
|
|
|
|
|
|
-interface => 'Bio::Search::HSP::HSPI' |
155
|
|
|
|
|
|
|
) |
156
|
|
|
|
|
|
|
); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
1; |