gff文件从gene的pos位点在基因组里面抽取序列

open FASTA,"$ARGV[0]" or die "can not open GFF file,$!";
open GFF,"$ARGV[1]" or die "can not open FASTA file,$!";
 while (<FASTA>)
{
chomp;
if (/>/){$key=$_;$key =~ s/>//g;}
else {$hash{$key}.=$_}
}#把基因序列文件扫描进去hash表
 while (<GFF>)
{
chomp;
@F=split;
next unless $F[2] eq "gene";
$out=substr($hash{$F[0]},$F[3]-1,$F[4]-1);
print ">$F[1]\n$out\n";
}

编程技巧