2 # BioPerl module for Bio::SearchIO::hmmer
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Kai Blin <kai.blin@biotech.uni-tuebingen.de>
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::SearchIO::hmmer - A parser for HMMER2 and HMMER3 output (hmmscan, hmmsearch, hmmpfam)
20 # do not use this class directly it is available through 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";
37 This object implements a parser for HMMER output. It works with both HMMER2 and HMMER3
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.
47 bioperl-l@bioperl.org - General discussion
48 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
52 Please direct usage questions or support issues to the mailing list:
54 I<bioperl-l@bioperl.org>
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.
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
67 https://github.com/bioperl/bioperl-live/issues
69 =head1 AUTHOR - Kai Blin
71 Email kai.blin-at-biotech.uni-tuebingen.de
75 The rest of the documentation details each of the object methods.
76 Internal methods are usually preceded with a _
80 # Let the code begin...
82 package Bio
::SearchIO
::hmmer
;
86 use Bio
::Factory
::ObjectFactory
;
88 use base
qw(Bio::SearchIO);
91 my ( $caller, @args ) = @_;
92 my $class = ref($caller) || $caller;
94 my $self = $class->SUPER::new
(@args);
95 $self->_initialize(@args);
97 # Try to guess the hmmer format version if it's not specified.
101 @param{ map { lc $_ } keys %param } = values %param; # lowercase keys
103 # If the caller specified a version, go for that
104 if (defined($param{"-version"})) {
105 $version = $param{"-version"};
108 # read second line of the file
109 my $first_line = $self->_readline;
110 $_ = $self->_readline;
118 $self->_pushback($_);
119 $self->_pushback($first_line);
122 my $format = "hmmer$version";
123 return unless( $class->_load_format_module($format) );
125 bless($self, "Bio::SearchIO::$format");
131 my ( $self, @args ) = @_;
132 $self->SUPER::_initialize
(@args);
133 my $handler = $self->_eventHandler;
134 $handler->register_factory(
136 Bio
::Factory
::ObjectFactory
->new(
137 -type
=> 'Bio::Search::Result::HMMERResult',
138 -interface
=> 'Bio::Search::Result::ResultI'
142 $handler->register_factory(
144 Bio
::Factory
::ObjectFactory
->new(
145 -type
=> 'Bio::Search::Hit::HMMERHit',
146 -interface
=> 'Bio::Search::Hit::HitI'
150 $handler->register_factory(
152 Bio
::Factory
::ObjectFactory
->new(
153 -type
=> 'Bio::Search::HSP::HMMERHSP',
154 -interface
=> 'Bio::Search::HSP::HSPI'