示例#1
0
def plot_profiles(prots, eluts, sp='Hs', plot_sums=True, shape=None,
        min_count=1):
    """
    shape: (m,n) = m rows, n columns
    eluts: [el.NormElut(f, sp, norm_rows=False, norm_cols=False) for f in
    fs]
    """
    import plotting as pl
    gt = seqs.GTrans()
    use_eluts = elutions_containing_prots(eluts, sp, seqs.names2ids(prots),
            min_count)
    shape = shape if shape else ut.sqrt_shape(len(use_eluts)+1)
    fig = pl.figure()
    for i,e in enumerate(use_eluts):
        sp_target = ut.shortname(e.filename)[:2]
        pl.subplot(shape[0],shape[1],i+1)
        pl.title(ut.shortname(e.filename))
        pids = [gt.name2id[p] for p in prots]
        protsmax = max([np.max(e.normarr[r]) for p in pids if p in e.baseid2inds for
            r in e.baseid2inds[p]])
        plot_prots(e, pids, e.baseid2inds, protsmax)
        if plot_sums:
            # plot total spectral counts normalized to match biggest peak
            sums = np.sum(e.normarr,axis=0)
            fmax = np.max(sums)
            pl.plot(range(sums.shape[1]),
                    np.log2(sums[0,:]).T*np.log2(protsmax)*len(pids)/np.log2(fmax), 
                    color='k', linestyle='-', linewidth=.5)
    # make legend with all prots
    pl.subplot(shape[0],shape[1],0)
    for p in prots: pl.plot(0,label=p)
    pl.legend()
示例#2
0
def plot_cdf_pos_randoms(pospairs, ppis):
    import plotting as pl
    pl.figure()
    pos,neg1 = pl.hist_pairs_nonpairs(ppis, pospairs, negmult=1, do_plot=False)
    pos,neg100 = pl.hist_pairs_nonpairs(ppis, pospairs, negmult=100,
            do_plot=False)
    for pairs in pos, neg1, neg100:
        pl.cdf(pairs,bins=np.arange(0,1.01,.01))
    pl.xlabel("PPI score")
    pl.ylabel("Cumulative fraction of population")
    pl.title('Several percent of sequential enzymes are high-scoring,\ncompared to much less than one percent for random shufflings')
    pl.legend(['Sequentials','Size-matched reshuffled','100x larger set of reshuffled'],loc=4)