for rep in all_reps: temp_hm, wt_temp = c_matrix(rep, aff_fun) A_heatmaps.append(temp_hm) A_wts.append(wt_temp) A_heatmap = np.zeros(A_heatmaps[0].shape) for ii in range(A_heatmap.shape[0]): for jj in range(A_heatmap.shape[1]): A_heatmap[ii, jj] = np.nanmedian( [heatmap[ii, jj] for heatmap in A_heatmaps]) A_wt = np.median(A_wts) # Affinity plot, lib1 ax = axes[0, 0] labeler.label_subplot(ax, 'A') A_1h_map = plot_panel(ax, A_heatmap[:10], A_wt, wtseq1, seq1pos, 'kd', optseq1_dict) ax.set_title('1H', fontsize=mpl.rcParams['font.size']) # Affinity plot, lib2 ax = axes[0, 1] labeler.label_subplot(ax, 'B') A_3h_map = plot_panel(ax, A_heatmap[10:], A_wt, wtseq2, seq2pos, 'kd', optseq2_dict) ax.set_title('3H', fontsize=mpl.rcParams['font.size']) # Get expression zero E_heatmaps = [] E_wts = [] for rep in all_reps:
labelsize = 8 panelsize = 12 # Set colormaps cmap = sns.cubehelix_palette(8, start=0.5, rot=0.0, reverse=True, as_cmap=True) vmax = 100 vmin = 75 sns.set_style('white') ## RNAP heatmap # Plot results for real RNAP data ax = fig.add_axes([left, level1, hm_width, hm_height]) labeler.label_subplot(ax,'A',ypad_adjust=0.02) sns.heatmap( rnap_real_data.transpose(), annot=True, fmt="d", vmin=vmin, vmax=vmax, annot_kws={"size": 7}, cmap=cmap, cbar_kws={"pad":.01}) gelx(ax,rnap_real_annotation,annotation_spacing=0.8,fontsize=labelsize) gely(ax,rnap_real_ylabel,annotation_spacing=0.5,\ fontsize=labelsize,rotation=0,ha='right') # Draw white lines (num_cols,num_rows) = rnap_real_data.shape for y in range(num_rows): plt.plot([0,num_cols],[y,y],color='white',linewidth=2) for x in range(0,num_cols,5): plt.plot([x,x],[0,num_rows],color='white',linewidth=2) ## RNAP summary statistics
# Set colormaps cmap = sns.cubehelix_palette(8, start=0.0, rot=0.0, reverse=True, as_cmap=True) vmax = 100 vmin = 75 sns.set_style('white') # Make a labler to add labels to subplots labeler = Labeler(xpad=.07,ypad=0.02,fontsize=10) ## RNAP heatmap # Plot results for real RNAP data ax = fig.add_axes([left, level1, hm_width, hm_height]) labeler.label_subplot(ax,'A',xpad_adjust=0.03,ypad_adjust=0.04) sns.heatmap( df_rnap_comparison.transpose(), annot=True, fmt="d", vmin=vmin, vmax=vmax, annot_kws={"size": 7}, cmap=cmap, cbar_kws={"pad":.03}) gelx(ax,df_rnap_xannotation,annotation_spacing=0.8,fontsize=labelsize) gely(ax,df_rnap_yannotation,annotation_spacing=0.8,fontsize=labelsize,rotation=0) # Draw white lines (num_cols,num_rows) = df_rnap_comparison.shape for y in range(num_rows): plt.plot([0,num_cols],[y,y],color='white',linewidth=2) for x in [1,6]: plt.plot([x,x],[0,num_rows],color='white',linewidth=2) ## CRP heatmap
# Panel C # Make a labler to add labels to subplots labeler = Labeler(xpad=.07, ypad=-.01, fontsize=10) # Position panel #bottom=0.62 #top=0.98 bottom = 0.05 top = 0.30 left = 0.30 right = 0.75 height = top - bottom width = right - left ax = fig.add_axes([left, bottom, width, height]) labeler.label_subplot(ax, 'C', xpad_adjust=.05, ypad_adjust=0) log_bounds = [-10, -4.5] lims = log_bounds R, P = plot_combine_clones(all_reps, log_bounds, ax) ax.plot(lims, lims, '--', c=gray, zorder=-10) ax.set_ylabel('$K_D$ [M], Tite-Seq', labelpad=2) ax.set_xlabel('$K_D$ [M], flow', labelpad=2) ticks = range(int(np.ceil(lims[0])), int(lims[1]) + 1) tick_labels = [r'$10^{%i}$' % (t) for t in ticks] ax.set_xticks(ticks) ax.set_yticks(ticks) ax.set_xticklabels(tick_labels)
labelsize = 8 panelsize = 12 # Set colormaps cmap = sns.cubehelix_palette(8, start=0.5, rot=0.0, reverse=True, as_cmap=True) vmax = 100 vmin = 75 sns.set_style('white') ## RNAP heatmap # Plot results for real RNAP data ax = fig.add_axes([left, level1, hm_width, hm_height]) labeler.label_subplot(ax, 'A', ypad_adjust=0.02) sns.heatmap(rnap_real_data.transpose(), annot=True, fmt="d", vmin=vmin, vmax=vmax, annot_kws={"size": 7}, cmap=cmap, cbar_kws={"pad": .01}) gelx(ax, rnap_real_annotation, annotation_spacing=0.8, fontsize=labelsize) gely(ax,rnap_real_ylabel,annotation_spacing=0.5,\ fontsize=labelsize,rotation=0,ha='right') # Draw white lines (num_cols, num_rows) = rnap_real_data.shape for y in range(num_rows):
right=.95, hspace=0, wspace=.5) # Make a labler to add labels to subplots labeler = Labeler(xpad=.03, ypad=-.01, fontsize=10) # fluorescein grid summary = get_clone_data() clones = summary.keys() inds = np.argsort( [np.nanmean(np.log10(np.array(summary[k]['KD']))) for k in clones]) # Panel B labeler.label_subplot(axes[0, 0], 'A') fl = np.array([ 0, 10**-9.5, 10**-9, 10**-8.5, 10**-8, 10**-7.5, 10**-7, 10**-6.5, 10**-6, 10**-5.5, 10**-5 ]) plot_titeseq(axes[0, 0], all_reps, clones[inds[0]]) plot_titeseq(axes[1, 0], all_reps, clones[inds[1]]) plot_titeseq(axes[2, 0], all_reps, clones[inds[2]]) plot_titeseq(axes[3, 0], all_reps, clones[inds[3]]) plot_titeseq(axes[4, 0], all_reps, clones[inds[4]], ylabel=True) plot_titeseq(axes[5, 0], all_reps, clones[inds[5]]) plot_titeseq(axes[6, 0], all_reps, clones[inds[6]]) plot_titeseq(axes[7, 0], all_reps, clones[inds[7]]) plot_titeseq(axes[8, 0], all_reps, clones[inds[8]]) plot_titeseq(axes[9, 0], all_reps, clones[inds[9]], xticklabels=True)