Ejemplo n.º 1
0
#Minimum reads for PCM: 100
crit_min=nsmd.crit_min_reads(fpcm,reg,gene=None,minreads=100)

#Normalized reads in pcm bigger than in wt.
crit_frac = nsmd.crit_frac_compare(fwt,fpcm,reg)

#Gene in expressed in pcm with alpha=1
crit_exp = nsmd.crit_expressed(fpcm,reg)

#Preliminary candidates satisfying the 3 criteria.
candidates = [g for g in nsmd.gene_loc if g in crit_min and g in crit_frac and g in crit_exp]

#Test for center of mass is more expensive. Run it only for candidates.
crit_cmass = nsmd.crit_cmass(fwt,fpcm,reg,gene=None,only=candidates,alpha=0.1)

#Save results
f = open(nsmd.full_path("candidates1.txt","results"),"w")

for g in crit_cmass:
    f.write(g+"\n")
f.close()

#Save plots:
fignames = [g+".jpg" for g in crit_cmass]
nfignames = ["norm_"+n for n in fignames]

nsmd.plot_pileup(fwt,fpcm,reg,gene=crit_cmass,show=False,filename=fignames)

nsmd.plot_pileup(fwt,fpcm,reg,gene=crit_cmass,show=False,filename=nfignames,norm=True)
Ejemplo n.º 2
0
import os

os.chdir("..")

import nsmd

pre = "2L/"

list_cand = [pre+"candidates"+str(i)+".txt" for i in range(1,7)]

fout = pre+"candidates_ranking.txt"

c = {}

for fcand in list_cand:
	f = open(nsmd.full_path(fcand,"results"),"r")
	candidates = f.read().splitlines()
	f.close()

	for cc in candidates:
		if cc not in c:
			c[cc] = 1
		else:
			c[cc]+= 1

#Sort by value.
sc = sorted(c,key=c.get)
sc.reverse()

#Save resutls:
f = open(nsmd.full_path(fout,"results"),"w")