##################################
#                                #
# Last modified 02/16/2011       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import string
import math
from sets import Set

def run():

    if len(sys.argv) < 2:
        print 'usage: python %s gtf outfile' % sys.argv[0]
        sys.exit(1)
    
    gtf=sys.argv[1]
    outfile = open(sys.argv[2], 'w')

    DataDict={}
    linelist = open(gtf)
    for line in linelist:
        fields=line.strip().split('\t')
        chr=fields[0]
        left=fields[3]
        right=fields[4]
        strand=fields[6]
        annotation=fields[1]
        type=fields[2]
        score=fields[5]
        dot=fields[7]
        attributes=fields[8]
        if float(score) > 1000:
            score = "1000.00"
        outline=chr +'\t'+ annotation +'\t'+ type +'\t'+ left +'\t'+ right +'\t'+ score +'\t'+ strand +'\t'+ dot +'\t'+ attributes
        outfile.write(outline+'\n')

    outfile.close()

run()