#!/usr/bin/perl

#
# formatting GL3 output (*.pred) to GL2 output 
# 

my $USAGE="gl3_2_gl2 GL3-file > output\n";
if(@ARGV!=1){print stderr $USAGE; exit -1}
open gl3, $ARGV[0] || die "Cannot open glimmer file ".$ARGV[0]."\n";
<gl3>;  # removing header
my @gl3 =<gl3>;
close gl3;

my $c=0;
print "Putative Genes:\n";
foreach(@gl3){
	$c++;
	my @t=split /\s+/;
 	if($t[3]=~/\+/){
		$stop=$t[2]-3;
	}else{
		$stop=$t[2]+3;
	}
 printf "%5d%9d%9d  [%s]\n", $c, $t[1], $stop, $t[3];
} 
