Example #1
0
correlation_pvalue_axis = plt.Subplot(correlation_fig, inner_grid_1[1])
correlation_fig.add_subplot(correlation_pvalue_axis)
correlation_pvalue_axis.set_xlabel('Between line stddev, $\sigma_M$', labelpad=2)
correlation_pvalue_axis.set_ylabel('Fraction bootstraps $\geq \sigma_M$', labelpad=2)

correlation_pvalue_axis.set_ylim([1e-04,2])
correlation_pvalue_axis.set_xlim([0,25])

correlation_pvalue_axis.spines['top'].set_visible(False)
correlation_pvalue_axis.spines['right'].set_visible(False)
correlation_pvalue_axis.get_xaxis().tick_bottom()
correlation_pvalue_axis.get_yaxis().tick_left()
#correlation_pvalue_axis.set_xticks([])

correlation_mut_axis.text(1000,120,figure_utils.get_panel_label('a'),fontsize=6,fontweight='bold')
correlation_pvalue_axis.text(0.5,3,figure_utils.get_panel_label('b'),fontsize=6,fontweight='bold')


##############################################################################
#
# Now set up Fig. S5 (Fixed vs avg mutations in mutators)
#
##############################################################################

mutator_fixation_fig = plt.figure(figsize=(2, 1.5))
mutator_fixation_grid = gridspec.GridSpec(1, 1)
mutator_fixation_axis = plt.Subplot(mutator_fixation_fig, mutator_fixation_grid[0])

mutator_fixation_fig.add_subplot(mutator_fixation_axis)
                       color='#f768a1',
                       linewidth=1,
                       zorder=10)
        freq_axis.plot(dummy_times,
                       fmajors,
                       '-',
                       color='#7a0177',
                       linewidth=1,
                       zorder=10)

    sys.stderr.write("Done!\n")

#adding figure labels
fixed_axis.text(1000,
                1.05,
                figure_utils.get_panel_label('a'),
                fontsize=6,
                fontweight='bold')
remaining_axes[0].text(0,
                       1.15,
                       figure_utils.get_panel_label('b'),
                       fontsize=6,
                       fontweight='bold')

if remove_data_for_copyediting:
    figure_name = 'supplemental_m2_clades'
else:
    figure_name = 'supplemental_m2_clades'

sys.stderr.write("Saving final PNG image...\t")
fig.savefig(parse_file.figure_directory + figure_name + '.pdf',
        interpolation_function = timecourse_utils.create_interpolation_function(masked_times, masked_freqs, tmax=100000)
        haplotype_interpolation_function = timecourse_utils.create_interpolation_function(times, Ls, tmax=100000,kind='nearest')
    
        clone_freqs = clone_alts*1.0/(clone_depths+(clone_depths==0))
        clone_depth_fold_changes = timecourse_utils.estimate_depth_fold_changes(clone_avg_depths, clone_depths)
        
        if not remove_data_for_copyediting:
            freq_axis.plot(masked_times, masked_freqs, '-', color='0.7', alpha=0.5,linewidth=0.25,zorder=1) #,rasterized=True)
        #freq_axis.plot(masked_times, masked_freqs, '-', alpha=0.5,linewidth=0.25,zorder=1)
    if not remove_data_for_copyediting:
        freq_axis.plot(dummy_times, fminors, '-', color='#f768a1', linewidth=1,zorder=10)     
        freq_axis.plot(dummy_times, fmajors, '-', color='#7a0177', linewidth=1,zorder=10)

    sys.stderr.write("Done!\n")

#adding figure labels
fixed_axis.text(1000, 1.05, figure_utils.get_panel_label('a'),fontsize=6,fontweight='bold')
remaining_axes[0].text(0, 1.15, figure_utils.get_panel_label('b'),fontsize=6,fontweight='bold')

if remove_data_for_copyediting:
    figure_name = 'fig3_nodata'
else:
    figure_name = 'fig3'
 

sys.stderr.write("Saving final PNG image...\t")
fig.savefig(parse_file.figure_directory+figure_name+'.pdf',bbox_inches='tight') #, dpi=300, transparent=True)
fig.savefig(parse_file.figure_directory+figure_name+'.png',bbox_inches='tight', dpi=600, transparent=True)

pylab.close(fig)
sys.stderr.write("Done!\n")
Example #4
0
mutator_axis.set_xticklabels(['0']+['%d0k' % i for i in xrange(1,7)]+['Fixed'])
       
nonmutator_axis.legend(loc='center left',frameon=False)
vartype_pfix_axis.legend(loc='upper right',frameon=False)        

nonmutator_parallelism_axis.set_xlim([1,1e02])        
nonmutator_parallelism_axis.set_xticklabels([])
mutator_parallelism_axis.set_xlim([1,1e02])

nonmutator_pfix_axis.set_xlim([1,1e02])
nonmutator_pfix_axis.set_ylim([0,1.05])

mutator_pfix_axis.set_xlim([1,1e02])
mutator_pfix_axis.set_ylim([0,1.05])

nonmutator_axis.text(2000,1.9,figure_utils.get_panel_label('a'),fontsize=6,fontweight='bold')
mutator_axis.text(2000,32.5,figure_utils.get_panel_label('b'),fontsize=6,fontweight='bold')
vartype_pfix_axis.text(0,0.97,figure_utils.get_panel_label('c'),fontsize=6,fontweight='bold')
nonmutator_parallelism_axis.text(1.3,1.3,figure_utils.get_panel_label('d'),fontsize=6,fontweight='bold')
mutator_parallelism_axis.text(1.3,1.3,figure_utils.get_panel_label('e'),fontsize=6,fontweight='bold')
nonmutator_pfix_axis.text(1.5,0.97,figure_utils.get_panel_label('f'),fontsize=6,fontweight='bold')
mutator_pfix_axis.text(1.5,0.97,figure_utils.get_panel_label('g'),fontsize=6,fontweight='bold')

###
#
# No sv fig
#
###

nonmutator_parallelism_axis_nosv.set_xlim([1,1e02])        
nonmutator_parallelism_axis_nosv.set_xticklabels([])
            #if idx>len(theory_times):
            #    continue
            #Mfixeds[idx:] += 1

        total_Mfixeds += Mfixeds
        
        fixation_trajectory_axis.plot(theory_times, Mfixeds,color=color)

avg_Mfixeds = total_Mfixeds/num_pops

fixation_trajectory_axis.plot(theory_times, avg_Mfixeds, 'w-' ,linewidth=1,path_effects=[pe.Stroke(linewidth=2.5, foreground='k'), pe.Normal()])

############
#
# Add figure labels
#
############

fixation_trajectory_axis.text(1500, 95, figure_utils.get_panel_label('a'),fontsize=6,fontweight='bold')
fixation_time_axis.text(1500, 9000, figure_utils.get_panel_label('b'), fontsize=6, fontweight='bold')
pfix_axis.text(0.05, 0.90, figure_utils.get_panel_label('c'), fontsize=6, fontweight='bold')
pooled_pfix_axis.text(0.05, 1.01, figure_utils.get_panel_label('d'), fontsize=6, fontweight='bold')

############
#
# Save figure
#
############
sys.stderr.write("Saving figure...\t")
fig.savefig(parse_file.figure_directory+'fig4.pdf', bbox_inches='tight')
sys.stderr.write("Done!\n")