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