def read_terminators_data(ec_dir=
    '/home/users/assafp/Database/EcoCyc/current/data', tfile='terminators.dat'
    ):
    """
    Read the promoters dat file and return a dictionary
    tu-> (term left, term right)
    position
    Arguments:
    - `ec_dir`: The EcoCyc data directory
    - `tfile`: The terminators data file name
    """
    left_pos = None
    right_pos = None
    tuname = None
    tu_promoters = {}
    with open('%s/%s' % (ec_dir, tfile)) as tin:
        for line in tin:
            if line.startswith('#'):
                continue
            if line.startswith('LEFT-END-POSITION'):
                left_pos = int(line.strip().split()[-1]) - 1
            if line.startswith('RIGHT-END-POSITION'):
                right_pos = int(line.strip().split()[-1]) - 1
            if line.startswith('COMPONENT-OF'):
                tutemp = line.strip().split()[-1]
                if tutemp.startswith('TU'):
                    tuname = tutemp
            if line.startswith('//'):
                if tuname and left_pos and right_pos:
                    tu_promoters[tuname] = left_pos, right_pos
                left_pos = None
                right_pos = None
                tuname = None
    return tu_promoters
