统计染色体数目,并把染色体每100bp划分一个bin

2021-11-10  本文已影响0人  余绕
open FA, "$ARGV[0]";

$/=">";

while(<FA>){
        chomp;
        next,if(/^$/);
        my($chr,$seq)=split /\n/,$_,2;
        $seq=~s/\n//g;
        $leng=length $seq;
        $hash{$chr}=$leng;
        print "$chr\t$leng\n";
}


foreach(sort keys %hash){

$times=int($hash{$_}/100);
        $n=0;
        for($i=0;$i<=$times;$i+=1){
        @tmp=();
        push @tmp,$n;
        $n+=100;
        push @tmp,$n;
        print "$_\t$tmp[0]\t$tmp[1]\n"
        }
$end=100*$times;
        print "$_\t$end\t$hash{$_}\n";
}

运行结果


image.png
上一篇下一篇

猜你喜欢

热点阅读