@transform( pairsStats, suffix( ".stats"), ".hypergeom" )
def testGeneListOverlapSignificance( infile, outfile ):
    dbhandle = sqlite3.connect( PARAMS["database"] )
    cc = dbhandle.cursor()
    statement = '''SELECT species_pair, conserved_genes,
                   conserved_nmis, conserved_genes_with_nmi_species1, conserved_genes_with_nmi_species2
                   FROM pairwise_ortholog_stats''' % locals()
    cc.execute( statement )
    
    # Calculate probability of overlap and write to file
    statement = '''printf "species_pair\\tconserved_genes\\tconserved_nmis\\tconserved_genes_with_nmi_species1\\tconserved_genes_with_nmi_species2\\tp-value\\n" > %(outfile)s;''' 
    P.run()
    for result in cc:
        species_pair, conserved_genes, conserved_nmis, conserved_genes_with_nmi_species1, conserved_genes_with_nmi_species2 = result
        statement = '''printf "%(species_pair)s\\t%(conserved_genes)s\\t%(conserved_nmis)s\\t%(conserved_genes_with_nmi_species1)s\\t%(conserved_genes_with_nmi_species2)s\\t" >> %(outfile)s; 
                       python %(scriptsdir)s/list_overlap.py %(conserved_nmis)i %(conserved_genes)i %(conserved_genes_with_nmi_species1)i %(conserved_genes_with_nmi_species2)i >> %(outfile)s;''' 
        P.run()
    #statement = '''sed -i '{N;s/\\n/\\t/g}' %(outfile)s; '''
    #P.run()
    cc.close()

############################################################
get all the items for a task
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_species_conservation.py/testGeneListOverlapSignificance--crossover with--dataset/ETHPy150Open anchor/make-magic/core/store.py/MongoStore.items