Skip to content

Instantly share code, notes, and snippets.

View josejimenezluna's full-sized avatar
💃

José Jiménez-Luna josejimenezluna

💃
View GitHub Profile
def get_protein_features(usercoords, usercenters, userchannels, rotate_over=None, boxsize=[BOXSIZE]*3):
"""
Featurizes protein pocket using 3D voxelization
"""
if rotate_over is not None:
alpha = np.random.uniform(0, 2 * np.pi)
beta = np.random.uniform(0, 2 * np.pi)
gamma = np.random.uniform(0, 2 * np.pi)
usercoords = (usercoords.squeeze() - rotate_over)
import numpy as np
from numpy.linalg import norm, solve
from scipy.spatial.distance import cdist
from sklearn.neighbors import kneighbors_graph
def phi(l, mu):
return (mu * (np.sqrt(l) - 1)**2)
def parse(process):
out = process.stdout.decode('utf8')
out = out.split('\n')
for line in out:
if line[:2] == 'HP':
hp = float(line.split('=')[1])
elif line[:2] == 'HM':
hm = float(line.split('=')[1])
elif line[:2] == 'HS':
hs = float(line.split('=')[1])
@josejimenezluna
josejimenezluna / pdbqtcrash.py
Created June 22, 2017 09:42
PDBQT Reader Crash
from htmd.molecule.molecule import Molecule
target = '/shared/jose/databases/bindingdb_val/3IBU/target_0.pdbqt'
mol = Molecule(target)
import numpy as np
from pyGPGO.covfunc import matern32
from pyGPGO.acquisition import Acquisition
from pyGPGO.surrogates.GaussianProcess import GaussianProcess
from pyGPGO.GPGO import GPGO
def f(x, y):
# Franke's function (https://www.mathworks.com/help/curvefit/franke.html)
one = 0.75 * np.exp(-(9 * x - 2) ** 2 / 4 - (9 * y - 2) ** 2 / 4)
import numpy as np
from pyGPGO.covfunc import matern32
from pyGPGO.acquisition import Acquisition
from pyGPGO.surrogates.GaussianProcess import GaussianProcess
from pyGPGO.GPGO import GPGO
def f(x, y):
# Franke's function (https://www.mathworks.com/help/curvefit/franke.html)
one = 0.75 * np.exp(-(9 * x - 2) ** 2 / 4 - (9 * y - 2) ** 2 / 4)
def pairCor(distances, bins = 50):
distances = distances.flatten()
c, breaks = np.histogram(distances, bins = bins)
dr = breaks[1] - breaks[0]
N = len(distances)
V = 4 * np.pi* breaks**2 * dr
rho = N/(np.max(V))
c = c/N
c = c/V[:bins]