lib/Bio/Tools/Hmmpfam.pm

filter: Statementstmt 21.5% 14 / 65 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 4 / 8 Podpod 100% 4 / 4 totaltotal 21.5% 22 / 102 CC 11 SCAR 41.3
CC
11
Cov
16%
next_result
110.0
seqname
6.0
new
2.0
CRAP 62.2
« lib/Bio/SearchIO/hmmer2.pm ↑ Summary lib/Bio/Tools/HMMER/Results.pm »
1 # BioPerl module for Bio::Tools::Hmmpfam
2 #
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
4 #
5 # Cared for by Balamurugan Kumarasamy
6 #
7 # You may distribute this module under the same terms as perl itself
8 # POD documentation - main docs before the code
9 #
10  
11 =head1 NAME
12  
13 Bio::Tools::Hmmpfam - Parser for Hmmpfam program
14  
15 =head1 SYNOPSIS
16  
17 use Bio::Tools::Hmmpfam;
18 my @hmmpfam_feat;
19 my $hmmpfam_parser = Bio::Tools::Hmmpfam->new(-fh =>$filehandle );
20 while( my $hmmpfam_feat = $hmmpfam_parser->next_result ) {
21 push @hmmpfam_feat, $hmmpfam_feat;
22 }
23  
24 =head1 DESCRIPTION
25  
26 Parser for Hmmpfam program. See also L<Bio::SearchIO::hmmer>.
27  
28 =head1 FEEDBACK
29  
30 =head2 Mailing Lists
31  
32 User feedback is an integral part of the evolution of this and other
33 Bioperl modules. Send your comments and suggestions preferably to
34 the Bioperl mailing list. Your participation is much appreciated.
35  
36 bioperl-l@bioperl.org - General discussion
37 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
38  
39 =head2 Support
40  
41 Please direct usage questions or support issues to the mailing list:
42  
43 I<bioperl-l@bioperl.org>
44  
45 rather than to the module maintainer directly. Many experienced and
46 reponsive experts will be able look at the problem and quickly
47 address it. Please include a thorough description of the problem
48 with code and data examples if at all possible.
49  
50 =head2 Reporting Bugs
51  
52 Report bugs to the Bioperl bug tracking system to help us keep track
53 of the bugs and their resolution. Bug reports can be submitted via the
54 web:
55  
56 https://github.com/bioperl/bioperl-live/issues
57  
58 =head1 AUTHOR - Balamurugan Kumarasamy
59  
60 Email: fugui@worf.fugu-sg.org
61  
62 =head1 APPENDIX
63  
64 The rest of the documentation details each of the object methods.
65 Internal methods are usually preceded with a _
66  
67  
68 =cut
69  
70 package Bio::Tools::Hmmpfam;
71 1 $Bio::Tools::Hmmpfam::VERSION = '1.7.3';
72 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74 1 ▶use Bio::SeqFeature::FeaturePair;
Subroutine BEGIN: called CC=1 SCAR=0.0
75 1 ▶use Bio::SeqFeature::Generic;
Subroutine BEGIN: called CC=1 SCAR=0.0
76 1 ▶use base qw(Bio::Root::Root Bio::Root::IO);
Subroutine BEGIN: called CC=1 SCAR=0.0
77  
78  
79  
80 =head2 new
81  
82 Title : new
83 Usage : my $obj = Bio::Tools::Hmmpfam->new(-fh=>$filehandle);
84 Function: Builds a new Bio::Tools::Hmmpfam object
85 Returns : Bio::Tools::Hmmpfam
86 Args : -filename
87 -fh (filehandle)
88  
89 =cut
90  
91 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
92 0 my($class,@args) = @_;
93  
94 0 my $self = $class->SUPER::new(@args);
95 0 $self->_initialize_io(@args);
96  
97 0 return $self;
98 }
99  
100  
101 =head2 next_result
102  
103 Title : next_result
104 Usage : my $feat = $hmmpfam_parser->next_result
105 Function: Get the next result set from parser data
106 Returns : L<Bio::SeqFeature::Generic>
107 Args : none
108  
109 =cut
110  
111 0 ▶sub next_result {
Subroutine next_result: not called CC=10 SCAR=47.0
Pod documented
112 0 my ($self) = @_;
113 0 my $filehandle;
114  
115 my $line;
116  
117 0 my $id;
118 0 ▶ while ($_=$self->_readline()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ = $self->_readline) 0 0 0
119 0 $line = $_;
120 0 chomp $line;
121  
122 0 ▶ if ( $line=~m/^Alignments of top-scoring domains/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^Alignments of top-scoring domains/) 0 0 0
123 0 ▶ while( my $rest = $self->_readline() ) { last if $rest =~ m!^//! }
Branch: 2 branches
BranchTrueFalseTotal
if (my $rest = $self->_readline) 0 0 0
if $rest =~ m[^//] 0 0 0
124 }
125  
126 0 ▶ next if ($line=~m/^Model/ || /^\-/ || /^$/);
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^Model/ or /^\-/ or /^$/ 0 0 0
Condition0%0/6
$line =~ /^Model/ or /^\-/ or /^$/
l!l&&r!l&&!r
000
$line =~ /^Model/ or /^\-/
l!l&&r!l&&!r
000
MC/DC0%0/3
$line =~ /^Model/ or /^\-/ or /^$/
$line =~ /^Model/ /^\-/ /^$/
Truth table0%0/4
A or B or C
A= $line =~ /^Model/B= /^\-/C= /^$/
ABCresult
1XX1
01X1
0011
0000
127  
128 0 ▶ if ($line=~m/^Query sequence:\s+(\S+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^Query sequence:\s+(\S+)/) 0 0 0
129 0 $id = $1;
130 0 $self->seqname($id);
131 }
132  
133 0 ▶ if (my ($hid, $start, $end, $hstart, $hend, $score, $evalue) = $line=~m/^(\S+)\s+\S+\s+(\d+)\s+(\d+)\s+\S+\s+(\d+)\s+(\d+)\s+\S+\s+(\S+)\s+(\S+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $line =~ /^(\S+)\s+\S+\s+(\d+)\s+(\d+)\s+\S+\s+(\d+)\s+(\d+)\s+\S+\s+(\S+)\s+(\S+)/) 0 0 0
134 0 my %feature;
135  
136 0 ($feature{name}) = $self->seqname;
137 0 $feature{raw_score} = $score;
138 0 $feature{p_value} = sprintf ("%.3e", $evalue);
139 0 $feature{score} = $feature{p_value};
140 0 $feature{start} = $start;
141 0 $feature{end} = $end;
142 0 $feature{hname} = $hid;
143 0 $feature{hstart} = $hstart;
144 0 $feature{hend} = $hend;
145 0 ($feature{source}) = 'pfam';
146 0 $feature{primary} = $hid;
147 0 ($feature{program}) = 'pfam';
148 0 ($feature{db}) = 'db1';
149 0 ($feature{logic_name}) = 'hmmpfam';
150 0 my $new_feat = $self->create_feature (\%feature);
151 0 return $new_feat
152  
153 }
154 0 next;
155  
156 }
157 0 return;
158 }
159  
160 =head2 create_feature
161  
162 Title : create_feature
163 Usage : my $feat=$hmmpfam_parser->create_feature($feature,$seqname)
164 Function: creates a SeqFeature Generic object
165 Returns : L<Bio::SeqFeature::Generic>
166 Args :
167  
168  
169 =cut
170  
171 0 ▶sub create_feature {
Subroutine create_feature: not called CC=1 SCAR=6.9
Pod documented
172 0 my ($self, $feat) = @_;
173  
174  
175  
176 my $feature1= Bio::SeqFeature::Generic->new( -seq_id =>$feat->{name},
177 -start =>$feat->{start},
178 -end =>$feat->{end},
179 -score =>$feat->{score},
180 -source =>$feat->{source},
181 -primary =>$feat->{primary},
182 0 );
183  
184  
185  
186 my $feature2= Bio::SeqFeature::Generic->new(
187 -start =>$feat->{hstart},
188 -end =>$feat->{hend},
189 0 );
190  
191  
192  
193  
194 0 my $featurepair = Bio::SeqFeature::FeaturePair->new;
195 0 $featurepair->feature1 ($feature1);
196 0 $featurepair->feature2 ($feature2);
197  
198 0 $featurepair->add_tag_value('evalue',$feat->{p_value});
199 0 $featurepair->add_tag_value('percent_id','NULL');
200 0 $featurepair->add_tag_value("hid",$feat->{primary});
201 0 return $featurepair;
202  
203 }
204  
205 =head2 seqname
206  
207 Title : seqname
208 Usage : obj->seqname($seqname)
209 Function: Internal(not to be used directly)
210 Returns :
211 Args : seqname
212  
213 =cut
214  
215 0 ▶sub seqname{
Subroutine seqname: not called CC=2 SCAR=17.9
Pod documented
216 0 my($self,$seqname)=@_;
217  
218 0 ▶ if(defined($seqname))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $seqname) 0 0 0
219 {
220 0 $self->{'seqname'}=$seqname;
221 }
222  
223 0 return $self->{'seqname'};
224  
225 }
226  
227 1 1;
« lib/Bio/SearchIO/hmmer2.pm ↑ Summary lib/Bio/Tools/HMMER/Results.pm »