Bio::DB::Universal: move into its own distribution
[bioperl-live.git] / Bio / Tools / Tmhmm.pm
blobe1b89337afd502640416351f07190acded096ee8
2 # BioPerl module for Bio::Tools::Tmhmm
4 # Original copyright Balamurugan Kumarasamy
5 # Re-written cleanly by Torsten Seemann, Sep 2006
7 # Copyright:
8 # You may distribute this module under the same terms as Perl itself
10 =head1 NAME
12 Bio::Tools::Tmhmm - parse TMHMM output (TransMembrane HMM)
14 =head1 SYNOPSIS
16 use Bio::Tools::Tmhmm;
17 my $parser = Bio::Tools::Tmhmm->new(-fh => $filehandle );
18 while ( my $tmhmm_feat = $parser->next_result ) {
19 # do something, e.g.
20 push @tmhmm_feat, $tmhmm_feat;
23 =head1 DESCRIPTION
25 TMHMM is software for the prediction of transmembrane helices in proteins.
26 See L<http://www.cbs.dtu.dk/services/TMHMM/> for more details.
28 This module parses the "long output" format of TMHMM 2.0 and
29 creates a Bio:SeqFeature::Generic object for each C<TMHelix> feature found
30 from lines like this:
32 my_sequence_id TMHMM2.0 TMhelix 54 76
35 =head1 FEEDBACK
37 =head2 Mailing Lists
39 User feedback is an integral part of the evolution of this and other
40 Bioperl modules. Send your comments and suggestions preferably to
41 the Bioperl mailing list. Your participation is much appreciated.
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46 =head2 Support
48 Please direct usage questions or support issues to the mailing list:
50 I<bioperl-l@bioperl.org>
52 rather than to the module maintainer directly. Many experienced and
53 reponsive experts will be able look at the problem and quickly
54 address it. Please include a thorough description of the problem
55 with code and data examples if at all possible.
57 =head2 Reporting Bugs
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 of the bugs and their resolution. Bug reports can be submitted via the
61 web:
63 https://github.com/bioperl/bioperl-live/issues
65 =head1 AUTHOR - Torsten Seemann
67 Email torsten.seemann AT infotech.monash.edu.au
69 =head1 CONTRIBUTOR - Bala
71 Email savikalpa@fugu-sg.org
73 =head1 APPENDIX
75 The rest of the documentation details each of the object methods.
76 Internal methods are usually preceded with a _
78 =cut
80 package Bio::Tools::Tmhmm;
82 use strict;
84 use Bio::Tools::AnalysisResult;
85 use Bio::Root::Root;
86 use Bio::Root::IO;
88 use base qw(Bio::Root::Root Bio::Root::IO Bio::Tools::AnalysisResult);
90 use Bio::SeqFeature::Generic;
93 =head2 new
95 Title : new
96 Usage : my $obj = Bio::Tools::Tmhmm->new();
97 Function: Builds a new Bio::Tools::Tmhmm object
98 Returns : Bio::Tools::Tmhmm
99 Args : Either of the following as per L<Bio::Root::IO> interface
100 -fh => $filehandle
101 -file => $filename
103 =cut
105 sub new {
106 my($class,@args) = @_;
107 my $self = $class->SUPER::new(@args);
108 $self->_initialize_io(@args);
109 return $self;
113 =head2 next_result
115 Title : next_result
116 Usage : my $feat = $Tmhmm->next_result
117 Function: Get the next result set from parser data
118 Returns : Bio::SeqFeature::Generic
119 Args : none
121 =cut
123 sub next_result {
124 my $self = shift;
126 # # my_sequence_id Length: 178
127 # my_sequence_id TMHMM2.0 outside 1 53
128 # my_sequence_id TMHMM2.0 TMhelix 54 76
129 # my_sequence_id TMHMM2.0 inside 77 115
131 while (my $line = $self->_readline) {
132 if ( $line =~ m/^(\S+)\s+(\S+)\s+(TMhelix)\s+(\d+)\s+(\d+)$/i ) {
133 return Bio::SeqFeature::Generic->new(
134 -primary => 'transmembrane',
135 -seq_id => $1,
136 -source => $2,
137 -start => $4,
138 -end => $5,