<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Raku script to find palindrome in genomes !]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/44222/raku-script-to-find-palindrome-in-genomes?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/44222/raku-script-to-find-palindrome-in-genomes?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44222/raku-script-to-find-palindrome-in-genomes</guid>
	<pubDate>Tue, 07 Mar 2023 14:15:17 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44222/raku-script-to-find-palindrome-in-genomes</link>
	<title><![CDATA[Raku script to find palindrome in genomes !]]></title>
	<description><![CDATA[<code>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 -&gt; $length {
        for 0..^$dna.chars - $length -&gt; $pos {
            my $substring = $dna.substr($pos, $length);
            if is-palindrome($substring) {
                say &quot;Palindrome found at position $pos: $substring&quot;;
            }
        }
    }
}

# Example usage
my $dna = &quot;GGATCCATGGCCTAGG&quot;; # example DNA sequence
find-palindromes($dna, 3, 8); # find palindromes with length between 3 and 8</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>

</channel>
</rss>