| 1 | package Bio::MUST::Apps::OmpaPa::Blast; | ||||||||||||||||||||
| 2 | # ABSTRACT: internal class for XML BLAST parser | ||||||||||||||||||||
| 3 | # CONTRIBUTOR: Amandine BERTRAND <amandine.bertrand@doct.uliege.be> | ||||||||||||||||||||
| 4 | 1 | $Bio::MUST::Apps::OmpaPa::Blast::VERSION = '0.260260'; | |||||||||||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 1 | ▶ | use autodie; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use feature qw(say); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | ▶ | use Smart::Comments; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | extends 'Bio::FastParsers::Blast::Xml'; | |||||||||||||||||||
| 16 | 1 | with 'Bio::MUST::Apps::OmpaPa::Roles::Parsable'; | |||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | ▶ | sub collect_hits { | ||||||||||||||||||
|
Subroutine
collect_hits: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 20 | 0 | my $self = shift; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | my @hits; | |||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | # parse BLAST report | ||||||||||||||||||||
| 25 | 0 | my $iter = $self->blast_output->next_iteration; | |||||||||||||||||||
| 26 | 0 | my $qlen = $iter->query_len; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | HIT: | ||||||||||||||||||||
| 29 | 0 | ▶ | while (my $hit = $iter->next_hit) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | # honor --max-hits limit | ||||||||||||||||||||
| 32 | 0 | ▶ | if (@hits >= $self->max_hits) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | 0 | carp 'Reached --max-hits limit; truncating report!'; | |||||||||||||||||||
| 34 | 0 | last HIT; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | # split hit desc on Ctrl-A and keep only first line (nr database) | ||||||||||||||||||||
| 38 | # this is needed for table formatting as Ctrl-A has zero-width | ||||||||||||||||||||
| 39 | 0 | ▶ | my ($desc) = split /\cA.*/xms, ( $hit->def // $hit->id ); | ||||||||||||||||||
|
Condition0%0/3
$hit->def // $hit->id
MC/DC0%0/2
$hit->def // $hit->id
$hit->def
$hit->id
Truth table0%0/3
A // B
A= $hit->defB= $hit->id
| |||||||||||||||||||||
| 40 | 0 | my $hsp = $hit->next_hsp; # workaround for XML report change | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | # collect useful hit/HSP attributes | ||||||||||||||||||||
| 43 | 0 | ▶ | push @hits, { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 44 | 'acc' => ( $hit->id =~ m/^gnl\|/xms ? $hit->def : $hit->id ), | ||||||||||||||||||||
| 45 | # workaround to accommodate change in BLAST XML report | ||||||||||||||||||||
| 46 | 'dsc' => $desc, | ||||||||||||||||||||
| 47 | 'exp' => $hsp->evalue, | ||||||||||||||||||||
| 48 | 'bit' => $hsp->bit_score, | ||||||||||||||||||||
| 49 | 'qlen' => $qlen, | ||||||||||||||||||||
| 50 | 'len' => $hit->len, | ||||||||||||||||||||
| 51 | 'hmm_from' => $hsp->query_start, # for consistent naming | ||||||||||||||||||||
| 52 | 'hmm_to' => $hsp->query_end, | ||||||||||||||||||||
| 53 | }; | ||||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 0 | return \@hits; | |||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 60 | 1 | 1; | |||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||