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

filter: Statementstmt 75.0% 15 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 70.3% 19 / 27 CC 3 SCAR 18.7
CC
3
Cov
68%
matches
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« lib/Bio/MUST/Core/SeqMask/Rates.pm ↑ Summary lib/Bio/MUST/Core/SeqMask/Profiles.pm »
1 package Bio::MUST::Core::Taxonomy::Category;
2 # ABSTRACT: Helper class for multiple-criterion classifier based on taxonomy
3 18 $Bio::MUST::Core::Taxonomy::Category::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 Bio::MUST::Core::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 18 has 'label' => (
11 is => 'ro',
12 isa => 'Str',
13 required => 1,
14 );
15  
16  
17 18 has 'description' => (
18 is => 'ro',
19 isa => 'Str',
20 default => 'no description',
21 );
22  
23  
24 18 has 'criteria' => (
25 traits => ['Array'],
26 is => 'ro',
27 isa => 'ArrayRef[Bio::MUST::Core::Taxonomy::Criterion]',
28 required => 1,
29 handles => {
30 all_criteria => 'elements',
31 },
32 );
33  
34  
35  
36 0 ▶sub matches {
Subroutine matches: not called CC=3 SCAR=24.8
Pod documented
37 0 my $self = shift;
38 0 my $listable = shift;
39
40 # loop through criteria and fail on the first one not matching input
41 # this means that the multiple criteria are linked by logical ANDs
42 0 for my $criterion ($self->all_criteria) {
43 0 ▶ return 0 unless $criterion->matches($listable);
Branch: 1 branch
BranchTrueFalseTotal
unless $criterion->matches($listable) 0 0 0
44 }
45  
46 # return success
47 0 return 1;
48 }
49  
50 18 __PACKAGE__->meta->make_immutable;
51 18 1;
52  
53 __END__
« lib/Bio/MUST/Core/SeqMask/Rates.pm ↑ Summary lib/Bio/MUST/Core/SeqMask/Profiles.pm »