aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-09-02 17:25:51 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-09-02 17:25:51 +0530
commitfe85d961d53920aad72df0f92d7159865d34484c (patch)
tree992a732e3e79cd80bbebe8690f4a1afacc58c535
parentc6630b41a05b51bdebfeb253935163647b76834c (diff)
updated dock docker
-rw-r--r--app/dock_docker.py27
-rw-r--r--requirements.txt1
2 files changed, 27 insertions, 1 deletions
diff --git a/app/dock_docker.py b/app/dock_docker.py
index 1c60a3b..a36648e 100644
--- a/app/dock_docker.py
+++ b/app/dock_docker.py
@@ -45,6 +45,20 @@ def email(zipArchive):
s.sendmail(fromaddr, toaddr, text)
s.quit()
+def get3DModel(protein,ligand):
+ try:
+ import pymol2
+ except ImportError:
+ print("🤭 PyMOL 2 has not been installed correctly")
+ return None
+ session = pymol2.PyMOL()
+ session.start()
+ cmd = session.cmd
+ cmd.load(protein,"target")
+ cmd.load(ligand,"ligand")
+ cmd.save("model.dae")
+ session.stop()
+
receptor_name = "protein.pdbqt"
ligand_name = "ligand.pdbqt"
description = "Curie Web Task"
@@ -68,6 +82,7 @@ import os
cd = os.getcwd()
f = os.path.join(cd,"static/uploads")
reportDirectory = os.path.join(f,"reports")
+modelDirectory = os.path.join(f,"3DModels")
#t = os.path.join(f,"receptor",target)
#r = os.path.join(f,"ligands",ligand)
#c = os.path.join(f,"configs",config)
@@ -94,6 +109,18 @@ with tempfile.TemporaryDirectory() as directory:
make_archive(zi, 'zip', directory)
#copy(("Curie_Web_Result_"+str(jobID)),f)
copyfile("report.pdf",os.path.join(reportDirectory,(str(jobID)+".pdf")))
+ get3DModel(receptor_name,ligand_name.replace(".pdbqt","_out.pdbqt"))
+ os.system("collada2gltf -i model.dae -o model.gltf")
+ copyfile("model.gltf",os.path.join(modelDirectory,(str(jobID)+".gltf")))
+ arch = os.popen("uname -m").read()
+ if "x86" in arch:
+ os.system("docker run -it --rm -v $(pwd):/usr/app leon/usd-from-gltf:latest model.gltf model.usdz")
+ elif "aarch64" in arch:
+ os.system("docker run -it --rm -v $(pwd):/usr/app navanchauhan/usd-from-gltf:latest model.gltf model.usdz")
+ try:
+ copyfile("model.usdz",os.path.join(modelDirectory,(str(jobID)+".usdz")))
+ except:
+ print("Could not generate USDZ file")
email(zi)
#print((str(zi) + ".zip"))
mycursor.execute('UPDATE curieweb set done=1 where id="%s"' % (jobID))
diff --git a/requirements.txt b/requirements.txt
index 8fb62fd..8d95f68 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -13,7 +13,6 @@ untangle
mysql_connector
mysql
uvicorn
-tensorflow-cpu==2.2.0
bunch
tqdm
prettytable