| 1 | package Bio::FastParsers::Hmmer::Model; | ||
| 2 | # ABSTRACT: Internal class for HMMER parser | ||
| 3 | # CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com> | ||
| 4 | 7 | $Bio::FastParsers::Hmmer::Model::VERSION = '0.221230'; | |
| 5 | 7 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 7 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 7 | ▶ | use autodie; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 7 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 7 | ▶ | use Path::Class; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 7 | ▶ | use Smart::Comments; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 7 | ▶ | use List::AllUtils qw(firstidx); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | 7 | extends 'Bio::FastParsers::Base'; | |
| 17 | |||
| 18 | 7 | ▶ | use Bio::FastParsers::Types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | |||
| 20 | |||
| 21 | has $_ => ( | ||
| 22 | is => 'ro', | ||
| 23 | isa => 'Num', | ||
| 24 | required => 1, | ||
| 25 | 7 | ) for qw(cksum effn nseq leng); | |
| 26 | |||
| 27 | 7 | has maxl => ( | |
| 28 | is => 'ro', | ||
| 29 | isa => 'Num', | ||
| 30 | ); | ||
| 31 | |||
| 32 | has $_ => ( | ||
| 33 | is => 'ro', | ||
| 34 | isa => 'Maybe[Str]', | ||
| 35 | required => 1, | ||
| 36 | 7 | ) for qw(alph cons cs map mm name rf); | |
| 37 | |||
| 38 | |||
| 39 | 2 | ▶ | around BUILDARGS => sub { |
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||
| 40 | 2 | my %args = @_; | |
| 41 | |||
| 42 | # parse file and automatically create args | ||
| 43 | 2 | my $profile_file = file( $args{'file'} ); | |
| 44 | 2 | my @profile_content = $profile_file->slurp( chomp => 1 ); | |
| 45 | |||
| 46 | 35 | ▶ | my $hmmstart_index = firstidx { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 47 | 35 | substr($_, 0, 4) eq q{HMM } | |
| 48 | 2 | } @profile_content; | |
| 49 | |||
| 50 | 2 | for my $idx ( 1..$hmmstart_index-1 ) { | |
| 51 | 31 | my ($key, $value) = split /\s+/xms, $profile_content[$idx]; | |
| 52 | 31 | $args{ lc $key } = $value; | |
| 53 | } | ||
| 54 | |||
| 55 | 2 | return \%args; | |
| 56 | 7 | }; | |
| 57 | |||
| 58 | 7 | __PACKAGE__->meta->make_immutable; | |
| 59 | 7 | 1; | |
| 60 | |||
| 61 | __END__ | ||