Commit 51214549 by Yasser Mohseni

Updates

parent 4634bc03
......@@ -10,6 +10,7 @@ import re
import os
import sys
from os import path, remove
import glob
sys.path.insert(1, '../lib/')
import tools as tl
......@@ -178,7 +179,15 @@ def rimcoresup(rsa_rec,rsa_lig,rsa_complex):
return rim, core, support
def get_scr(rec, lig, com, name):
#print('rec', path.basename(rec.replace('pdb', 'rsa')))
if tl.USE_FREESASA:
cmdcompl=tl.NACCESS_PATH + ' --format=rsa ' + com + ' > ' + path.basename(com.replace('pdb', 'rsa'))
os.system(cmdcompl)
cmdrec=tl.NACCESS_PATH + ' --format=rsa ' + rec + ' > ' + path.basename(rec.replace('pdb', 'rsa'))
os.system(cmdrec)
cmdlig=tl.NACCESS_PATH + ' --format=rsa ' + lig + ' > ' + path.basename(lig.replace('pdb', 'rsa'))
os.system(cmdlig)
else:
cmdcompl=tl.NACCESS_PATH + ' ' + com
os.system(cmdcompl)
cmdrec=tl.NACCESS_PATH + ' ' + rec
......@@ -198,15 +207,32 @@ def get_scr(rec, lig, com, name):
outprimcoresup.write(str((' '.join(map(str,elementsup)))+" S")+"\n") #Support
outprimcoresup.close()
remove(path.basename(rec.replace('pdb', 'rsa')))
remove(path.basename(rec.replace('pdb', 'asa')))
remove(path.basename(rec.replace('pdb', 'log')))
remove(path.basename(lig.replace('pdb', 'rsa')))
remove(path.basename(lig.replace('pdb', 'asa')))
remove(path.basename(lig.replace('pdb', 'log')))
for f in glob.glob("*.rsa"):
try:
remove(f)
except:
continue
for f in glob.glob("*.asa"):
try:
remove(f)
except:
continue
"""
remove(path.basename(rec.replace('pdb', 'rsa')))
remove(path.basename(lig.replace('pdb', 'rsa')))
remove(path.basename(com.replace('pdb', 'rsa')))
remove(path.basename(rec.replace('pdb', 'asa')))
remove(path.basename(lig.replace('pdb', 'asa')))
remove(path.basename(com.replace('pdb', 'asa')))
"""
try:
remove(path.basename(rec.replace('pdb', 'log')))
remove(path.basename(lig.replace('pdb', 'log')))
remove(path.basename(com.replace('pdb', 'log')))
except:
pass
########################
\ No newline at end of file
......@@ -39,20 +39,23 @@ from sklearn.metrics import mean_squared_error, accuracy_score, roc_auc_score, r
from sklearn.preprocessing import MinMaxScaler
import pickle
sys.path.insert(1, '../lib/')
import tools as tl
print('Your python version: {}'.format(sys.version_info.major))
USE_TENSORFLOW_AS_BACKEND = True
# IF YOU *DO* HAVE AN Nvidia GPU on your computer, or execute on Google COLAB, then change below to False!
FORCE_CPU = False #False
if USE_TENSORFLOW_AS_BACKEND:
os.environ['KERAS_BACKEND'] = 'tensorflow'
else:
os.environ['KERAS_BACKEND'] = 'theano'
if FORCE_CPU:
if tl.FORCE_CPU:
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"] = ""
if USE_TENSORFLOW_AS_BACKEND == True:
import tensorflow as tf
print('Your tensorflow version: {}'.format(tf.__version__))
if not tl.FORCE_CPU:
print("GPU : "+tf.test.gpu_device_name())
physical_devices = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], True)
......@@ -67,6 +70,7 @@ logging.Logger
seed(int(np.round(np.random.random()*10)))
#################################################################################################
"""
def save_obj(obj, name):
with open(name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
......@@ -74,6 +78,7 @@ def save_obj(obj, name):
def load_obj(name):
with open(name + '.pkl', 'rb') as f:
return pickle.load(f)
"""
v_dim = 24
......@@ -93,7 +98,7 @@ def load_map(sample_path):
sample_path
],
stdout=sys.stdout)
X_train, y_train, reg_type, res_pos,_,info = load_obj(sample_path.replace('.pkl.lz4',''))
X_train, y_train, reg_type, res_pos,_,info = tl.load_obj(sample_path.replace('.pkl.lz4',''))
remove(sample_path.replace('.lz4',''))
return X_train, y_train, reg_type, res_pos, info
......
......@@ -24,8 +24,10 @@ import sys
import gzip
#========================================================
#NACCESS
FORCE_CPU = False # IF YOU *DO* HAVE AN Nvidia GPU on your computer, or execute on Google COLAB, then change this option to False!
USE_FREESASA = True
NACCESS_PATH='naccess'
FreeSASA_PATH='freesasa'
#========================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment