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
#Plot CG7294 for all the samples.

list_pcm = ["pcm"+str(i)+"_chr2L.bam" for i in range(1,7)]
list_wt = ["wt"+str(i)+"_chr2L.bam" for i in range(1,7)]
list_out = ["CG7294_"+str(i)+".jpg" for i in range(1,7)]
list_nout = ["CG7294_"+str(i)+"_norm.jpg" for i in range(1,7)]

reg = "2L"
g = "CG7294"

import os

os.chdir("..")

import nsmd

for fpcm,fwt,fout,fnout in zip(list_pcm,list_wt,list_out,list_nout):
	nsmd.plot_pileup(fwt,fpcm,reg,g,False,fout)
	nsmd.plot_pileup(fwt,fpcm,reg,g,False,fnout,True)