Commit 51214549 by Yasser Mohseni

Updates

parent 4634bc03
...@@ -10,6 +10,7 @@ import re ...@@ -10,6 +10,7 @@ import re
import os import os
import sys import sys
from os import path, remove from os import path, remove
import glob
sys.path.insert(1, '../lib/') sys.path.insert(1, '../lib/')
import tools as tl import tools as tl
...@@ -178,13 +179,21 @@ def rimcoresup(rsa_rec,rsa_lig,rsa_complex): ...@@ -178,13 +179,21 @@ def rimcoresup(rsa_rec,rsa_lig,rsa_complex):
return rim, core, support return rim, core, support
def get_scr(rec, lig, com, name): def get_scr(rec, lig, com, name):
#print('rec', path.basename(rec.replace('pdb', 'rsa')))
cmdcompl=tl.NACCESS_PATH + ' ' + com if tl.USE_FREESASA:
os.system(cmdcompl) cmdcompl=tl.NACCESS_PATH + ' --format=rsa ' + com + ' > ' + path.basename(com.replace('pdb', 'rsa'))
cmdrec=tl.NACCESS_PATH + ' ' + rec os.system(cmdcompl)
os.system(cmdrec) cmdrec=tl.NACCESS_PATH + ' --format=rsa ' + rec + ' > ' + path.basename(rec.replace('pdb', 'rsa'))
cmdlig=tl.NACCESS_PATH + ' ' + lig os.system(cmdrec)
os.system(cmdlig) 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
os.system(cmdrec)
cmdlig=tl.NACCESS_PATH + ' ' + lig
os.system(cmdlig)
# ('GLN', 'B', '44', '55.7', 'receptor') # ('GLN', 'B', '44', '55.7', 'receptor')
rim,core,support = rimcoresup(path.basename(rec.replace('pdb', 'rsa')), path.basename(lig.replace('pdb', 'rsa')), path.basename(com.replace('pdb', 'rsa'))) rim,core,support = rimcoresup(path.basename(rec.replace('pdb', 'rsa')), path.basename(lig.replace('pdb', 'rsa')), path.basename(com.replace('pdb', 'rsa')))
...@@ -198,15 +207,32 @@ def get_scr(rec, lig, com, name): ...@@ -198,15 +207,32 @@ def get_scr(rec, lig, com, name):
outprimcoresup.write(str((' '.join(map(str,elementsup)))+" S")+"\n") #Support outprimcoresup.write(str((' '.join(map(str,elementsup)))+" S")+"\n") #Support
outprimcoresup.close() 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'))) for f in glob.glob("*.rsa"):
remove(path.basename(lig.replace('pdb', 'asa'))) try:
remove(path.basename(lig.replace('pdb', 'log'))) 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(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'))) remove(path.basename(com.replace('pdb', 'asa')))
remove(path.basename(com.replace('pdb', 'log'))) """
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,23 +39,26 @@ from sklearn.metrics import mean_squared_error, accuracy_score, roc_auc_score, r ...@@ -39,23 +39,26 @@ from sklearn.metrics import mean_squared_error, accuracy_score, roc_auc_score, r
from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import MinMaxScaler
import pickle import pickle
sys.path.insert(1, '../lib/')
import tools as tl
print('Your python version: {}'.format(sys.version_info.major)) print('Your python version: {}'.format(sys.version_info.major))
USE_TENSORFLOW_AS_BACKEND = True 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: if USE_TENSORFLOW_AS_BACKEND:
os.environ['KERAS_BACKEND'] = 'tensorflow' os.environ['KERAS_BACKEND'] = 'tensorflow'
else: else:
os.environ['KERAS_BACKEND'] = 'theano' 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_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"] = "" os.environ["CUDA_VISIBLE_DEVICES"] = ""
if USE_TENSORFLOW_AS_BACKEND == True: if USE_TENSORFLOW_AS_BACKEND == True:
import tensorflow as tf import tensorflow as tf
print('Your tensorflow version: {}'.format(tf.__version__)) print('Your tensorflow version: {}'.format(tf.__version__))
print("GPU : "+tf.test.gpu_device_name()) if not tl.FORCE_CPU:
physical_devices = tf.config.experimental.list_physical_devices('GPU') print("GPU : "+tf.test.gpu_device_name())
tf.config.experimental.set_memory_growth(physical_devices[0], True) physical_devices = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], True)
else: else:
import theano import theano
print('Your theano version: {}'.format(theano.__version__)) print('Your theano version: {}'.format(theano.__version__))
...@@ -67,6 +70,7 @@ logging.Logger ...@@ -67,6 +70,7 @@ logging.Logger
seed(int(np.round(np.random.random()*10))) seed(int(np.round(np.random.random()*10)))
################################################################################################# #################################################################################################
"""
def save_obj(obj, name): def save_obj(obj, name):
with open(name + '.pkl', 'wb') as f: with open(name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL) pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
...@@ -74,6 +78,7 @@ def save_obj(obj, name): ...@@ -74,6 +78,7 @@ def save_obj(obj, name):
def load_obj(name): def load_obj(name):
with open(name + '.pkl', 'rb') as f: with open(name + '.pkl', 'rb') as f:
return pickle.load(f) return pickle.load(f)
"""
v_dim = 24 v_dim = 24
...@@ -93,7 +98,7 @@ def load_map(sample_path): ...@@ -93,7 +98,7 @@ def load_map(sample_path):
sample_path sample_path
], ],
stdout=sys.stdout) 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','')) remove(sample_path.replace('.lz4',''))
return X_train, y_train, reg_type, res_pos, info return X_train, y_train, reg_type, res_pos, info
......
...@@ -24,8 +24,10 @@ import sys ...@@ -24,8 +24,10 @@ import sys
import gzip 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' 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