In [5]:
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 *
from collections import defaultdict
%matplotlib inline
# plt.rcParams['figure.figsize'] = (10,6.180)    #golden ratio
# %matplotlib notebook
%load_ext autoreload
%autoreload 2

In [6]:
plt.rcParams['figure.figsize'] = np.array([16.18033, 10])    #golden ratio
plt.rcParams['figure.facecolor'] = 'w'
plt.rcParams['figure.dpi'] = 100
plt.rcParams.update({'font.size': 22})

In [7]:
def get_seq_fromPredictTopo(topo):
    loc = topo
    with open(loc) as f:
        a = f.readlines()
    assert len(a) % 3 == 0
    chain_count = len(a) // 3
    seq = ""
    for i in range(chain_count):
        seq_i = (a[i*3+2]).strip()
        seq += seq_i
    assert np.alltrue([i in ["0", "1"] for i in seq])

    return seq

In [9]:
seq = get_seq_fromPredictTopo("/Users/weilu/Research/server/sep_2019/1su4_nice_movie/1su4_topo")

In [10]:
len(seq)


Out[10]:
994

In [17]:
pre_res = "0"
end_list = []
start_list = []
for i, res in enumerate(seq):
    if res == "0":
        outMem = True
    if res == "1" and outMem:
        outMem = False
        print("Start", i)
        start_list.append(i)
    if res == "0" and pre_res == "1":
        print("End", i)
        end_list.append(i)
    pre_res = res


Start 60
End 75
Start 88
End 106
Start 262
End 279
Start 293
End 320
Start 760
End 781
Start 832
End 856
Start 897
End 911
Start 929
End 949
Start 963
End 985

In [19]:
lines = []
for start, end in zip(start_list, end_list):
    print(start, end)
    start_res = start + 1
    end_res = end
    lines.append(f"resid {start_res} to {end_res} ")


60 75
88 106
262 279
293 320
760 781
832 856
897 911
929 949
963 985

In [21]:
"or ".join(lines)


Out[21]:
'resid 61 to 75 or resid 89 to 106 or resid 263 to 279 or resid 294 to 320 or resid 761 to 781 or resid 833 to 856 or resid 898 to 911 or resid 930 to 949 or resid 964 to 985 '

In [25]:
import pickle
import gzip
import numpy

with open('/Users/weilu/Research/Build/RaptorX-Contact/raptorx.uchicago.edu/pdb25-test-500.release.contactFeatures.pkl', 'rb') as f:
    u = pickle._Unpickler(f)
    u.encoding = 'latin1'
    p = u.load()
    print(p)


IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.

Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)


In [26]:
p[0]


Out[26]:
{'ACC': array([[2.14100e-03, 3.12040e-02, 9.66655e-01],
        [4.54880e-02, 3.28255e-01, 6.26257e-01],
        [4.03800e-03, 9.20500e-02, 9.03912e-01],
        [9.17800e-03, 1.22090e-01, 8.68732e-01],
        [5.53530e-02, 3.28582e-01, 6.16065e-01],
        [6.23900e-03, 8.09590e-02, 9.12802e-01],
        [1.18760e-02, 2.41622e-01, 7.46502e-01],
        [4.17500e-03, 1.20500e-01, 8.75325e-01],
        [2.97151e-01, 4.45199e-01, 2.57650e-01],
        [3.54500e-03, 1.23625e-01, 8.72830e-01],
        [1.85048e-01, 5.09717e-01, 3.05236e-01],
        [3.18177e-01, 5.68778e-01, 1.13045e-01],
        [1.26020e-02, 2.12773e-01, 7.74624e-01],
        [3.28610e-02, 2.41676e-01, 7.25463e-01],
        [3.73442e-01, 5.20963e-01, 1.05595e-01],
        [7.66700e-03, 9.67260e-02, 8.95607e-01],
        [4.56700e-02, 3.14696e-01, 6.39634e-01],
        [7.25330e-02, 2.21646e-01, 7.05821e-01],
        [1.04836e-01, 3.21067e-01, 5.74097e-01],
        [1.04761e-01, 4.94554e-01, 4.00685e-01],
        [1.55632e-01, 6.03289e-01, 2.41079e-01],
        [3.52800e-02, 3.91312e-01, 5.73408e-01],
        [4.87310e-02, 2.19958e-01, 7.31311e-01],
        [2.64610e-02, 2.31296e-01, 7.42243e-01],
        [2.63170e-02, 2.13034e-01, 7.60649e-01],
        [6.07772e-01, 3.40969e-01, 5.12590e-02],
        [1.27717e-01, 5.37456e-01, 3.34828e-01],
        [8.41412e-01, 1.48836e-01, 9.75200e-03],
        [2.00118e-01, 5.65473e-01, 2.34409e-01],
        [7.19566e-01, 2.29286e-01, 5.11470e-02],
        [3.65680e-02, 2.74780e-01, 6.88652e-01],
        [1.70273e-01, 5.11371e-01, 3.18355e-01],
        [7.16220e-02, 3.50763e-01, 5.77615e-01],
        [6.88151e-01, 2.82804e-01, 2.90460e-02],
        [2.94757e-01, 5.38492e-01, 1.66751e-01],
        [4.64246e-01, 3.56485e-01, 1.79268e-01],
        [1.68935e-01, 6.28411e-01, 2.02655e-01],
        [2.11006e-01, 5.00835e-01, 2.88159e-01],
        [1.13154e-01, 4.06637e-01, 4.80210e-01],
        [1.73930e-01, 2.67175e-01, 5.58895e-01],
        [1.40998e-01, 3.94579e-01, 4.64423e-01],
        [2.37374e-01, 3.88071e-01, 3.74555e-01],
        [1.03600e-01, 4.40978e-01, 4.55422e-01],
        [6.54910e-02, 2.02089e-01, 7.32421e-01],
        [5.25803e-01, 4.13230e-01, 6.09670e-02],
        [6.14550e-02, 2.85647e-01, 6.52898e-01],
        [2.90971e-01, 4.56251e-01, 2.52777e-01],
        [4.43565e-01, 3.73055e-01, 1.83380e-01],
        [6.24076e-01, 3.15369e-01, 6.05550e-02],
        [2.25550e-01, 5.58326e-01, 2.16124e-01],
        [9.00536e-01, 9.49210e-02, 4.54200e-03],
        [1.97100e-02, 3.89117e-01, 5.91173e-01],
        [1.75540e-02, 1.74556e-01, 8.07890e-01],
        [2.54030e-02, 1.71925e-01, 8.02672e-01],
        [4.99322e-01, 4.81505e-01, 1.91740e-02],
        [8.64500e-02, 5.31121e-01, 3.82429e-01],
        [7.91988e-01, 2.00763e-01, 7.24900e-03],
        [5.07780e-02, 4.26208e-01, 5.23014e-01],
        [6.05601e-01, 3.68612e-01, 2.57870e-02],
        [2.02004e-01, 5.74045e-01, 2.23952e-01],
        [1.07623e-01, 4.06652e-01, 4.85725e-01],
        [1.48718e-01, 6.19811e-01, 2.31471e-01],
        [4.17362e-01, 5.00173e-01, 8.24660e-02],
        [2.57090e-02, 2.34984e-01, 7.39307e-01],
        [3.87840e-02, 2.78895e-01, 6.82321e-01],
        [2.24300e-02, 2.04152e-01, 7.73418e-01],
        [2.40267e-01, 2.96788e-01, 4.62946e-01],
        [4.05745e-01, 5.36583e-01, 5.76720e-02],
        [6.17775e-01, 3.49692e-01, 3.25330e-02],
        [7.43031e-01, 2.40598e-01, 1.63710e-02],
        [9.85671e-01, 1.21600e-02, 2.16900e-03],
        [8.09435e-01, 1.74083e-01, 1.64820e-02],
        [6.20005e-01, 3.55353e-01, 2.46410e-02],
        [4.53160e-01, 4.14432e-01, 1.32408e-01],
        [4.94532e-01, 3.58789e-01, 1.46680e-01],
        [1.21057e-01, 3.86545e-01, 4.92398e-01],
        [1.31824e-01, 2.80340e-01, 5.87836e-01],
        [3.32604e-01, 3.72272e-01, 2.95124e-01],
        [4.33790e-02, 4.17182e-01, 5.39439e-01],
        [2.58835e-01, 6.39926e-01, 1.01239e-01],
        [8.85740e-01, 1.11789e-01, 2.47100e-03],
        [7.40762e-01, 2.49028e-01, 1.02100e-02],
        [9.87586e-01, 1.14860e-02, 9.28000e-04],
        [8.80260e-01, 1.11008e-01, 8.73200e-03],
        [9.49564e-01, 4.79180e-02, 2.51800e-03],
        [4.11379e-01, 5.24886e-01, 6.37340e-02],
        [2.00726e-01, 5.39811e-01, 2.59464e-01],
        [3.81029e-01, 5.31861e-01, 8.71100e-02],
        [6.85110e-02, 4.03072e-01, 5.28417e-01],
        [1.41880e-02, 2.12275e-01, 7.73536e-01],
        [1.93430e-02, 1.46819e-01, 8.33838e-01],
        [6.02700e-02, 2.99670e-01, 6.40061e-01],
        [6.23190e-02, 2.56040e-01, 6.81642e-01],
        [8.57300e-03, 1.29590e-01, 8.61838e-01],
        [5.61560e-02, 2.94408e-01, 6.49436e-01],
        [1.70905e-01, 4.04321e-01, 4.24774e-01],
        [2.33630e-02, 1.58199e-01, 8.18438e-01],
        [2.13426e-01, 4.96572e-01, 2.90002e-01],
        [3.03833e-01, 4.53168e-01, 2.42999e-01],
        [3.43159e-01, 3.93612e-01, 2.63229e-01],
        [7.46500e-02, 4.07682e-01, 5.17668e-01],
        [4.81255e-01, 4.38674e-01, 8.00710e-02],
        [4.89800e-03, 7.01890e-02, 9.24914e-01]], dtype=float32),
 'PSFM': array([[0.0671858 , 0.00848389, 0.210216  , ..., 0.0350024 , 0.003539  ,
         0.0194352 ],
        [0.0409585 , 0.0149163 , 0.0251375 , ..., 0.0500223 , 0.0284411 ,
         0.32362   ],
        [0.177643  , 0.016066  , 0.0422349 , ..., 0.0952733 , 0.00496893,
         0.02178   ],
        ...,
        [0.0737128 , 0.0121674 , 0.0490185 , ..., 0.0760809 , 0.00412971,
         0.0186908 ],
        [0.0376652 , 0.0114167 , 0.0151081 , ..., 0.0714966 , 0.0166591 ,
         0.0808188 ],
        [0.0529496 , 0.00764128, 0.0462977 , ..., 0.0369183 , 0.00449008,
         0.0185344 ]], dtype=float32),
 'name': '1r77A',
 'DISO': array([[0.444],
        [0.406],
        [0.376],
        [0.341],
        [0.311],
        [0.266],
        [0.228],
        [0.189],
        [0.144],
        [0.12 ],
        [0.099],
        [0.091],
        [0.089],
        [0.087],
        [0.086],
        [0.085],
        [0.082],
        [0.078],
        [0.07 ],
        [0.064],
        [0.059],
        [0.057],
        [0.054],
        [0.053],
        [0.05 ],
        [0.045],
        [0.039],
        [0.036],
        [0.035],
        [0.033],
        [0.031],
        [0.027],
        [0.024],
        [0.021],
        [0.02 ],
        [0.02 ],
        [0.021],
        [0.021],
        [0.022],
        [0.024],
        [0.027],
        [0.03 ],
        [0.032],
        [0.031],
        [0.027],
        [0.022],
        [0.019],
        [0.017],
        [0.014],
        [0.014],
        [0.014],
        [0.016],
        [0.016],
        [0.014],
        [0.011],
        [0.008],
        [0.006],
        [0.004],
        [0.004],
        [0.004],
        [0.004],
        [0.003],
        [0.003],
        [0.003],
        [0.004],
        [0.003],
        [0.003],
        [0.002],
        [0.002],
        [0.002],
        [0.002],
        [0.002],
        [0.003],
        [0.004],
        [0.005],
        [0.006],
        [0.007],
        [0.006],
        [0.004],
        [0.002],
        [0.001],
        [0.001],
        [0.002],
        [0.002],
        [0.003],
        [0.004],
        [0.009],
        [0.022],
        [0.05 ],
        [0.093],
        [0.115],
        [0.122],
        [0.117],
        [0.096],
        [0.068],
        [0.048],
        [0.036],
        [0.033],
        [0.037],
        [0.045],
        [0.062],
        [0.09 ],
        [0.167]], dtype=float32),
 'sequence': 'DYKDDDDKVKLYKTNKYGTLYKSESASFTANTDIITRLTGPFRSMPQSGVLRKGLTIKYDEVMKQDGHVWVGYNTNSGKRVYLPVRTWNESTGELGPLWGTIK',
 'ccmpredZ': array([[ 0.    ,  0.    ,  0.    , ...,  0.462 ,  0.46  ,  0.794 ],
        [ 0.    ,  0.    ,  0.    , ...,  0.843 , -0.521 , -0.2415],
        [ 0.    ,  0.    ,  0.    , ...,  1.324 , -0.1836,  0.7134],
        ...,
        [ 0.462 ,  0.843 ,  1.324 , ...,  0.    ,  0.    ,  0.    ],
        [ 0.46  , -0.521 , -0.1836, ...,  0.    ,  0.    ,  0.    ],
        [ 0.794 , -0.2415,  0.7134, ...,  0.    ,  0.    ,  0.    ]],
       dtype=float16),
 'contactMatrix': array([[-1, -1, -1, ..., -1, -1, -1],
        [-1, -1, -1, ..., -1, -1, -1],
        [-1, -1, -1, ..., -1, -1, -1],
        ...,
        [-1, -1, -1, ...,  1,  1,  1],
        [-1, -1, -1, ...,  1,  1,  1],
        [-1, -1, -1, ...,  1,  1,  1]], dtype=int8),
 'PSSM': array([[-0.189699 , -1.15306  ,  1.96094  , ..., -1.0534   , -1.81744  ,
         -1.02018  ],
        [-0.903694 , -0.338968 , -1.10301  , ..., -0.538283 ,  1.18912  ,
          3.03737  ],
        [ 1.21305  , -0.231841 , -0.35442  , ...,  0.391215 , -1.32785  ,
         -0.855854 ],
        ...,
        [-0.0559402, -0.632841 , -0.13953  , ...,  0.0666771, -1.59475  ,
         -1.07653  ],
        [-1.02462  , -0.724708 , -1.83753  , ..., -0.0229816,  0.417453 ,
          1.03584  ],
        [-0.533237 , -1.30397  , -0.221915 , ..., -0.97652  , -1.47404  ,
         -1.08865  ]], dtype=float32),
 'SS3': array([[0.001, 0.001, 0.998],
        [0.187, 0.017, 0.797],
        [0.209, 0.01 , 0.781],
        [0.222, 0.003, 0.775],
        [0.292, 0.001, 0.706],
        [0.398, 0.004, 0.599],
        [0.486, 0.009, 0.505],
        [0.597, 0.027, 0.376],
        [0.543, 0.042, 0.415],
        [0.459, 0.068, 0.473],
        [0.206, 0.137, 0.657],
        [0.013, 0.493, 0.494],
        [0.006, 0.813, 0.18 ],
        [0.004, 0.787, 0.209],
        [0.   , 0.052, 0.948],
        [0.003, 0.005, 0.992],
        [0.002, 0.002, 0.997],
        [0.   , 0.013, 0.987],
        [0.   , 0.084, 0.915],
        [0.002, 0.771, 0.228],
        [0.   , 0.725, 0.275],
        [0.001, 0.519, 0.48 ],
        [0.003, 0.348, 0.649],
        [0.004, 0.339, 0.657],
        [0.004, 0.5  , 0.496],
        [0.003, 0.698, 0.299],
        [0.002, 0.842, 0.156],
        [0.001, 0.883, 0.116],
        [0.001, 0.806, 0.193],
        [0.002, 0.417, 0.58 ],
        [0.   , 0.157, 0.843],
        [0.   , 0.155, 0.844],
        [0.   , 0.25 , 0.749],
        [0.001, 0.862, 0.138],
        [0.001, 0.952, 0.047],
        [0.   , 0.947, 0.052],
        [0.001, 0.904, 0.096],
        [0.001, 0.755, 0.245],
        [0.001, 0.313, 0.686],
        [0.   , 0.042, 0.957],
        [0.   , 0.032, 0.968],
        [0.003, 0.149, 0.847],
        [0.003, 0.154, 0.843],
        [0.001, 0.143, 0.856],
        [0.   , 0.119, 0.881],
        [0.   , 0.148, 0.852],
        [0.001, 0.713, 0.287],
        [0.   , 0.83 , 0.17 ],
        [0.   , 0.911, 0.089],
        [0.   , 0.928, 0.072],
        [0.   , 0.686, 0.314],
        [0.   , 0.05 , 0.95 ],
        [0.001, 0.007, 0.992],
        [0.   , 0.004, 0.995],
        [0.   , 0.013, 0.987],
        [0.   , 0.94 , 0.059],
        [0.   , 0.987, 0.013],
        [0.   , 0.897, 0.103],
        [0.   , 0.466, 0.533],
        [0.   , 0.246, 0.754],
        [0.001, 0.901, 0.099],
        [0.   , 0.982, 0.018],
        [0.   , 0.989, 0.011],
        [0.   , 0.933, 0.067],
        [0.   , 0.798, 0.201],
        [0.001, 0.014, 0.986],
        [0.001, 0.017, 0.982],
        [0.   , 0.847, 0.153],
        [0.   , 0.985, 0.014],
        [0.   , 0.994, 0.006],
        [0.   , 0.996, 0.004],
        [0.   , 0.99 , 0.01 ],
        [0.   , 0.978, 0.021],
        [0.001, 0.902, 0.097],
        [0.001, 0.192, 0.807],
        [0.003, 0.01 , 0.988],
        [0.002, 0.002, 0.996],
        [0.   , 0.043, 0.957],
        [0.   , 0.178, 0.822],
        [0.001, 0.962, 0.037],
        [0.   , 0.983, 0.017],
        [0.   , 0.986, 0.014],
        [0.   , 0.972, 0.028],
        [0.   , 0.949, 0.05 ],
        [0.   , 0.922, 0.078],
        [0.   , 0.861, 0.139],
        [0.001, 0.67 , 0.329],
        [0.001, 0.338, 0.661],
        [0.003, 0.193, 0.804],
        [0.006, 0.037, 0.957],
        [0.002, 0.005, 0.992],
        [0.007, 0.004, 0.989],
        [0.002, 0.026, 0.972],
        [0.005, 0.249, 0.745],
        [0.01 , 0.409, 0.581],
        [0.006, 0.354, 0.64 ],
        [0.012, 0.319, 0.67 ],
        [0.01 , 0.337, 0.653],
        [0.007, 0.531, 0.462],
        [0.003, 0.85 , 0.146],
        [0.002, 0.892, 0.106],
        [0.001, 0.749, 0.25 ],
        [0.   , 0.002, 0.998]], dtype=float32),
 'psicovZ': array([[ 0.    ,  0.    ,  0.    , ..., -0.1279, -0.1279, -0.1279],
        [ 0.    ,  0.    ,  0.    , ..., -0.1279, -0.1279, -0.1279],
        [ 0.    ,  0.    ,  0.    , ..., -0.1279, -0.1279, -0.1279],
        ...,
        [-0.1279, -0.1279, -0.1279, ...,  0.    ,  0.    ,  0.    ],
        [-0.1279, -0.1279, -0.1279, ...,  0.    ,  0.    ,  0.    ],
        [-0.1279, -0.1279, -0.1279, ...,  0.    ,  0.    ,  0.    ]],
       dtype=float16),
 'OtherPairs': array([[[ 0.      ,  0.      ,  0.      ],
         [-0.000615,  0.00525 ,  0.007427],
         [-0.00606 ,  0.004154,  0.005093],
         ...,
         [ 0.      , -0.000355,  0.001965],
         [ 0.004745,  0.001356,  0.005276],
         [-0.00606 ,  0.002352,  0.00363 ]],
 
        [[-0.000615,  0.00525 ,  0.007427],
         [ 0.      ,  0.      ,  0.      ],
         [ 0.001862,  0.00334 ,  0.00445 ],
         ...,
         [ 0.002178, -0.000914,  0.001841],
         [-0.0029  ,  0.000698,  0.005356],
         [-0.003513,  0.001765,  0.003283]],
 
        [[-0.00606 ,  0.004154,  0.005093],
         [ 0.001862,  0.00334 ,  0.00445 ],
         [ 0.      ,  0.      ,  0.      ],
         ...,
         [-0.00949 , -0.003658, -0.002476],
         [ 0.000527, -0.000657,  0.001343],
         [ 0.005096,  0.004128,  0.00478 ]],
 
        ...,
 
        [[ 0.      , -0.000355,  0.001965],
         [ 0.002178, -0.000914,  0.001841],
         [-0.00949 , -0.003658, -0.002476],
         ...,
         [ 0.      ,  0.      ,  0.      ],
         [ 0.01011 , -0.00798 , -0.003021],
         [-0.02576 , -0.005623, -0.004005]],
 
        [[ 0.004745,  0.001356,  0.005276],
         [-0.0029  ,  0.000698,  0.005356],
         [ 0.000527, -0.000657,  0.001343],
         ...,
         [ 0.01011 , -0.00798 , -0.003021],
         [ 0.      ,  0.      ,  0.      ],
         [ 0.05167 , -0.003626, -0.000892]],
 
        [[-0.00606 ,  0.002352,  0.00363 ],
         [-0.003513,  0.001765,  0.003283],
         [ 0.005096,  0.004128,  0.00478 ],
         ...,
         [-0.02576 , -0.005623, -0.004005],
         [ 0.05167 , -0.003626, -0.000892],
         [ 0.      ,  0.      ,  0.      ]]], dtype=float16),
 'SS8': array([[0.   , 0.   , 0.   , 0.   , 0.   , 0.   , 0.   , 1.   ],
        [0.142, 0.06 , 0.   , 0.02 , 0.02 , 0.217, 0.001, 0.54 ],
        [0.165, 0.081, 0.   , 0.028, 0.021, 0.307, 0.114, 0.284],
        [0.172, 0.081, 0.   , 0.017, 0.008, 0.274, 0.136, 0.311],
        [0.216, 0.077, 0.   , 0.004, 0.007, 0.22 , 0.162, 0.313],
        [0.232, 0.091, 0.   , 0.003, 0.004, 0.222, 0.176, 0.272],
        [0.231, 0.108, 0.   , 0.01 , 0.009, 0.127, 0.141, 0.374],
        [0.231, 0.105, 0.   , 0.045, 0.021, 0.076, 0.094, 0.428],
        [0.215, 0.085, 0.   , 0.134, 0.023, 0.072, 0.084, 0.388],
        [0.182, 0.081, 0.   , 0.21 , 0.012, 0.08 , 0.112, 0.324],
        [0.156, 0.064, 0.   , 0.239, 0.017, 0.078, 0.081, 0.364],
        [0.109, 0.02 , 0.   , 0.361, 0.033, 0.043, 0.057, 0.378],
        [0.087, 0.013, 0.   , 0.476, 0.027, 0.038, 0.062, 0.297],
        [0.077, 0.02 , 0.   , 0.43 , 0.033, 0.035, 0.063, 0.341],
        [0.063, 0.026, 0.   , 0.127, 0.01 , 0.051, 0.084, 0.638],
        [0.068, 0.039, 0.   , 0.075, 0.021, 0.227, 0.189, 0.381],
        [0.054, 0.044, 0.   , 0.076, 0.02 , 0.357, 0.176, 0.273],
        [0.024, 0.042, 0.   , 0.096, 0.008, 0.266, 0.225, 0.339],
        [0.032, 0.036, 0.   , 0.209, 0.018, 0.078, 0.183, 0.444],
        [0.073, 0.047, 0.   , 0.32 , 0.029, 0.084, 0.144, 0.303],
        [0.076, 0.04 , 0.   , 0.339, 0.023, 0.076, 0.066, 0.379],
        [0.074, 0.034, 0.   , 0.337, 0.029, 0.059, 0.084, 0.384],
        [0.069, 0.056, 0.   , 0.249, 0.009, 0.169, 0.123, 0.326],
        [0.05 , 0.057, 0.   , 0.289, 0.009, 0.228, 0.22 , 0.147],
        [0.033, 0.028, 0.   , 0.391, 0.015, 0.154, 0.147, 0.232],
        [0.003, 0.004, 0.   , 0.598, 0.008, 0.018, 0.082, 0.287],
        [0.002, 0.002, 0.   , 0.801, 0.016, 0.007, 0.031, 0.141],
        [0.002, 0.001, 0.   , 0.887, 0.023, 0.004, 0.018, 0.065],
        [0.002, 0.001, 0.   , 0.789, 0.012, 0.005, 0.018, 0.173],
        [0.001, 0.003, 0.   , 0.561, 0.009, 0.199, 0.079, 0.148],
        [0.001, 0.003, 0.   , 0.348, 0.003, 0.207, 0.233, 0.204],
        [0.017, 0.002, 0.   , 0.421, 0.01 , 0.032, 0.315, 0.205],
        [0.024, 0.002, 0.   , 0.51 , 0.007, 0.028, 0.081, 0.348],
        [0.031, 0.003, 0.   , 0.838, 0.008, 0.005, 0.024, 0.091],
        [0.032, 0.002, 0.   , 0.903, 0.006, 0.002, 0.004, 0.05 ],
        [0.032, 0.002, 0.   , 0.884, 0.004, 0.003, 0.01 , 0.066],
        [0.031, 0.002, 0.   , 0.863, 0.006, 0.01 , 0.015, 0.073],
        [0.03 , 0.002, 0.   , 0.737, 0.011, 0.025, 0.048, 0.146],
        [0.024, 0.001, 0.   , 0.352, 0.007, 0.028, 0.28 , 0.308],
        [0.004, 0.01 , 0.   , 0.078, 0.004, 0.08 , 0.377, 0.448],
        [0.018, 0.062, 0.   , 0.046, 0.013, 0.139, 0.192, 0.53 ],
        [0.02 , 0.108, 0.   , 0.121, 0.065, 0.124, 0.106, 0.457],
        [0.019, 0.119, 0.   , 0.168, 0.021, 0.244, 0.205, 0.224],
        [0.014, 0.087, 0.   , 0.18 , 0.042, 0.243, 0.196, 0.237],
        [0.008, 0.005, 0.   , 0.19 , 0.007, 0.008, 0.294, 0.487],
        [0.012, 0.013, 0.   , 0.247, 0.009, 0.068, 0.088, 0.563],
        [0.013, 0.017, 0.   , 0.709, 0.026, 0.084, 0.052, 0.099],
        [0.011, 0.012, 0.   , 0.79 , 0.004, 0.069, 0.04 , 0.074],
        [0.005, 0.007, 0.   , 0.85 , 0.001, 0.038, 0.048, 0.051],
        [0.004, 0.003, 0.   , 0.899, 0.017, 0.009, 0.015, 0.053],
        [0.004, 0.001, 0.   , 0.758, 0.03 , 0.004, 0.023, 0.18 ],
        [0.003, 0.001, 0.   , 0.196, 0.022, 0.015, 0.018, 0.745],
        [0.002, 0.01 , 0.   , 0.012, 0.001, 0.942, 0.018, 0.014],
        [0.   , 0.009, 0.   , 0.009, 0.   , 0.944, 0.022, 0.014],
        [0.   , 0.001, 0.   , 0.056, 0.004, 0.007, 0.023, 0.91 ],
        [0.   , 0.   , 0.   , 0.915, 0.01 , 0.   , 0.002, 0.073],
        [0.   , 0.   , 0.   , 0.98 , 0.003, 0.   , 0.001, 0.016],
        [0.   , 0.   , 0.   , 0.955, 0.001, 0.   , 0.003, 0.04 ],
        [0.027, 0.023, 0.   , 0.743, 0.01 , 0.032, 0.023, 0.142],
        [0.029, 0.028, 0.   , 0.594, 0.001, 0.133, 0.127, 0.089],
        [0.032, 0.024, 0.   , 0.728, 0.002, 0.119, 0.038, 0.057],
        [0.032, 0.005, 0.   , 0.915, 0.004, 0.009, 0.006, 0.029],
        [0.03 , 0.003, 0.   , 0.936, 0.004, 0.005, 0.004, 0.017],
        [0.025, 0.003, 0.   , 0.881, 0.004, 0.01 , 0.012, 0.065],
        [0.009, 0.008, 0.   , 0.315, 0.006, 0.534, 0.051, 0.076],
        [0.002, 0.008, 0.   , 0.036, 0.003, 0.831, 0.057, 0.063],
        [0.001, 0.004, 0.   , 0.093, 0.003, 0.504, 0.23 , 0.165],
        [0.001, 0.002, 0.   , 0.604, 0.018, 0.021, 0.035, 0.32 ],
        [0.003, 0.001, 0.   , 0.939, 0.015, 0.004, 0.005, 0.033],
        [0.003, 0.002, 0.   , 0.961, 0.003, 0.006, 0.004, 0.021],
        [0.002, 0.002, 0.   , 0.937, 0.002, 0.017, 0.01 , 0.029],
        [0.001, 0.002, 0.   , 0.876, 0.003, 0.017, 0.034, 0.066],
        [0.001, 0.002, 0.   , 0.752, 0.011, 0.005, 0.073, 0.156],
        [0.002, 0.006, 0.   , 0.556, 0.025, 0.03 , 0.062, 0.319],
        [0.012, 0.089, 0.   , 0.079, 0.009, 0.391, 0.177, 0.243],
        [0.015, 0.095, 0.   , 0.05 , 0.011, 0.577, 0.191, 0.061],
        [0.009, 0.045, 0.   , 0.013, 0.015, 0.592, 0.238, 0.09 ],
        [0.001, 0.013, 0.   , 0.056, 0.007, 0.321, 0.357, 0.246],
        [0.001, 0.006, 0.   , 0.347, 0.014, 0.045, 0.135, 0.452],
        [0.001, 0.004, 0.   , 0.807, 0.017, 0.017, 0.031, 0.123],
        [0.001, 0.002, 0.   , 0.915, 0.005, 0.011, 0.014, 0.053],
        [0.   , 0.001, 0.   , 0.953, 0.005, 0.003, 0.008, 0.029],
        [0.   , 0.   , 0.   , 0.948, 0.002, 0.001, 0.009, 0.039],
        [0.   , 0.001, 0.   , 0.925, 0.002, 0.005, 0.009, 0.057],
        [0.002, 0.005, 0.   , 0.785, 0.015, 0.008, 0.024, 0.161],
        [0.002, 0.007, 0.   , 0.708, 0.006, 0.013, 0.068, 0.196],
        [0.003, 0.007, 0.   , 0.6  , 0.017, 0.022, 0.067, 0.284],
        [0.004, 0.009, 0.   , 0.335, 0.026, 0.06 , 0.209, 0.358],
        [0.004, 0.013, 0.   , 0.127, 0.013, 0.074, 0.201, 0.568],
        [0.061, 0.129, 0.   , 0.038, 0.011, 0.334, 0.199, 0.229],
        [0.065, 0.141, 0.   , 0.03 , 0.014, 0.408, 0.13 , 0.213],
        [0.05 , 0.119, 0.   , 0.026, 0.025, 0.346, 0.203, 0.232],
        [0.055, 0.059, 0.   , 0.044, 0.015, 0.252, 0.279, 0.296],
        [0.058, 0.051, 0.   , 0.11 , 0.029, 0.163, 0.209, 0.38 ],
        [0.051, 0.024, 0.   , 0.133, 0.065, 0.134, 0.2  , 0.393],
        [0.006, 0.019, 0.   , 0.144, 0.013, 0.016, 0.286, 0.516],
        [0.012, 0.04 , 0.   , 0.177, 0.023, 0.065, 0.098, 0.585],
        [0.024, 0.077, 0.   , 0.241, 0.037, 0.131, 0.091, 0.399],
        [0.027, 0.121, 0.   , 0.302, 0.025, 0.149, 0.084, 0.292],
        [0.014, 0.116, 0.   , 0.342, 0.008, 0.153, 0.129, 0.237],
        [0.011, 0.105, 0.   , 0.339, 0.026, 0.113, 0.107, 0.298],
        [0.005, 0.022, 0.   , 0.227, 0.08 , 0.035, 0.003, 0.627],
        [0.   , 0.   , 0.   , 0.001, 0.   , 0.   , 0.   , 0.999]],
       dtype=float32)}

