| 1 | package Bio::MUST::Core::SeqId::Filter; | ||||||||||
| 2 | # ABSTRACT: Helper class for filtering seqs according to SeqId components | ||||||||||
| 3 | 18 | $Bio::MUST::Core::SeqId::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 Bio::MUST::Core::Types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 18 | with 'Bio::MUST::Core::Roles::Filterable'; | |||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | 18 | has 'component' => ( | |||||||||
| 17 | is => 'ro', | ||||||||||
| 18 | isa => 'Str', | ||||||||||
| 19 | required => 1, | ||||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | 303600 | ▶ | sub is_allowed { | ||||||||
|
Subroutine
is_allowed: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||
| 25 | 303600 | my $self = shift; | |||||||||
| 26 | 303600 | my $seq_id = shift; | |||||||||
| 27 | |||||||||||
| 28 | # fetch the right SeqId component (e.g., family) | ||||||||||
| 29 | # Note: the trick here is to take a reference then dereference it at once | ||||||||||
| 30 | 303600 | my $component = $seq_id->${\ $self->component }; | |||||||||
| 31 | 303600 | ▶ | return undef unless $component; ## no critic (ProhibitExplicitReturnUndef) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | |||||||||||
| 33 | 303600 | ▶ | return 0 unless $self->is_wanted( $component); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 151800 | ▶ | return 0 if $self->is_unwanted($component); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 151800 | return 1; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 18 | __PACKAGE__->meta->make_immutable; | |||||||||
| 39 | 18 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||