added AR functionality

This commit is contained in:
Navan Chauhan 2020-08-30 22:24:16 +05:30
parent 6477097241
commit 422a7b2e72
10 changed files with 71160 additions and 1 deletions

View File

@ -90,6 +90,16 @@ def bounding_box(receptor, residues):
return {"size_x": SizeX, "size_y": SizeY, "size_z": SizeZ, "center_x": CenterX, "center_y": CenterY, "center_z": CenterZ} return {"size_x": SizeX, "size_y": SizeY, "size_z": SizeZ, "center_x": CenterX, "center_y": CenterY, "center_z": CenterZ}
def get3DModel(protein,ligand):
import pymol2
session = pymol2.PyMOL()
session.start()
cmd = session.cmd
cmd.load(protein,"target")
cmd.load(ligand,"ligand")
cmd.save("model.gltf")
session.stop()
def removeWater(pdbpath): def removeWater(pdbpath):
import pymol2 import pymol2
session = pymol2.PyMOL() session = pymol2.PyMOL()
@ -203,6 +213,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)
@ -230,6 +241,10 @@ with tempfile.TemporaryDirectory() as directory:
zi = os.path.join(f,z) zi = os.path.join(f,z)
make_archive(zi, 'zip', directory) make_archive(zi, 'zip', directory)
copyfile("report.pdf",os.path.join(reportDirectory,(str(jobID)+".pdf"))) copyfile("report.pdf",os.path.join(reportDirectory,(str(jobID)+".pdf")))
get3DModel(pdbpath,"%s_out.pdbqt"%(records[4]))
copyfile("model.gltf",os.path.join(modelDirectory,(str(jobID)+".gltf")))
os.system("docker run -it --rm -v $(PWD):/usr/app leon/usd-from-gltf:latest model.gltf model.usdz")
copyfile("model.usdz",os.path.join(modelDirectory,(str(jobID)+".usdz")))
#copy(("Curie_Web_Result_"+str(jobID)),f) #copy(("Curie_Web_Result_"+str(jobID)),f)
email(zi) email(zi)
#print((str(zi) + ".zip")) #print((str(zi) + ".zip"))

View File

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,14 +17,30 @@
border: none; border: none;
overflow: hidden; overflow: hidden;
} }
model-viewer {
width: 100%;
height: 400px;
}
</style> </style>
<p>A detailed zip file containing this PDF, along with all supporting files (configuration, pictures, protein-ligands e.t.c) to your email.</p> <p>A detailed zip file containing this PDF, along with all supporting files (configuration, pictures, protein-ligands e.t.c) to your email.</p>
<h3>AR Model</h3>
<section>
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.js"></script>
<script nomodule src="https://unpkg.com/@google/model-viewer/dist/model-viewer-legacy.js"></script>
<model-viewer src={{AndroidModel}} ios-src={{iOSModel}} ar="" auto-rotate="" camera-controls="" shadow-intensity="1" alt=”3D Model of your Docking Job></model-viewer>
</section>
<h3>PDF Report</h3> <h3>PDF Report</h3>
<section> <section>
<iframe src={{PDFReport}} id="report"></iframe> <iframe src={{PDFReport}} id="report"></iframe>
</section> </section>
{% endif %} {% endif %}
<section> <section>

View File

@ -104,8 +104,10 @@ def status():
protein_name = r[6] protein_name = r[6]
PDFReport = "/static/uploads/reports/" + str(jobID) + ".pdf" PDFReport = "/static/uploads/reports/" + str(jobID) + ".pdf"
AndroidModel = "/static/uploads/3DModels/" + str(jobID) + ".gltf"
iOSModel = "/static/uploads/3DModels/" + str(jobID) + ".usdz"
return render_template('job_status.html',ID=jobID,pn=protein_name,ln=ligand_name,subDate=date,desc=description,status=done,PDFReport=PDFReport) return render_template('job_status.html',ID=jobID,pn=protein_name,ln=ligand_name,subDate=date,desc=description,status=done,PDFReport=PDFReport,AndroidModel=AndroidModel,iOSModel=iOSModel)
flash_errors(taskStatusForm) flash_errors(taskStatusForm)
return render_template('job_status_form.html',form=taskStatusForm) return render_template('job_status_form.html',form=taskStatusForm)