@transform(mergeGeneLists, regex(r"(\S+).load"), "ortholog_groups_with_feature.load") 
def orthologGroupsWithFeature( infile, outfile):

    tablename = "ortholog_groups_with_feature"
    #nno_base = PARAMS["annotations_dir"]
    species_list = P.asList(PARAMS["species"])
    anno_list = P.asList(PARAMS["annotations_db"])
    #db_name = PARAMS["database"]
    #ensembl_version = PARAMS["orthology_ensembl_version"]
    species_lookup = dict(zip(species_list, anno_list))

    # Connect to database and attach annotation databases
    dbhandle = sqlite3.connect( PARAMS["database"] )
    for species in species_lookup.iterkeys():
        species_db = species_lookup[species]
        #species_db = anno_base + species_genome + "/" + db_name
        cc = dbhandle.cursor()
        statement = '''ATTACH DATABASE '%(species_db)s' as %(species)s''' % locals()
        cc.execute( statement )
        cc.close()

    # Extract data from db
    cc = dbhandle.cursor()
    cc.execute( "DROP TABLE IF EXISTS %(tablename)s" % locals() )
    statement = '''CREATE TABLE %(tablename)s AS 
                   SELECT count(distinct o.schema) as species_count, 
                   group_concat(o.gene_id,",") as gene_ids,
                   group_concat(g.gene_name,",") as gene_names,
                   group_concat(o.schema,",") as species_list, set_id
                   FROM genelists_merged g, ortholog_groups o
                   WHERE  g.gene_id=o.gene_id
                   GROUP BY set_id ''' % locals()
    cc.execute( statement )
    # add index
    #cc.execute( )
    cc.close()

    statement = "touch %s" % outfile
    P.run()
    
###################################################################
###################################################################
###################################################################
## Ortholog pairs
Unlocks a user account.
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_species_conservation.py/orthologGroupsWithFeature--crossover with--dataset/ETHPy150Open saltstack/salt/salt/modules/win_shadow.py/unlock_account