Bio-MUST-Apps-FortyTwo
view release on metacpan or search on metacpan
lib/Bio/MUST/Apps/SlaveAligner/Local.pm view on Meta::CPAN
package Bio::MUST::Apps::SlaveAligner::Local;
# ABSTRACT: Internal class for slave-aligner
$Bio::MUST::Apps::SlaveAligner::Local::VERSION = '0.213470';
use Moose;
use namespace::autoclean;
use autodie;
use feature qw(say switch);
use experimental qw(smartmatch); # to suppress warnings about 'when'
use Smart::Comments -ENV;
use List::AllUtils qw(max);
use Sort::Naturally;
use Bio::MUST::Core;
use aliased 'Bio::MUST::Core::Seq';
# _delayed_indels is a hash (site) of hashes (new_seq id)
# storing the number of insertions caused by each new_seq at each
# pos (as if each new_seq was added on its own to the Ali)
has 'ali' => (
is => 'ro',
isa => 'Bio::MUST::Core::Ali',
required => 1,
);
has '_delayed_indels' => (
traits => ['Hash'],
is => 'ro',
isa => 'HashRef[HashRef[Num]]',
init_arg => undef,
default => sub { {} },
handles => {
all_sites => 'keys',
indels_at => 'get',
},
);
sub align { ## no critic (RequireArgUnpacking)
my $self = shift;
my %args = @_;
my (
$query, # new_seq as aligned in BLAST report
$sbjct, # template as aligned in BLAST report
$tmplt, # template as aligned in Ali
$splcd,
$start # pairwise alignment start in template
) = @args{ qw(new_seq subject template cds_seq start) };
# determine mode (prot/nucl) based on absence/presence of a DNA seq
# setup multiplier according to mode
my $mul = defined $splcd ? 3 : 1;
# align query left-end on template
for (my $u = 0; $u < $start; $u++) {
$start++ if $tmplt->is_gap($u);
}
my $aligned_seq = q{ } x ( ($start-1) * $mul );
( run in 2.659 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )