Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Raku script to find palindrome in genomes !

  • Public
By BioStar 418 days ago
sub is-palindrome(Str $str) returns Bool { $str.=uc; # convert to uppercase $str.=subst:g/\s+//; # remove any spaces return $str eq $str.flip; } sub find-palindromes(Str $dna, Int $min-length, Int $max-length) { for $min-length..$max-length -> $length { for 0..^$dna.chars - $length -> $pos { my $substring = $dna.substr($pos, $length); if is-palindrome($substring) { say "Palindrome found at position $pos: $substring"; } } } } # Example usage my $dna = "GGATCCATGGCCTAGG"; # example DNA sequence find-palindromes($dna, 3, 8); # find palindromes with length between 3 and 8