lib/Bio/MUST/Core/Taxonomy/Filter.pm

filter: Statementstmt 65.1% 28 / 43 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 100% 2 / 2 totaltotal 58.4% 38 / 65 CC 6 SCAR 20.2
CC
6
Cov
55%
is_allowed
20.0
tax_list
12.0
__ANON__
2.0
CRAP 7.5
« lib/Bio/MUST/Core/Taxonomy/ColorScheme.pm ↑ Summary lib/Bio/MUST/Core/SeqMask/Rates.pm »
1 package Bio::MUST::Core::Taxonomy::Filter;
2 # ABSTRACT: Helper class for filtering seqs according to taxonomy
3 18 $Bio::MUST::Core::Taxonomy::Filter::VERSION = '0.252040';
4 18 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 18 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 18 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 18 ▶use feature qw(say);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 18 ▶use Smart::Comments '###';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 18 ▶use List::AllUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 18 ▶use Bio::MUST::Core::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 18 ▶use aliased 'Bio::MUST::Core::IdList';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 18 with 'Bio::MUST::Core::Roles::Filterable',
17 'Bio::MUST::Core::Roles::Taxable';
18  
19  
20  
21 0 ▶sub is_allowed {
Subroutine is_allowed: not called CC=4 SCAR=30.0
Pod documented
22 0 my $self = shift;
23 0 my $seq_id = shift;
24  
25 # test whether lineage of seq_id has at least one wanted taxon
26 # ... or has at least one unwanted taxon
27 # non-matching taxa are allowed by default
28  
29 0 my @lineage = $self->tax->fetch_lineage($seq_id);
30 0 ▶ return undef unless @lineage; ## no critic (ProhibitExplicitReturnUndef)
Branch: 1 branch
BranchTrueFalseTotal
unless @lineage 0 0 0
31  
32 0 ▶ return 0 unless List::AllUtils::any { $self->is_wanted( $_) } @lineage;
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless &List::AllUtils::any(sub { $self->is_wanted($_); } , @lineage) 0 0 0
33 0 ▶ return 0 if List::AllUtils::any { $self->is_unwanted($_) } @lineage;
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &List::AllUtils::any(sub { $self->is_unwanted($_); } , @lineage) 0 0 0
34 0 return 1;
35 }
36  
37  
38 0 ▶sub tax_list {
Subroutine tax_list: not called CC=3 SCAR=24.8
Pod documented
39 0 my $self = shift;
40 0 my $listable = shift;
41  
42 0 my @ids;
43 0 for my $seq_id ($listable->all_seq_ids) {
44 0 ▶ push @ids, $seq_id->full_id if $self->is_allowed($seq_id);
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_allowed($seq_id) 0 0 0
45 }
46  
47 0 return IdList->new( ids => \@ids );
48 }
49  
50 18 __PACKAGE__->meta->make_immutable;
51 18 1;
52  
53 __END__
« lib/Bio/MUST/Core/Taxonomy/ColorScheme.pm ↑ Summary lib/Bio/MUST/Core/SeqMask/Rates.pm »