def read_genes_data(
    ec_dir='/home/users/assafp/Database/EcoCyc/current/data',
    gfile = 'genes.dat', sRNAs_types=('BC-2.2','BC-2.2.7'),
    other_RNAs_types=('BC-2.2.5', 'BC-2.2.6', 'BC-3.1.3.6'),
    exclude_set=('EG10438',),
    rRNA_prod=['RRNA']):
    """
    Read the genes.dat from the ec directory 
    Arguments:
    - `ec_dir`: The EcoCyc data directory
    - `gfile`: The genes data file name
    - `sRNAs_type`: return a list of genes with this TYPES identifier
    - `other_RNAs_type`: treat these genes as RNA genes (for UTRs)
    - `exclude_set`: Exclude these genes from the sRNAs list (hfq)
    Return:
    - `uid_pos`: A dictionary UID->genomic position (from, to, strand) 0-based
                 The right position is exclusive as python coords
    - `uid_names`: A dict UID->{category->name}
    - `uid_tudata`: A dict UID->[IGTs]
    - `sRNAs list`: A list of sRNAs,
    - `other_RNAs_list`: a list of tRNAs, rRNAs etc
    - `rRNA_prod`: Name of rRNA product to return a list of rRNAs
    """
    uid_pos = {}
    uid_names = {}
    sRNAs_list = []
    other_RNAs_list = []
    rRNAs = []
    uid_tudata = {}
    with open("%s/%s"%(ec_dir, gfile)) as ecin:
        ingene = None
        has_types = False
        has_other_types = False
        accs = {}
        coords = [0,0,'']
        tu_data = []
        chrom_name = None
        for line in ecin:
            if line.startswith('#'):
                continue
            if line.startswith('UNIQUE-ID'):
                ingene = line.strip().split()[-1]
            if line.startswith('TYPES'):
                has_types |= line.strip().split()[-1] in sRNAs_types
                has_other_types |= line.strip().split()[-1] in other_RNAs_types 
            if line.startswith('COMMON-NAME') or line.startswith('ACCESSION'):
                spl = line.strip().split()
                accs[spl[0]] = spl[2]
            if line.startswith('LEFT-END-POSITION'):
                coords[0] = int(line.strip().split()[-1]) - 1
            if line.startswith('RIGHT-END-POSITION'):
                coords[1] = int(line.strip().split()[-1])
            if line.startswith('TRANSCRIPTION-DIRECTION'):
                coords[2] = line.strip().split()[-1]
            if line.startswith('COMPONENT-OF'):
                tuname = line.strip().split()[-1]
                if tuname.startswith('TU'):
                    tu_data.append(tuname.replace('TU', 'IGT'))
                else:
                    chrom_name = tuname.rsplit('-',1)[0]
            if line.startswith('PRODUCT'):
                if line.strip().split()[-1].split('-')[-1] in rRNA_prod:
                    rRNAs.append(ingene)
            if line.startswith('//'):
                if coords[2] != '' and coords[1]>coords[0]:
                    uid_pos[ingene] = [chrom_name] + coords
                    uid_names[ingene] = accs
                    uid_tudata[ingene] = set(tu_data)
                    if has_types and (ingene not in exclude_set): #exclude hfq
                        sRNAs_list.append(ingene)
                    if has_other_types and (ingene not in exclude_set):
                        other_RNAs_list.append(ingene)
                ingene = None
                has_types = False
                has_other_types = False
                accs = {}
                coords = [0,0,'']
                tu_data = []
                chrom_name = None
                
    return  uid_pos, uid_names, uid_tudata, sRNAs_list, other_RNAs_list, rRNAs