#Setup subplots so that dendrograms are included
fig, axes = plt.subplots(figsize = (20, 25),
nrows = 2, ncols = 3,
sharex = 'col',
sharey = 'row',
gridspec_kw = {
'width_ratios':[0.1,1, 1],
'height_ratios': [0.075,1]
},)
fig.subplots_adjust(wspace=0.05, hspace=0)
results = -np.log10(activities)
#Cluster changes the sorting of the values array, so be sure to plot context last so that it is in the same sort.
dots_all = DotPlot(results,
fpr)
dots_all.cluster(orientation = 'left', ax = axes[1,0], method='ward')
####Colo206 dotplot, using the same kinase order from full dendrogram
#create xlabel dict
xlabel_dict = {}
for col in results.columns[0:13]:
if col == 'Colo.T00' or col == 'Colo.T05':
xlabel_dict[col] = col[-1]
else:
xlabel_dict[col] = col[-2:]
dots_Colo = DotPlot(results.loc[dots_all.values.index, results.columns[0:13]],
fpr.loc[dots_all.values.index, results.columns[0:13]],
figsize = (6,15),
dotsize = 10,
x_label_dict = xlabel_dict)
dots_Colo.dotplot(ax = axes[1,1], color_legend = False, size_legend = False)
#adjust x-axis labels
axes[1,1].set_xlabel('Length of Treatment (minutes)', fontsize = 20)
labels = axes[1,1].get_xticklabels()
axes[1,1].set_xticklabels(labels, rotation = 0)
###HCT116 dotplot, using the same kinase order from full dendrogram
xlabel_dict = {}
for col in results.columns[13:]:
if col == 'HCT.T00' or col == 'HCT.T05':
xlabel_dict[col] = col[-1]
else:
xlabel_dict[col] = col[-2:]
dots_HCT = DotPlot(results.loc[dots_all.values.index, results.columns[13:]],
fpr.loc[dots_all.values.index, results.columns[13:]],
dotsize = 5,
x_label_dict = xlabel_dict)
dots_HCT.dotplot(ax = axes[1,2])
#adjust x-axis
axes[1,2].set_xlabel('Length of Treatment (minutes)', fontsize = 20)
labels = axes[1,2].get_xticklabels()
axes[1,2].set_xticklabels(labels, rotation = 0)
cmap = sns.color_palette('colorblind')
#Add titles to each dotplot
axes[0,1].annotate('Colo205', (np.arange(13)[6]*10+5,0.6), ha = 'center', fontsize = 24)
axes[0,1].annotate('(RAS-ERK Inhibition)', (np.arange(13)[6]*10+5,0.3), ha = 'center', fontsize = 24)
axes[0,1].set(facecolor = '#b1d1fc')
axes[0,2].annotate('HCT116', (np.arange(13)[6]*10+5,0.6), ha = 'center', fontsize = 24)
axes[0,2].annotate('(RAS-ERK Activation)', (np.arange(13)[6]*10+5,0.3), ha = 'center', fontsize = 24)
axes[0,2].set(facecolor = '#ffb16d')
#turn upper left axis off so does not show gridlines
axes[0,0].axis('off')
#save
plt.savefig(odir+'/vemurafenib_all.pdf', bbox_inches='tight')