<?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 SSRs in fastq file !]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/44430/raku-script-to-find-ssrs-in-fastq-file?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/44430/raku-script-to-find-ssrs-in-fastq-file?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44430/raku-script-to-find-ssrs-in-fastq-file</guid>
	<pubDate>Sun, 14 Jan 2024 12:05:24 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44430/raku-script-to-find-ssrs-in-fastq-file</link>
	<title><![CDATA[Raku script to find SSRs in fastq file !]]></title>
	<description><![CDATA[<code>sub find-ssrs(Str $sequence) {
    my @ssrs;

    for 2..$sequence.chars -&gt; $min-repeats {
        for $sequence.chars...$min-repeats -&gt; $max-repeat {
            my $repeat = $sequence.substr($min-repeats - 1, $max-repeat - $min-repeats + 1);
            my $repeat-length = $max-repeat - $min-repeats + 1;

            if $sequence.substr($max-repeat).index($repeat) == 0 {
                push @ssrs, {
                    start   =&gt; $min-repeats,
                    end     =&gt; $max-repeat,
                    length  =&gt; $repeat-length,
                    sequence =&gt; $repeat
                };
            }
        }
    }

    return @ssrs;
}

sub process-fastq-file(Str $filename) {
    my $fh = open $filename, :r;

    my $line-number = 0;
    while $fh.readline -&gt; $header {
        $line-number++;
        my $sequence = $fh.readline.chomp;

        # Skipping the next two lines (comment and quality lines)
        $fh.readline;
        $fh.readline;

        my @ssrs = find-ssrs($sequence);

        if @ssrs {
            say &quot;SSRs found in sequence at line $line-number:&quot;;
            for @ssrs -&gt; $ssr {
                say &quot;  Start: $ssr&lt;start&gt;, End: $ssr&lt;end&gt;, Length: $ssr&lt;length&gt;, Sequence: $ssr&lt;sequence&gt;&quot;;
            }
        }
    }

    $fh.close;
}

# Replace &#039;your_fastq_file.fastq&#039; with the path to your FASTQ file
process-fastq-file(&#039;your_fastq_file.fastq&#039;);</code>]]></description>
	<dc:creator>LEGE</dc:creator>
</item>

</channel>
</rss>