| 1 | package Bio::FastParsers::Blast::Xml; | ||||||||||
| 2 | # ABSTRACT: Front-end class for XML BLAST parser | ||||||||||
| 3 | # CONTRIBUTOR: Aymeric NAOME <aymeric.naome@gmail.com> | ||||||||||
| 4 | 7 | $Bio::FastParsers::Blast::Xml::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 Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 7 | ▶ | use XML::Bare; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 7 | extends 'Bio::FastParsers::Base'; | |||||||||
| 12 | |||||||||||
| 13 | 7 | ▶ | use aliased 'Bio::FastParsers::Blast::Xml::BlastOutput'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | # TODO: check behavior with single iterations, hits or hsps | ||||||||||
| 16 | |||||||||||
| 17 | # public attributes (some inherited) | ||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | 7 | has 'blast_output' => ( | |||||||||
| 22 | is => 'ro', | ||||||||||
| 23 | isa => 'Maybe[Bio::FastParsers::Blast::Xml::BlastOutput]', | ||||||||||
| 24 | init_arg => undef, | ||||||||||
| 25 | lazy => 1, | ||||||||||
| 26 | builder => '_build_blast_output', | ||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | ## no critic (ProhibitUnusedPrivateSubroutines) | ||||||||||
| 30 | |||||||||||
| 31 | 7 | ▶ | sub _build_blast_output { | ||||||||
|
Subroutine
_build_blast_output: called CC=3 SCAR=11.0
| |||||||||||
| 32 | 7 | my $self = shift; | |||||||||
| 33 | |||||||||||
| 34 | 7 | my $file = $self->file; | |||||||||
| 35 | 7 | ▶ | my $xb = XML::Bare->new( file => $file ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | or croak "Can't open '$file' for reading: $!"; | ||||||||||
| 37 | |||||||||||
| 38 | 7 | my $bo = $xb->parse->{'BlastOutput'}; | |||||||||
| 39 | 7 | ▶ | unless ($bo) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 1 | carp "Warning: '$file' unexpectedly empty; returning no BlastOutput!"; | |||||||||
| 41 | 1 | return; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 6 | return BlastOutput->new( _root => $bo, _parent => undef); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | ## use critic | ||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | 7 | __PACKAGE__->meta->make_immutable; | |||||||||
| 51 | 7 | 1; | |||||||||
| 52 | |||||||||||
| 53 | __END__ | ||||||||||