In [1]:
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import numpy as np
import fileinput
from itertools import product
import pandas as pd
from scipy.interpolate import griddata
from scipy.interpolate import interp2d
import seaborn as sns
from os import listdir

import matplotlib.pyplot as plt
import seaborn as sns
from scipy.interpolate import griddata
import matplotlib as mpl
# sys.path.insert(0,'..')
# from notebookFunctions import *
# from .. import notebookFunctions
from Bio.PDB.Polypeptide import one_to_three
from Bio.PDB.Polypeptide import three_to_one
from Bio.PDB.PDBParser import PDBParser
from pyCodeLib import *
from small_script.myFunctions import *
%matplotlib inline
# plt.rcParams['figure.figsize'] = (10,6.180)    #golden ratio
# %matplotlib notebook
%load_ext autoreload
%autoreload 2

In [2]:
plt.rcParams['figure.figsize'] = [16.18033, 10]    #golden ratio
plt.rcParams['figure.facecolor'] = 'w'
plt.rcParams['figure.dpi'] = 100

In [ ]:
def plot_list(list_to_plot, text_labels=None, fontsize=20, labelsize=12, aspect=1, labelrotation='horizontal'):
	x = list(range(len(list_to_plot)))
	y = np.array(list_to_plot)
	f = plt.figure()
	ax = f.add_subplot(111, aspect=aspect)
	ax.tick_params(labelsize=labelsize)
	plt.plot(x, y)

	if not text_labels == None:
		# #set the bbox for the text. Increase txt_width for wider text.
		# txt_height = 0.04*(plt.ylim()[1] - plt.ylim()[0])
		# txt_width = 0.02*(plt.xlim()[1] - plt.xlim()[0])
		# #Get the corrected text positions, then write the text.
		# text_positions = get_text_positions(text_labels, x, y, txt_width, txt_height)
		# text_plotter(text_labels, x, y, text_positions, txt_width, txt_height)

		# plt.ylim(0,max(text_positions)+2*txt_height)
		for i, txt in enumerate(text_labels):
			ax.annotate(txt, (x[i], y[i]), fontsize=fontsize, rotation=labelrotation)
	plt.show()

In [6]:
pre = "/Users/weilu/Dropbox/optimization/gammas/single_chains_half_B_training_set_phi_lipid_exposure3.0_10.0phi_pairwise_contact_well4.5_6.5_10.0_5phi_six_letter_four_body_helix_docking0_6.0_10.0_8_True_gamma_filtered"

In [48]:
pre = "/Users/weilu/Dropbox/optimization/gammas/"
pre += "single_chains_half_B_training_set_phi_lipid_exposure3.0_10.0phi_pairwise_contact_well4.5_6.5_10.0_5phi_six_letter_four_body_helix_docking0_6.0_10.0_8_True_gamma"
a = np.load(pre)

In [55]:
pre = "/Users/weilu/Dropbox/optimization/gammas/"
pre += "full_training_set_phi_lipid_exposure3.0_10.0phi_pairwise_contact_well4.5_6.5_10.0_5phi_six_letter_four_body_helix_docking0_6.0_10.0_8_True_gamma"
a = np.load(pre)

In [56]:
a.shape


Out[56]:
(356,)

In [57]:
b = a[-126:]

In [58]:
plt.plot(b)


Out[58]:
[<matplotlib.lines.Line2D at 0x1a257be668>]

In [59]:
gammas = b

In [60]:
gammas = sorted(gammas)
labels = [label for (gamma,label) in sorted(zip(b,six_letter_code_combinations))]

In [61]:
plot_list(gammas, text_labels=labels, fontsize=10, aspect='auto', labelrotation='horizontal')



In [27]:
plot_list(gammas, text_labels=labels, fontsize=10, aspect='auto', labelrotation='horizontal')



In [24]:
labels


Out[24]:
['003001',
 '102010',
 '012001',
 '201001',
 '021001',
 '100012',
 '002011',
 '010012',
 '002020',
 '000013',
 '001210',
 '010102',
 '101110',
 '201100',
 '022000',
 '020011',
 '200101',
 '110020',
 '000130',
 '001120',
 '100003',
 '000031',
 '000202',
 '100300',
 '100111',
 '002101',
 '000400',
 '110200',
 '010021',
 '001012',
 '110110',
 '000121',
 '210001',
 '010111',
 '010300',
 '001003',
 '001300',
 '000301',
 '120100',
 '010030',
 '030010',
 '001102',
 '010120',
 '010210',
 '210100',
 '000220',
 '110101',
 '001021',
 '011110',
 '000112',
 '011200',
 '010201',
 '012010',
 '130000',
 '001111',
 '200200',
 '031000',
 '110002',
 '200002',
 '021010',
 '030100',
 '011101',
 '020110',
 '020200',
 '020020',
 '111001',
 '100210',
 '000004',
 '001030',
 '120001',
 '100120',
 '111010',
 '000310',
 '020101',
 '011002',
 '110011',
 '020002',
 '030001',
 '004000',
 '000211',
 '001201',
 '000040',
 '000103',
 '021100',
 '121000',
 '300001',
 '100201',
 '100021',
 '111100',
 '120010',
 '220000',
 '102100',
 '101011',
 '101101',
 '211000',
 '100102',
 '101020',
 '002002',
 '000022',
 '011011',
 '002110',
 '210010',
 '201010',
 '040000',
 '200020',
 '101200',
 '112000',
 '010003',
 '012100',
 '002200',
 '011020',
 '200110',
 '101002',
 '200011',
 '300010',
 '100030',
 '300100',
 '400000',
 '102001',
 '103000',
 '301000',
 '310000',
 '013000',
 '003100',
 '202000',
 '003010']

In [ ]: