sub find-microsatellites($sequence, $min-repeat-length = 2, $max-repeat-length = 6, $min-repeat-count = 3) {
my @microsatellites;
for my $repeat-length ($min-repeat-length..$max-repeat-length) {
for ^($sequence.chars - $repeat-length * $min-repeat-count + 1) -> $i {
my $substring = $sequence.substr($i, $repeat-length);
if $sequence.contains($substring x $min-repeat-count) {
@microsatellites.push($substring);
}
}
}
return @microsatellites.unique;
}
# Example usage
my $genome-sequence = "ATCGATCGATCGATCGATCG";
my @result = find-microsatellites($genome-sequence);
say "Microsatellites found: ", @result;