-
Notifications
You must be signed in to change notification settings - Fork 5
/
augustus_gff_to_gff3.pl
65 lines (40 loc) · 1.16 KB
/
augustus_gff_to_gff3.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib ("$FindBin::Bin/../PerlLib");
use Gene_obj;
my %genes;
my %gene_to_contig;
while (<STDIN>) {
chomp;
unless (/\w/) {next; }
my @x = split (/\t/);
my $contig = $x[0];
my $source = $x[1];
my $feat_type = $x[2];
my $lend = $x[3];
my $rend = $x[4];
my $orient = $x[6];
my $info = $x[8];
my ($end5, $end3) = ($orient eq '+') ? ($lend, $rend) : ($rend, $lend);
if ($feat_type =~ /initial|internal|terminal|single|stop_codon/) {
$info =~ /gene_id \"([^\"]+)/ or die "Error, cannot parse gene_id from $info";
my $gene_id = $1;
$genes{$gene_id}->{$end5} = $end3;
$gene_to_contig{$gene_id} = $contig;
}
}
foreach my $gene_id (keys %genes) {
my $coords_href = $genes{$gene_id};
my $gene_obj = new Gene_obj();
$gene_obj->populate_gene_object($coords_href, $coords_href);
$gene_obj->{asmbl_id} = $gene_to_contig{$gene_id};
$gene_obj->{TU_feat_name} = $gene_id;
$gene_obj->{Model_feat_name} = "Model.$gene_id";
$gene_obj->{com_name} = "predicted gene";
$gene_obj->join_adjacent_exons();
print $gene_obj->to_GFF3_format(source => "AUGUSTUS");
print "\n";
}
exit(0);