Chinaunix首页 | 论坛 | 博客
  • 博客访问: 79614
  • 博文数量: 36
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-28 10:06
个人简介

安徽屯溪,哈尔滨的雪地,扬州的瘦西湖,想必知道我是谁了吧!!对,小金思密达

文章分类

全部博文(36)

文章存档

2015年(7)

2014年(29)

我的朋友

分类: PERL

2015-04-21 08:16:00

#!/usr/bin/perl -w
use strict;
#use Perl::Tidy;
#use Getopt::Long;
my ($head,%h,$key,$len,@len_arr,$total,$num,$sub_count,$first);
print "input your sequence file name,then press Enter!\n";
$first=;
open IN,"<$first";

while (){
chomp;
if(/^>/){ $head=$_;}else{$h{$head}.=$_}
}
#  read data into hash
foreach $key(keys %h){ chomp$key;
  $len=length($h{$key});
  push @len_arr,$len;
 
}

for (0..$#len_arr){$total+=$len_arr[$_];}

#open OUT,">o";
foreach $num(sort{$b <=> $a}@len_arr){       # like grep map
  $sub_count+=$num;
   if( $sub_count>= ($total*0.5) ){print "Sequence N50 value:$num\n";last;}else{next;}
   #print  OUT "$num\n";
}
exit;
##########like good ,can works  2015-4-20 xiaojin haerbin
  
阅读(3633) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~