Bioinformatics/Global alignment: Difference between revisions

m
→‎{{header|Raku}}: more idiomatic
(added Raku programming solution)
m (→‎{{header|Raku}}: more idiomatic)
Line 523:
loop ( my $offset = 0, my \S1 = $ = '' ; ; $offset++ ) {
S1 = s1.substr: $offset ;
with S1.index(s2.substr(0,1)) -> $p { $offset += $p } else { return 0False }
S1 = s1.substr: $offset ;
return s1.chars - $offset if s2.starts-with: S1
Line 530:
 
sub deduplicate {
my @sorted = @_.unique.sort: { $^a*.chars <=> $^b.chars } ; # by length
gather while ( my $target = shift @sorted ) {
take $target unless @sorted.grep: { .contains: $target }
Line 542:
my \sup = $ = @perm[0];
for @perm.rotor(2 => -1) -> @duo {
my \overlapPos = stringCentipede |@duo[0], @duo[1];
sup ~= @duo[1].substr: overlapPos;
}
2,392

edits