tmp_data.index # <codecell> from PlottingTools import make_heatmap_df order = ['R5-1', 'R5-2', 'R5-3', 'R5-4', 'R5-P', 'X4-P', 'X4'] tmp_data = pdata['Pval'].copy() tmp_data.columns= pd.Index(order) tmp_data[tmp_data<2] = np.nan order = ['CSF', 'brain', 'meninges', 'PBMC', 'monocyte', 'plasma/serum/blood', 'resting CD4+ T cells', 'lymph node', 'spleen', 'GALT', 'colon', 'BAL', 'lung', 'liver', 'cervix/v****a', 's***n/testis', 'urethra'] fig = make_heatmap_df(tmp_data.ix[order], colormap='copper_r', figsize=(10,10)) cbar = plt.colorbar() cbar.set_clim([0, 40]) cbar.set_ticks(range(0, 40, 5)) plt.savefig('final_figures/bining_tissue_figure_shortened.png', dpi=1000) # <codecell> mask = ((trim_lanl['PSSMScore'] > -2.98) & (trim_lanl['STissue'] == 'brain')) wanted_acc = set(trim_lanl['Accession'][mask]) tdata = trim_lanl[['Accession','PSSMScore']][mask].groupby('Accession').first() out_seqs = [] for name, seq in aa_seq_list: if name in wanted_acc: out_seqs.append({ 'Accession':name,
import pandas as pd grade_df = pd.DataFrame(tmp_data, columns = ['BW_id', 'Prob', 'Size']) # <codecell> pdata = pd.pivot_table(grade_df, rows = ['BW_id', 'Prob'], values = 'Size', aggfunc = [np.min, len]).dropna() pdata.head() # <codecell> best_scores = pd.pivot_table(pdata.reset_index(), rows = 'BW_id', cols = 'Prob', values = 'amin') fig = make_heatmap_df(best_scores.T, figsize = (10,10)) plt.colorbar().set_label('Best Solution Nodesize') # <codecell> num_tries = pd.pivot_table(pdata.reset_index(), rows = 'BW_id', cols = 'Prob', values = 'len', aggfunc = np.sum) fig = make_heatmap_df(num_tries.applymap(np.log10).T, figsize = (10,10)) cb = plt.colorbar() tickpos = [5, 10, 15, 20, 30, 40, 50, 60, 100] cb.set_label('#Tries') cb.set_ticks([np.log10(x) for x in tickpos]) cb.set_ticklabels(map(str, tickpos)) # <codecell>