예제 #1
0
 def addplot(oindexlist, ofracslist, n_seqs, fname, title):
     hist = Hist(30, 0., 1.)
     for ofracs in ofracslist:
         hist.fill(ofracs)
     fig, ax = self.plotting.mpl_init()
     hist.mpl_plot(ax, remove_empty_bins=True)
     ax.text(0.65,
             0.8 * ax.get_ylim()[1],
             'size: %d' % n_seqs,
             fontsize=20,
             fontweight='bold')
     ax.text(0.65,
             0.7 * ax.get_ylim()[1],
             'h: %.2f' %
             utils.fay_wu_h(line=None,
                            restrict_to_region=restrict_to_region,
                            occurence_indices=oindexlist,
                            n_seqs=n_seqs),
             fontsize=20,
             fontweight='bold')
     regionstr = restrict_to_region + ' ' if restrict_to_region is not None else ''
     self.plotting.mpl_finish(
         ax,
         plotdir,
         fname,
         title=title,
         xlabel=regionstr + 'mutation frequency',
         ylabel=regionstr + 'density of mutations',
         xticks=[0, 1],
         log=''
     )  # xticks=[min(occurence_fractions), max(occurence_fractions)],
     self.addfname(fnames, fname)
예제 #2
0
    chfcns.mpl_finish(ax,
                      args.plotdir,
                      'imax-vs-max-abs-diff',
                      xlabel='break point',
                      ylabel='abs mfreq diff')
    plt.close()

    fig, ax = chfcns.mpl_init()
    xmin, xmax = 0., 0.65
    for sample, chfo in chfos.items():
        hmaxval = Hist(45,
                       xmin,
                       xmax,
                       value_list=[chfo[u]['max_abs_diff'] for u in chfo])
        hmaxval.normalize()
        hmaxval.mpl_plot(ax, color=colors[sample], label=sample)
    chfcns.mpl_finish(ax,
                      args.plotdir,
                      'mfreq-diff',
                      xlabel='abs mfreq diff',
                      ylabel='freq',
                      xbounds=(xmin - 0.02, xmax),
                      leg_loc=(0.5, 0.6))

    fig, ax = chfcns.mpl_init()
    xmin, xmax = 0., 300
    for sample, chfo in chfos.items():
        himax = Hist(75,
                     xmin,
                     xmax,
                     value_list=[chfo[u]['imax'] for u in chfo])