| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # ABSTRACT: Internal class for standard HMMER parser | 
| 2 |  |  |  |  |  |  | # CONTRIBUTOR: Arnaud DI FRANCO <arnaud.difranco@gmail.com> | 
| 3 |  |  |  |  |  |  | $Bio::FastParsers::Hmmer::Standard::Target::VERSION = '0.221230'; | 
| 4 |  |  |  |  |  |  | use Moose; | 
| 5 | 7 |  |  | 7 |  | 3998 | use namespace::autoclean; | 
|  | 7 |  |  |  |  | 14 |  | 
|  | 7 |  |  |  |  | 40 |  | 
| 6 | 7 |  |  | 7 |  | 41088 |  | 
|  | 7 |  |  |  |  | 18 |  | 
|  | 7 |  |  |  |  | 45 |  | 
| 7 |  |  |  |  |  |  | use List::AllUtils qw(indexes); | 
| 8 | 7 |  |  | 7 |  | 553 |  | 
|  | 7 |  |  |  |  | 15 |  | 
|  | 7 |  |  |  |  | 346 |  | 
| 9 |  |  |  |  |  |  | use aliased 'Bio::FastParsers::Hmmer::Standard::Domain'; | 
| 10 | 7 |  |  | 7 |  | 42 |  | 
|  | 7 |  |  |  |  | 49 |  | 
|  | 7 |  |  |  |  | 61 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | # public attributes | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | # TODO: check if this an empty ArrayRef would not make more sense than Maybe | 
| 15 |  |  |  |  |  |  | # We dont want smth else than a Domain in this ArrayRef | 
| 16 |  |  |  |  |  |  | # so it is more a matter of precision than sense | 
| 17 |  |  |  |  |  |  | has 'domains' => ( | 
| 18 |  |  |  |  |  |  | traits   => ['Array'], | 
| 19 |  |  |  |  |  |  | is       => 'ro', | 
| 20 |  |  |  |  |  |  | isa      => 'ArrayRef[Maybe[Bio::FastParsers::Hmmer::Standard::Domain]]', | 
| 21 |  |  |  |  |  |  | required => 1, | 
| 22 |  |  |  |  |  |  | handles  => { | 
| 23 |  |  |  |  |  |  | next_domain  => 'shift', | 
| 24 |  |  |  |  |  |  | get_domain  => 'get', | 
| 25 |  |  |  |  |  |  | all_domains => 'elements', | 
| 26 |  |  |  |  |  |  | count_domains => 'count', | 
| 27 |  |  |  |  |  |  | }, | 
| 28 |  |  |  |  |  |  | ); | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | with 'Bio::FastParsers::Roles::Targetable'; | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | # parse Target block (raw)... | 
| 33 |  |  |  |  |  |  | # ... and retrieve attrs from the corresponding line of hit table (Hit) | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | around BUILDARGS => sub { | 
| 36 |  |  |  |  |  |  | my ($orig, $class, $inargs) = @_; | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | # retrieve lines still to parse as @raw... | 
| 39 |  |  |  |  |  |  | my @raw = @{ $inargs->{raw} }; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | # recycle the anonymous HashRef already containing old Hit information | 
| 42 |  |  |  |  |  |  | # as the foundation for the new Target object | 
| 43 |  |  |  |  |  |  | my %outargs = %{ $inargs->{hit} }; | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | # add Target name | 
| 46 |  |  |  |  |  |  | ( $outargs{target_name} = $raw[0] ) =~ s/[\>\s+]//xmsg; | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | # split Domain blocks | 
| 49 |  |  |  |  |  |  | my @domain_indexes = indexes { m/^\s+==/xms } @raw; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | # set as empty ArrayRef as --domE option can report Target without domain | 
| 52 |  |  |  |  |  |  | $outargs{domains} = []; | 
| 53 |  |  |  |  |  |  | if (@domain_indexes) { | 
| 54 |  |  |  |  |  |  | my @summary = grep { | 
| 55 |  |  |  |  |  |  | $_ =~ m/^\s+\d/xms | 
| 56 |  |  |  |  |  |  | } @raw[ 1 .. $domain_indexes[0]-1 ]; | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | for (my $i = 0; $i < @domain_indexes; $i++) { | 
| 59 |  |  |  |  |  |  | my @block = defined $domain_indexes[$i+1] | 
| 60 |  |  |  |  |  |  | ? @raw[ $domain_indexes[$i] .. $domain_indexes[$i+1] ] | 
| 61 |  |  |  |  |  |  | : splice @raw, $domain_indexes[$i] | 
| 62 |  |  |  |  |  |  | ; | 
| 63 |  |  |  |  |  |  | push @{ $outargs{domains} }, | 
| 64 |  |  |  |  |  |  | Domain->new( { raw => \@block, summary => $summary[$i] } ); | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | # return expected constructor hash | 
| 69 |  |  |  |  |  |  | return $class->$orig(%outargs); | 
| 70 |  |  |  |  |  |  | }; | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 73 |  |  |  |  |  |  | 1; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =pod | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =head1 NAME | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | Bio::FastParsers::Hmmer::Standard::Target - Internal class for standard HMMER parser | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head1 VERSION | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | version 0.221230 | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | # TODO | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | # TODO | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head1 AUTHOR | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | Denis BAURAIN <denis.baurain@uliege.be> | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =head1 CONTRIBUTOR | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =for stopwords Arnaud DI FRANCO | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | Arnaud DI FRANCO <arnaud.difranco@gmail.com> | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 109 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =cut |