updated dock docker

This commit is contained in:
Navan Chauhan 2020-09-02 17:25:51 +05:30
parent c6630b41a0
commit fe85d961d5
2 changed files with 27 additions and 1 deletions

View File

@ -45,6 +45,20 @@ def email(zipArchive):
s.sendmail(fromaddr, toaddr, text) s.sendmail(fromaddr, toaddr, text)
s.quit() 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" receptor_name = "protein.pdbqt"
ligand_name = "ligand.pdbqt" ligand_name = "ligand.pdbqt"
description = "Curie Web Task" description = "Curie Web Task"
@ -68,6 +82,7 @@ import os
cd = os.getcwd() cd = os.getcwd()
f = os.path.join(cd,"static/uploads") f = os.path.join(cd,"static/uploads")
reportDirectory = os.path.join(f,"reports") reportDirectory = os.path.join(f,"reports")
modelDirectory = os.path.join(f,"3DModels")
#t = os.path.join(f,"receptor",target) #t = os.path.join(f,"receptor",target)
#r = os.path.join(f,"ligands",ligand) #r = os.path.join(f,"ligands",ligand)
#c = os.path.join(f,"configs",config) #c = os.path.join(f,"configs",config)
@ -94,6 +109,18 @@ with tempfile.TemporaryDirectory() as directory:
make_archive(zi, 'zip', directory) make_archive(zi, 'zip', directory)
#copy(("Curie_Web_Result_"+str(jobID)),f) #copy(("Curie_Web_Result_"+str(jobID)),f)
copyfile("report.pdf",os.path.join(reportDirectory,(str(jobID)+".pdf"))) 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) email(zi)
#print((str(zi) + ".zip")) #print((str(zi) + ".zip"))
mycursor.execute('UPDATE curieweb set done=1 where id="%s"' % (jobID)) mycursor.execute('UPDATE curieweb set done=1 where id="%s"' % (jobID))

View File

@ -13,7 +13,6 @@ untangle
mysql_connector mysql_connector
mysql mysql
uvicorn uvicorn
tensorflow-cpu==2.2.0
bunch bunch
tqdm tqdm
prettytable prettytable