Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1 from jbayer/master
Multifile pdf
  • Loading branch information
jbayer committed Aug 4, 2015
2 parents aba514d + ad01d68 commit 5bf0bf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/enrichAnalysis.py
Expand Up @@ -60,13 +60,12 @@ def main(mti_d = {}, rank_l = [], perm_num = 1000, p = 1, s_path = '', h_path =

mir_l = mti_d.keys()
mir_l.sort(key=ns.natural_keys)
es_plot_pages = PdfPages(e_path)
es_q = Queue()
proc_l = []

# calculate ES + Leading Edge and NES #
for mir in mir_l:
es_ms = ms.Process(target=get_es, args=(mir,mti_d[mir], rank_l, perm_gene_l,p, n, perm_num, es_plot_pages, es_q))
es_ms = ms.Process(target=get_es, args=(mir,mti_d[mir], rank_l, perm_gene_l,p, n, perm_num, es_q))
proc_l.append(es_ms)
es_ms.start()

Expand Down Expand Up @@ -102,8 +101,9 @@ def main(mti_d = {}, rank_l = [], perm_num = 1000, p = 1, s_path = '', h_path =
# Extend MTI-set-genes file #
es_genes(mir, e[8], e[10], e[2], e[3], le_gene_file)
# ES plot with all main running ESs #
es_plot_pages = PdfPages(e_path+"-"+mir+".pdf")
es_plot(mir, e[8], e[2], e[3]+1, e[9], e[10], e[11], es_plot_pages)
es_plot_pages.close()
es_plot_pages.close()
le_gene_file.close()

# calculate FDR q-value#
Expand All @@ -121,7 +121,7 @@ def main(mti_d = {}, rank_l = [], perm_num = 1000, p = 1, s_path = '', h_path =
# create output #
get_output(new_mti_d, max_es_d, max_es_ind_d, nes_d, FDR_mean_d, FDR_median_d, lead_edge_d, out_str, s_path)

def get_es(s, mti_l, rank_l, gene_l, p, n, perm_num, es_plot_pages, es_q):
def get_es(s, mti_l, rank_l, gene_l, p, n, perm_num, es_q):


n = float(n) # number of genes in ranked list
Expand Down Expand Up @@ -214,7 +214,7 @@ def get_nes(max_es, nh, rank_l, gene_l, perm_num, p, n):
for _ in range(0,perm_num):
tmp_mti_l = random.sample(gene_l,nh) # randomly fill sets with same number of targets
# new mti_dict done #
tmp_es = get_es('x', tmp_mti_l, rank_l, gene_l, p, n,False,False, None)
tmp_es = get_es('x', tmp_mti_l, rank_l, gene_l, p, n,False, None)
perm_es_l.append(tmp_es)
if tmp_es >= 0:
perm_pos_es_l.append(tmp_es)
Expand Down
2 changes: 1 addition & 1 deletion src/gsea.py
Expand Up @@ -29,4 +29,4 @@
except IOError as e:
print("Unable to open file "+sys.argv[2]+". File might not exist or missing read permissions.")

enrichAnalysis.main(mti_d = genesets, rank_l = ranks, s_path = sys.argv[3]+'-genesets_ranked.txt', h_path = sys.argv[3]+'-geneset_overlap.pdf', e_path = sys.argv[3]+'-genesets.pdf', le_path = sys.argv[3]+'-geneset_genes.txt')
enrichAnalysis.main(mti_d = genesets, rank_l = ranks, s_path = sys.argv[3]+'-genesets_ranked.txt', h_path = sys.argv[3]+'-geneset_overlap.pdf', e_path = sys.argv[3], le_path = sys.argv[3]+'-geneset_genes.txt')

0 comments on commit 5bf0bf3

Please sign in to comment.