def get_neuronal_enrichment(df): clusters = df['kmeans_cluster_name'].unique() dfl = [] for cl in clusters: dfc = df[df['kmeans_cluster_name'] == cl].copy() dfe = ai.get_enrichment(dfc.index.tolist(), 'neuronal_gene_set_library') dfe2 = dfe[dfe['Adjusted P-value'] < 0.2].copy() dfe2['cluster_name'] = [cl] * len(dfe2) dfl.append(dfe2) dfn = pd.concat(dfl) dfp = dfn.pivot(index='Term', columns='cluster_name', values='Adjusted P-value') return dfp
def get_cmap_sig(gene_list): genes = [x for x in gene_list if x is not None] library = 'LINCS_L1000_Chem_Pert_down' dfe = ai.get_enrichment(genes, library) dfe = dfe[dfe['Adjusted P-value'] < 0.2] return dfe
def get_delta_enrichment(df, cond='mev_delta', delta_thresh=2): df2 = df[df[cond] > delta_thresh].copy() genes = df2.index.tolist() dfe = ai.get_enrichment(genes, 'neuronal_gene_set_library') return dfe