##################################
#                                #
# Last modified 10/04/2014       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import string
import math
from sets import Set
import os
import subprocess

def run():

    if len(sys.argv) < 2:
        print 'usage: python %s input output [-stdout]'
        sys.exit(1)

    input = sys.argv[1]
    outfilename = sys.argv[2]

    GeneDict = {}

    currentChr = ''
    lineslist  = open(input)
    for line in lineslist:
        if line.startswith('Protein Translations:'):
            break
        if line.startswith('DEFINITION'):
            currentChr = line.strip().split('DEFINITION  &gt;')[1]
            if GeneDict.has_keu(currentChr):
                print 'duplicate chromosome defintion detected, exiting'
                sys.exit(1)
            GeneDict[currentChr] = []
            continue
        if line.strip().startswith('CDS  '):
            gene = line.strip().split(' ')[-1]
            print gene
            GeneDict[currentChr].append(gene)

    chromosomes = GeneDict.keys()
    chromosomes.sort()

    for chr in chromosomes:
        for gene in GeneDict[chr]
            outline = chr + '\tProdigal\tCDS\t'

run()