analyzeAngle.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:livespin 作者: biocompibens 项目源码 文件源码
def histplot(self, extradataA = [], extradataG = [], intensity = []):
        pylab.figure(figsize = (25,8))
        cat = ['NT, 500ng/mL DOX', 'DLG siRNA, 500ng/mL DOX', 'NuMA siRNA, 500ng/mL DOX', 'NT, 1ug/mL DOX']
        pops = []
        for i in xrange(3):
            pylab.subplot(1,3,i+1)
            pop = self.angles[(self.categories == i)]# &  (self.GFP > -np.log(12.5))]# & (intensity == 'r')]
            print "cat {0}, pop {1}, pop + GFP {2}".format(i, len(self.angles[self.categories == i]), len(pop))
            pops.append(pop)
            hist, binedges = np.histogram(pop, bins = 18)
            pylab.tick_params(axis='both', which='major', labelsize=25)
            pylab.plot(binedges[:-1], np.cumsum(hist)/1./len(pop), data.colors[i], label = data.cat[i], linewidth = 4)
            if len(extradataA) > i:
                print extradataA[i]
                h, bins = np.histogram(extradataA[i], bins= 18)
                hbis = h/1./len(extradataA[i])
                x, y = [], []
                for index in xrange(len(hbis)):
                    x.extend([bins[index], bins[index+1]])
                    y.extend([hbis[index], hbis[index]])
                print x, y, len(x)
                pylab.tick_params(axis='both', which='major', labelsize=25)
                pylab.plot(bins[:-1], np.cumsum(h)/1./len(extradataA[i]), 'k', linewidth = 4)

            pylab.xlabel("Angle (degre)", fontsize = 25)
            #pylab.title(cat[i])
            pylab.ylim([0., 1.2])
            pylab.legend(loc = 2, prop = {'size' : 20})
        for ip, p in enumerate(pops):
            for ip2, p2 in enumerate(pops):
                ksstat, kspval = scipy.stats.ks_2samp(p2, p)
                print "#### cat{0} & cat{3} : ks Stat {1}, pvalue {2}".format(ip, ksstat, kspval, ip2)
        pylab.show()
        #pylab.savefig("{0}hist.png".format(dirpath, nbins, 2, randint(0,999), dirpath))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号