This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problem with printing continuous minimum and maximum polypurine stretches using sliding window

Hi All, I need to extract polypurine stretches with max. 1 pyrimidine residues. my perl code:

for(my $i=0; $i <=$len; $i++) {

for(my $j=0; $j <=length($data[$i]) - $window; $j += $step){
my $nucltde = substr($data[$i], $j, $window);
   while($nucltde =~ /G/g)
{
$countG++
}
#print $nucltde,"\n";
my $Gper=($countG/$window)*100;
#print "$countG\t$Gper\n";
if($Gper >= 50){
    while($nucltde =~ /[AG]/g)
    {
    $countAG++
    }
    while($nucltde =~ /[CT]/g)
    {
    $countCT++
    }
    my $AGper=($countAG/$window)*100;
    if(($countAG >=15) && ($AGper >= 46) && ($countCT <=1)){

After counting residues and I applied if condition. I could able to print 30nts stretches only. I am not able to print min. of 15nt stretches and maximum of continuous stretches of any length. For that I tried with join and push command. It prints all or joining the same seq. Could you please guide me to solve this problem.

sequence perl

0 answers

No answers yet.

Log in to answer this question.