#initiate S for the whole genome #chrboundst = chr start index #chrbound = chr end index my $k=0; my @S=undef; #open OUT, "> temp.0"; my %chrboundst; my %index; # correct? my @fix; my @score; my %chrbound; foreach my $chr (keys %chrsize) { $chrboundst{$chr}=$k; for (my $i=0; $i<=$chrsize{$chr}; $i++) { $index{$k}="$chr\t$i"; $fix[$k]=1 if ($breakpoint{$chr}{$i}==1); # line 132 $score[$k]=$piRNA{$chr}{$i}-$penalty; $S[$k]=$S[$k-1]+$score[$k] if ($i>0); $S[$k]=$score[$k] if ($i==0); $S[$k]=0 if ($S[$k]<0 || $fix[$k]==1); # line 136 $k++; } $chrbound{$chr}=$k-1; # mark the chr end for recalculation }