diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-09-06 13:11:35 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-09-06 13:11:35 +0530 |
commit | fa85cab1989bb91fbc87fe033f29ca51d25a3cab (patch) | |
tree | 61ffcbbd6fe82946c21e63d21ab23fef92b27550 /app/dock_docker.py | |
parent | eea75e4271334c97182973635a34a93458d6b83a (diff) | |
parent | 83dd77a98d2db3ea47be9c7c5f250487b9d8a4ac (diff) |
Merge branch 'master' of https://github.com/navanchauhan/Curie-Web
Diffstat (limited to 'app/dock_docker.py')
-rw-r--r-- | app/dock_docker.py | 27 |
1 files changed, 27 insertions, 0 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)) |