In [24]:
import pickle


with open(, 'rb') as f:
    data = pickle.load(f)


---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-24-4e48a4656a12> in <module>
      3 
      4 with open('/Users/weilu/Research/Build/RaptorX-Contact/raptorx.uchicago.edu/pdb25-test-500.release.contactFeatures.pkl', 'rb') as f:
----> 5     data = pickle.load(f)

UnicodeDecodeError: 'ascii' codec can't decode byte 0x88 in position 4: ordinal not in range(128)

In [ ]:


In [22]:
np.load("/Users/weilu/Research/Build/RaptorX-Contact/raptorx.uchicago.edu/pdb25-test-500.release.contactFeatures.pkl")


---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
~/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
    439             try:
--> 440                 return pickle.load(fid, **pickle_kwargs)
    441             except Exception:

UnicodeDecodeError: 'ascii' codec can't decode byte 0x88 in position 4: ordinal not in range(128)

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-22-8dbae0f71845> in <module>
----> 1 np.load("/Users/weilu/Research/Build/RaptorX-Contact/raptorx.uchicago.edu/pdb25-test-500.release.contactFeatures.pkl")

~/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
    441             except Exception:
    442                 raise IOError(
--> 443                     "Failed to interpret file %s as a pickle" % repr(file))
    444     finally:
    445         if own_fid:

OSError: Failed to interpret file '/Users/weilu/Research/Build/RaptorX-Contact/raptorx.uchicago.edu/pdb25-test-500.release.contactFeatures.pkl' as a pickle

In [13]:
seq[60]


Out[13]:
'1'

In [14]:
seq[59:76]


Out[14]:
'01111111111111110'

In [15]:
seq[75]


Out[15]:
'0'

In [16]:
seq[74]


Out[16]:
'1'

In [ ]: