#!/usr/bin/perl
#The perl script is writen by Jingtao Qu
use warnings;
use strict;
open IN,"Zea_mays.AGPv4.38.gff3";
open OUT,">start_code_site.txt";
my %hash = ();
while (<IN>) {
next if /^#/;
my @a = split/\s+/;
next unless $a[2] =~ /CDS/;
$a[8] =~ /ID=CDS:([^;]*)/;
push @{$hash{$1}},[$a[0],$a[3],$a[4],$a[6]];
}
close IN;
foreach (keys %hash) {
if (${$hash{$_}}[0]->[3] =~ /\+/) {
print OUT "$_\t${${$hash{$_}}[0]}[0]\t${${$hash{$_}}[0]}[1]\t".(${${$hash{$_}}[0]}[1]+2)."\n";
}else{
print OUT "$_\t${${$hash{$_}}[-1]}[0]\t".(${${$hash{$_}}[-1]}[2]-2)."\t${${$hash{$_}}[-1]}[2]\n";
}
}
close OUT;
网友评论