利用perl从大量数据中提取急需的有用信息
利用perl从大量数据中提取需要的有用信息
open (YEAST,"f:\\perl\\yeast_set2.S288C.stampy.pe.recal.variants.filter.vcf")||die("can not open the file!"); while(<YEAST>) { if($_=~/^##/) { } elsif($_=~/^#/) { @category= split/\s/,$_; open(COUNTBASE,">>f:\\perl\\a.csv")||die("can not open the file!"); print COUNTBASE " @category[0] @category[1] @category[3] @category[4] @category[5] \n" } else { @information=split/\s/,$_; $number=8; until($number>22) { $number++; if(@information[$number]=~/^0\/0/) { open(COUNTBASE,">>f:\\perl\\a.csv")||die("can not open the file!"); printf COUNTBASE "@category[$number] @information[0] @information[1] @information[3] @information[4] @information[5] S\n" ; } elsif(@information[9]=~/^0\/1/) { open(COUNTBASE,">>f:\\perl\\a.csv")||die("can not open the file!"); printf COUNTBASE "@category[$number] @information[0] @information[1] @information[3] @information[4] @information[5] H\n"; } elsif(@information[9]=~/^1\/1/) { open(COUNTBASE,">>f:\\perl\\a.csv")||die("can not open the file!"); printf COUNTBASE "@category[$number] @information[0] @information[1] @information[3] @information[4] @information[5] Y\n"; } } } }