line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Front-end class for tabular HMMER domain parser |
2
|
|
|
|
|
|
|
# CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com> |
3
|
|
|
|
|
|
|
$Bio::FastParsers::Hmmer::DomTable::VERSION = '0.221230'; |
4
|
|
|
|
|
|
|
use Moose; |
5
|
7
|
|
|
7
|
|
49
|
use namespace::autoclean; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
52
|
|
6
|
7
|
|
|
7
|
|
41848
|
|
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
75
|
|
7
|
|
|
|
|
|
|
use autodie; |
8
|
7
|
|
|
7
|
|
652
|
|
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
57
|
|
9
|
|
|
|
|
|
|
use List::AllUtils qw(mesh); |
10
|
7
|
|
|
7
|
|
33626
|
|
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
544
|
|
11
|
|
|
|
|
|
|
extends 'Bio::FastParsers::Base'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Bio::FastParsers::Constants qw(:files); |
14
|
7
|
|
|
7
|
|
56
|
use aliased 'Bio::FastParsers::Hmmer::DomTable::Hit'; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
935
|
|
15
|
7
|
|
|
7
|
|
52
|
|
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
44
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# public attributes (inherited) |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# private attributes |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has '_line_iterator' => ( |
23
|
|
|
|
|
|
|
traits => ['Code'], |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
isa => 'CodeRef', |
26
|
|
|
|
|
|
|
init_arg => undef, |
27
|
|
|
|
|
|
|
lazy => 1, |
28
|
|
|
|
|
|
|
builder => '_build_line_iterator', |
29
|
|
|
|
|
|
|
handles => { |
30
|
|
|
|
|
|
|
_next_line => 'execute', |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
## no critic (ProhibitUnusedPrivateSubroutines) |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
2
|
|
3
|
open my $fh, '<', $self->file; # autodie |
39
|
|
|
|
|
|
|
return sub { <$fh> }; # return closure |
40
|
2
|
|
|
|
|
67
|
} |
41
|
2
|
|
|
49
|
|
2125
|
|
|
49
|
|
|
|
|
326
|
|
42
|
|
|
|
|
|
|
## use critic |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my @attrs = qw( |
45
|
|
|
|
|
|
|
target_name target_accession tlen |
46
|
|
|
|
|
|
|
query_name query_accession qlen |
47
|
|
|
|
|
|
|
evalue score bias rank of |
48
|
|
|
|
|
|
|
c_evalue i_evalue dom_score dom_bias |
49
|
|
|
|
|
|
|
hmm_from hmm_to ali_from ali_to env_from env_to |
50
|
|
|
|
|
|
|
acc target_description |
51
|
|
|
|
|
|
|
); # DID try to use MOP to get Hit attrs but order was not preserved |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
LINE: |
57
|
43
|
|
|
43
|
1
|
74
|
while (my $line = $self->_next_line) { |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# skip header/comments and empty lines |
60
|
43
|
|
|
|
|
1464
|
chomp $line; |
61
|
|
|
|
|
|
|
next LINE if $line =~ $COMMENT_LINE |
62
|
|
|
|
|
|
|
|| $line =~ $EMPTY_LINE; |
63
|
47
|
|
|
|
|
84
|
|
64
|
47
|
100
|
66
|
|
|
505
|
# process Hit line |
65
|
|
|
|
|
|
|
my @fields = split(/\s+/xms, $line, 23); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Fields |
68
|
41
|
|
|
|
|
405
|
# 0. target name |
69
|
|
|
|
|
|
|
# 1. target accession |
70
|
|
|
|
|
|
|
# 2. tlen |
71
|
|
|
|
|
|
|
# 3. query name |
72
|
|
|
|
|
|
|
# 4. accession |
73
|
|
|
|
|
|
|
# 5. qlen |
74
|
|
|
|
|
|
|
# 6. E-value |
75
|
|
|
|
|
|
|
# 7. score |
76
|
|
|
|
|
|
|
# 8. bias |
77
|
|
|
|
|
|
|
# 9. rank |
78
|
|
|
|
|
|
|
# 10. of |
79
|
|
|
|
|
|
|
# 11. c-Evalue |
80
|
|
|
|
|
|
|
# 12. i-Evalue |
81
|
|
|
|
|
|
|
# 13. dom_score |
82
|
|
|
|
|
|
|
# 14. dom_bias |
83
|
|
|
|
|
|
|
# 15. from (hmm coord) |
84
|
|
|
|
|
|
|
# 16. to (hmm coord) |
85
|
|
|
|
|
|
|
# 17. from (ali coord) |
86
|
|
|
|
|
|
|
# 18. to (ali coord) |
87
|
|
|
|
|
|
|
# 19. from (env coord) |
88
|
|
|
|
|
|
|
# 20. to (env coord) |
89
|
|
|
|
|
|
|
# 21. acc |
90
|
|
|
|
|
|
|
# 22. description of target |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# coerce numeric fields to numbers |
93
|
|
|
|
|
|
|
@fields[5..21] = map { 0 + $_ } @fields[5..21]; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# set missing field values to undef |
96
|
41
|
|
|
|
|
109
|
@fields[1,4,22] = map { $_ eq '-' ? undef : $_ } @fields[1,4,22]; |
|
697
|
|
|
|
|
1230
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# return Hit object |
99
|
41
|
100
|
|
|
|
94
|
return Hit->new( { mesh @attrs, @fields } ); |
|
123
|
|
|
|
|
245
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
41
|
|
|
|
|
1929
|
return; # no more line to read |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
8
|
|
106
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=pod |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 NAME |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Bio::FastParsers::Hmmer::DomTable - Front-end class for tabular HMMER domain parser |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 VERSION |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
version 0.221230 |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SYNOPSIS |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
use aliased 'Bio::FastParsers::Hmmer::DomTable'; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# open and parse HMMER domain report in tabular format |
125
|
|
|
|
|
|
|
my $infile = 'test/hmmer.domtblout'; |
126
|
|
|
|
|
|
|
my $report = DomTable->new( file => $infile ); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# loop through hits |
129
|
|
|
|
|
|
|
while (my $hit = $hit->next_hit) { |
130
|
|
|
|
|
|
|
my ($target_name, $evalue) = ($hit->target_name, $hit->evalue); |
131
|
|
|
|
|
|
|
# ... |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DESCRIPTION |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# TODO |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 file |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Path to HMMER domain report file in tabular format (--domtblout) to be parsed |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 METHODS |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 next_hit |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Shifts the first Hit of the report off and returns it, shortening the report |
149
|
|
|
|
|
|
|
by 1 and moving everything down. If there are no more Hits in the report, |
150
|
|
|
|
|
|
|
returns C<undef>. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# $report is a Bio::FastParsers::Hmmer::Table |
153
|
|
|
|
|
|
|
while (my $hit = $report->next_hit) { |
154
|
|
|
|
|
|
|
# process $hit |
155
|
|
|
|
|
|
|
# ... |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This method does not accept any arguments. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 AUTHOR |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Denis BAURAIN <denis.baurain@uliege.be> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 CONTRIBUTOR |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=for stopwords Arnaud DI FRANCO |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Arnaud DI FRANCO <arnaud.difranco@gmail.com> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
175
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |