Exemplo n.º 1
0
def enrichment_no_t_task(
    exp,
    block,
    T,
    gs,
    patterns,
    base_filename,
):

    if settings.CELERY_DEBUG:
        import sys
        sys.path.append(
            '/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg'
        )
        import pydevd
        pydevd.settrace('localhost',
                        port=6901,
                        stdoutToServer=True,
                        stderrToServer=True)
    gene_set = gs.get_gs()
    patterns = patterns.get_gs()
    e = EnrichmentInGeneSets(patterns.genes)
    enrich = e.getModuleEnrichmentInGeneSets(patterns.genes,
                                             gene_set.genes,
                                             pval_threshold=T)
    enrich = dict(
        (mod, (genes,
               map(lambda x: (gene_set.description[x[0]], x[0], x[1]), terms)))
        for (mod, (genes, terms)) in enrich.items())
    ds = DictionarySet(exp.get_data_folder(), base_filename)
    ds.store_dict(enrich)
    return [ds], {}
Exemplo n.º 2
0
def enrichment_no_t_task(exp, block,
                     T,
                     gs,
                     cs,
                     base_filename,
    ):

    if settings.CELERY_DEBUG:
        import sys
        sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg')
        import pydevd
        pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
    gene_set = gs.get_gs()
    cs = cs.load_set()
    e = EnrichmentInGeneSets(cs)
    enrich = e.getModuleEnrichmentInGeneSets(cs, gene_set.genes, pval_threshold=T)
    enrich = dict((mod, (genes, map(lambda x: (gene_set.description[x[0]], x[0], x[1]), terms))) for (mod, (genes, terms)) in enrich.items())
    ds = DictionarySet(exp.get_data_folder(), base_filename)
    ds.store_dict(enrich)
    return [ds], {}
Exemplo n.º 3
0
def enrichment_task(exp, block,
                     gs,
                     H2,
                     T,
                     base_filename,
    ):

    if settings.CELERY_DEBUG:
        import sys
        sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg')
        import pydevd
        pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
    gene_set = gs.get_gs()
    h2 = H2.get_assay_data_frame()
    e = EnrichmentInGeneSets(h2)
    ## compute enrichment in GO terms ()
    enrich_bpGO = e.getEnrichmentInGeneSetsWithH(gene_set.genes, h2, T)
    # sort resultst accodring p-values
   # sorted_enrich_bpGO = sorted(enrich_bpGO.iteritems(), key=operator.itemgetter(1))
    er_ratio = e.getEnrichmentRatioInGeneSetsWithH(gene_set.genes, h2, T, enrichment_threshold=0.05, N=10)
    enrich_bpGO['er_ratio'] = er_ratio
    ds = DictionarySet(exp.get_data_folder(), base_filename)
    ds.store_dict(enrich_bpGO)
    return [ds], {}