File Coverage

blib/lib/Bio/FastParsers/Hmmer/Model.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             # ABSTRACT: Internal class for HMMER parser
2             # CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com>
3             $Bio::FastParsers::Hmmer::Model::VERSION = '0.221230';
4             use Moose;
5 7     7   49 use namespace::autoclean;
  7         17  
  7         50  
6 7     7   40955  
  7         17  
  7         53  
7             use autodie;
8 7     7   559  
  7         17  
  7         61  
9             use Carp;
10 7     7   33217 use Path::Class;
  7         23  
  7         506  
11 7     7   43  
  7         14  
  7         383  
12             use Smart::Comments;
13 7     7   4061 use List::AllUtils qw(firstidx);
  7         120747  
  7         43  
14 7     7   9384  
  7         16  
  7         455  
15             extends 'Bio::FastParsers::Base';
16              
17             use Bio::FastParsers::Types;
18 7     7   45  
  7         16  
  7         1853  
19              
20             has $_ => (
21             is => 'ro',
22             isa => 'Num',
23             required => 1,
24             ) for qw(cksum effn nseq leng);
25              
26             has maxl => (
27             is => 'ro',
28             isa => 'Num',
29             );
30              
31             has $_ => (
32             is => 'ro',
33             isa => 'Maybe[Str]',
34             required => 1,
35             ) for qw(alph cons cs map mm name rf);
36              
37              
38             around BUILDARGS => sub {
39             my %args = @_;
40              
41             # parse file and automatically create args
42             my $profile_file = file( $args{'file'} );
43             my @profile_content = $profile_file->slurp( chomp => 1 );
44              
45             my $hmmstart_index = firstidx {
46             substr($_, 0, 4) eq q{HMM }
47             } @profile_content;
48              
49             for my $idx ( 1..$hmmstart_index-1 ) {
50             my ($key, $value) = split /\s+/xms, $profile_content[$idx];
51             $args{ lc $key } = $value;
52             }
53              
54             return \%args;
55             };
56              
57             __PACKAGE__->meta->make_immutable;
58             1;
59              
60              
61             =pod
62              
63             =head1 NAME
64              
65             Bio::FastParsers::Hmmer::Model - Internal class for HMMER parser
66              
67             =head1 VERSION
68              
69             version 0.221230
70              
71             =head1 SYNOPSIS
72              
73             # TODO
74              
75             =head1 DESCRIPTION
76              
77             # TODO
78              
79             =head1 AUTHOR
80              
81             Denis BAURAIN <denis.baurain@uliege.be>
82              
83             =head1 CONTRIBUTOR
84              
85             =for stopwords Arnaud DI FRANCO
86              
87             Arnaud DI FRANCO <arnaud.difranco@gmail.com>
88              
89             =head1 COPYRIGHT AND LICENSE
90              
91             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
92              
93             This is free software; you can redistribute it and/or modify it under
94             the same terms as the Perl 5 programming language system itself.
95              
96             =cut