Merge branch 'master' of https://github.com/navanchauhan/Curie-Web
77
README.md
|
@ -4,15 +4,80 @@
|
||||||
![Database Tests](https://github.com/navanchauhan/Curie-Web/workflows/Test%20Database/badge.svg)
|
![Database Tests](https://github.com/navanchauhan/Curie-Web/workflows/Test%20Database/badge.svg)
|
||||||
[![DeepSource](https://static.deepsource.io/deepsource-badge-dark-mini.svg)](https://deepsource.io/gh/navanchauhan/Curie-Web/?ref=repository-badge)
|
[![DeepSource](https://static.deepsource.io/deepsource-badge-dark-mini.svg)](https://deepsource.io/gh/navanchauhan/Curie-Web/?ref=repository-badge)
|
||||||
|
|
||||||
|
Tested on:
|
||||||
|
* macOS 10.15 (Catalina)
|
||||||
|
* Ubuntu 20.04 - Raspberry Pi 4
|
||||||
|
|
||||||
**Do Not Forget To Change DB Host configuration!**
|
**Do Not Forget To Change DB Host configuration!**
|
||||||
|
|
||||||
|
## 1. Installing Dependencies
|
||||||
|
|
||||||
|
### 1.1 Docker
|
||||||
|
|
||||||
|
Once you have installed docker, make sure to pull the following images (Otherwise, these will automatically get downloaded when you run the web-server)
|
||||||
|
|
||||||
|
* navanchauhan/curie-cli (amd64/aarch64)
|
||||||
|
* navanchauhan/usd-from-gltf (aarch64)
|
||||||
|
* leon/usd-from-gltf (amd64)
|
||||||
|
|
||||||
|
### 1.2 PLIP
|
||||||
|
|
||||||
|
Install from [pharmai/plip](https://github.com/pharmai/plip).
|
||||||
|
|
||||||
|
In case you have problems installing it, install it from the forked repo [navanchauhan/plip](https://github.com/navanchauhan/plip)
|
||||||
|
|
||||||
|
### 1.3 PyMOL with Python Bindings (version >= 2.0)
|
||||||
|
|
||||||
|
* macOS users can use Homebrew to install it via `brew install pymol`
|
||||||
|
|
||||||
|
* Users using apt can install it via `sudo apt install pymol`
|
||||||
|
|
||||||
|
### 1.4 Open-Babel (version >= 3.0)
|
||||||
|
|
||||||
|
macOS users can use Homebrew to install it via `brew install open-babel`
|
||||||
|
|
||||||
|
Users using apt can install it via `sudo apt install openbabel python3-openbabel`
|
||||||
|
|
||||||
|
## 2. Changing the Configuration
|
||||||
|
|
||||||
|
Replace the values in `app/__init__.py`, `app/dock-single.py` and `app/dock-docker.py`
|
||||||
|
|
||||||
|
## 3. Enabling LSTM Generator
|
||||||
|
|
||||||
|
Open `app/views.py`
|
||||||
|
|
||||||
|
Make sure you have installed Tensorflow. Replace the following:
|
||||||
|
|
||||||
|
```python
|
||||||
|
tfWorking = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
with
|
||||||
|
|
||||||
|
```python
|
||||||
|
tfWorking = -1
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Adding AR Model Support
|
||||||
|
|
||||||
|
Make sure you have PyMOL 2.0 or higher
|
||||||
|
|
||||||
|
|
||||||
|
Either download the precompiled binaries from [COLLADA2GLTF](https://github.com/KhronosGroup/COLLADA2GLTF) or compile it on your own
|
||||||
|
|
||||||
|
|
||||||
|
Once you have the `COLLADA2GLTF-bin` file, run the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
export PATH=$PATH:/home/pi/Desktop/Curie-Web/app/src/scripts
|
cp COLLADA2GLTF-bin /usr/local/bin/collada2gltf
|
||||||
export PYTHONPATH=$PYTHONPATH:/home/pi/Desktop/Curie-Web/app/src
|
```
|
||||||
alias plip="python3 /home/pi/Desktop/Curie-Web/app/src/plip/plipcmd.py"
|
|
||||||
chmod +x /home/pi/Desktop/Curie-Web/app/src/scripts/*.sh
|
## Running
|
||||||
chmod +x /home/pi/Desktop/Curie-Web/app/src/scripts/*.py
|
|
||||||
```
|
### Without FastAPI
|
||||||
|
|
||||||
|
`gunicorn api:app -b "0.0.0.0:7589"`
|
||||||
|
|
||||||
|
### With FastAPI
|
||||||
|
|
||||||
|
`gunicorn api:app -k uvicorn.workers.UvicornWorker -b "0.0.0.0:7589"`
|
2
api.py
|
@ -18,7 +18,7 @@ def flask_main():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
app = FastAPI(title="Curie-API",
|
app = FastAPI(title="Curie-API",
|
||||||
description="API for accessing Curie-Web.",
|
description="API for accessing most of the features.",
|
||||||
version="0.1",)
|
version="0.1",)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,11 @@ with tempfile.TemporaryDirectory() as directory:
|
||||||
get3DModel(pdbpath,"%s_out.pdbqt"%(records[4]))
|
get3DModel(pdbpath,"%s_out.pdbqt"%(records[4]))
|
||||||
os.system("collada2gltf -i model.dae -o model.gltf")
|
os.system("collada2gltf -i model.dae -o model.gltf")
|
||||||
copyfile("model.gltf",os.path.join(modelDirectory,(str(jobID)+".gltf")))
|
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")
|
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:
|
try:
|
||||||
copyfile("model.usdz",os.path.join(modelDirectory,(str(jobID)+".usdz")))
|
copyfile("model.usdz",os.path.join(modelDirectory,(str(jobID)+".usdz")))
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -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))
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
import mysql.connector as con
|
|
||||||
|
|
||||||
mycon = con.connect(host="sql12.freesqldatabase.com",user="sql12352288",password="7X35JENbK3",port=3306,database="sql12352288")
|
|
||||||
mycursor = mycon.cursor()
|
|
||||||
|
|
||||||
sql_select_Query = "select * from curie where done=0 LIMIT 1"
|
|
||||||
mycursor.execute(sql_select_Query)
|
|
||||||
|
|
||||||
records = mycursor.fetchall()
|
|
||||||
|
|
||||||
def email(zipArchive):
|
|
||||||
import smtplib
|
|
||||||
from email.mime.multipart import MIMEMultipart
|
|
||||||
from email.mime.text import MIMEText
|
|
||||||
from email.mime.base import MIMEBase
|
|
||||||
from email import encoders
|
|
||||||
|
|
||||||
fromaddr = "navanchauhan@gmail.com"
|
|
||||||
toaddr = toEmail
|
|
||||||
|
|
||||||
msg = MIMEMultipart()
|
|
||||||
msg['From'] = fromaddr
|
|
||||||
msg['To'] = toaddr
|
|
||||||
msg['Subject'] = "Curie Web Results for Job ID " + str(jobID)
|
|
||||||
body = "Attached Zip contains the docked files, PLIP report and PyMOL Visualisations. If the ZIP file does not contain these files, please report this issue by replying to this email. Job was submitted on {} with the description {}".format(date, description)
|
|
||||||
|
|
||||||
msg.attach(MIMEText(body, 'plain'))
|
|
||||||
filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip"
|
|
||||||
p = MIMEBase('application', 'octet-stream')
|
|
||||||
with open((str(zipArchive) + ".zip"), "rb") as attachment:
|
|
||||||
p.set_payload((attachment).read())
|
|
||||||
encoders.encode_base64(p)
|
|
||||||
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
|
||||||
msg.attach(p)
|
|
||||||
|
|
||||||
s = smtplib.SMTP('smtp.gmail.com', 587)
|
|
||||||
s.starttls()
|
|
||||||
s.login(fromaddr, 'ircd mday avbc tice')
|
|
||||||
|
|
||||||
text = msg.as_string()
|
|
||||||
|
|
||||||
s.sendmail(fromaddr, toaddr, text)
|
|
||||||
s.quit()
|
|
||||||
|
|
||||||
|
|
||||||
print(records[0])
|
|
||||||
r = records[0]
|
|
||||||
jobID = r[0]
|
|
||||||
toEmail = r[1]
|
|
||||||
target = r[2]
|
|
||||||
ligand = r[3]
|
|
||||||
config = r[4]
|
|
||||||
date = r[5]
|
|
||||||
description = r[6]
|
|
||||||
|
|
||||||
import os
|
|
||||||
cd = os.getcwd()
|
|
||||||
f = os.path.join(cd,"static/uploads")
|
|
||||||
t = os.path.join(f,"receptor",target)
|
|
||||||
r = os.path.join(f,"ligands",ligand)
|
|
||||||
c = os.path.join(f,"configs",config)
|
|
||||||
print(f)
|
|
||||||
import tempfile
|
|
||||||
from shutil import copy
|
|
||||||
from shutil import make_archive
|
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as directory:
|
|
||||||
print('The created temporary directory is %s' % directory)
|
|
||||||
os.chdir(directory)
|
|
||||||
copy(t,os.getcwd())
|
|
||||||
copy(r,os.getcwd())
|
|
||||||
copy(c, os.getcwd())
|
|
||||||
os.system("docker run --rm -v ${PWD}:/results -w /results -u $(id -u ${USER}):$(id -g ${USER}) navanchauhan/curie-cli -r %s -l %s -c %s -dpi" % (target,ligand,config))
|
|
||||||
#copy("report.pdf",f)
|
|
||||||
z = "Curie_Web_Result_"+str(jobID)
|
|
||||||
zi = os.path.join(f,z)
|
|
||||||
make_archive(zi, 'zip', directory)
|
|
||||||
#copy(("Curie_Web_Result_"+str(jobID)),f)
|
|
||||||
email(zi)
|
|
||||||
#print((str(zi) + ".zip"))
|
|
||||||
mycursor.execute("UPDATE curie set done=1 where id={}".format(jobID))
|
|
||||||
mycon.commit()
|
|
|
@ -1,82 +0,0 @@
|
||||||
import mysql.connector as con
|
|
||||||
|
|
||||||
mycon = con.connect(host="sql12.freesqldatabase.com",user="sql12352288",password="7X35JENbK3",port=3306,database="sql12352288")
|
|
||||||
mycursor = mycon.cursor()
|
|
||||||
|
|
||||||
sql_select_Query = "select * from curie where done=0 LIMIT 1"
|
|
||||||
mycursor.execute(sql_select_Query)
|
|
||||||
|
|
||||||
records = mycursor.fetchall()
|
|
||||||
|
|
||||||
def email(zipArchive):
|
|
||||||
import smtplib
|
|
||||||
from email.mime.multipart import MIMEMultipart
|
|
||||||
from email.mime.text import MIMEText
|
|
||||||
from email.mime.base import MIMEBase
|
|
||||||
from email import encoders
|
|
||||||
|
|
||||||
fromaddr = "navanchauhan@gmail.com"
|
|
||||||
toaddr = toEmail
|
|
||||||
|
|
||||||
msg = MIMEMultipart()
|
|
||||||
msg['From'] = fromaddr
|
|
||||||
msg['To'] = toaddr
|
|
||||||
msg['Subject'] = "Curie Web Results for Job ID " + str(jobID)
|
|
||||||
body = "Attached Zip contains the docked files, PLIP report and PyMOL Visualisations. If the ZIP file does not contain these files, please report this issue by replying to this email. Job was submitted on {} with the description {}".format(date, description)
|
|
||||||
|
|
||||||
msg.attach(MIMEText(body, 'plain'))
|
|
||||||
filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip"
|
|
||||||
p = MIMEBase('application', 'octet-stream')
|
|
||||||
with open((str(zipArchive) + ".zip"), "rb") as attachment:
|
|
||||||
p.set_payload((attachment).read())
|
|
||||||
encoders.encode_base64(p)
|
|
||||||
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
|
||||||
msg.attach(p)
|
|
||||||
|
|
||||||
s = smtplib.SMTP('smtp.gmail.com', 587)
|
|
||||||
s.starttls()
|
|
||||||
s.login(fromaddr, 'ircd mday avbc tice')
|
|
||||||
|
|
||||||
text = msg.as_string()
|
|
||||||
|
|
||||||
s.sendmail(fromaddr, toaddr, text)
|
|
||||||
s.quit()
|
|
||||||
|
|
||||||
|
|
||||||
print(records[0])
|
|
||||||
r = records[0]
|
|
||||||
jobID = r[0]
|
|
||||||
toEmail = r[1]
|
|
||||||
target = r[2]
|
|
||||||
ligand = r[3]
|
|
||||||
config = r[4]
|
|
||||||
date = r[5]
|
|
||||||
description = r[6]
|
|
||||||
|
|
||||||
import os
|
|
||||||
cd = os.getcwd()
|
|
||||||
f = os.path.join(cd,"static/uploads")
|
|
||||||
t = os.path.join(f,"receptor",target)
|
|
||||||
r = os.path.join(f,"ligands",ligand)
|
|
||||||
c = os.path.join(f,"configs",config)
|
|
||||||
print(f)
|
|
||||||
import tempfile
|
|
||||||
from shutil import copy
|
|
||||||
from shutil import make_archive
|
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as directory:
|
|
||||||
print('The created temporary directory is %s' % directory)
|
|
||||||
os.chdir(directory)
|
|
||||||
copy(t,os.getcwd())
|
|
||||||
copy(r,os.getcwd())
|
|
||||||
copy(c, os.getcwd())
|
|
||||||
os.system("main_local.sh -r %s -l %s -c %s -dpi" % (target,ligand,config))
|
|
||||||
#copy("report.pdf",f)
|
|
||||||
z = "Curie_Web_Result_"+str(jobID)
|
|
||||||
zi = os.path.join(f,z)
|
|
||||||
make_archive(zi, 'zip', directory)
|
|
||||||
#copy(("Curie_Web_Result_"+str(jobID)),f)
|
|
||||||
email(zi)
|
|
||||||
#print((str(zi) + ".zip"))
|
|
||||||
mycursor.execute("UPDATE curie set done=1 where id={}".format(jobID))
|
|
||||||
mycon.commit()
|
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1014 B After Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 774 B |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 903 B After Width: | Height: | Size: 887 B |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 667 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 685 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.0 KiB |
|
@ -222,7 +222,8 @@ def dock_upload():
|
||||||
mycon.commit()
|
mycon.commit()
|
||||||
|
|
||||||
print("Description",description)
|
print("Description",description)
|
||||||
|
cwd = os.path.join(os.getcwd(),"app")
|
||||||
|
subprocess.Popen(['python3', 'dock-docker.py'],cwd=cwd)
|
||||||
return render_template('display_result.html', filename="OwO", description=description,job=jobID)
|
return render_template('display_result.html', filename="OwO", description=description,job=jobID)
|
||||||
|
|
||||||
flash_errors(form)
|
flash_errors(form)
|
||||||
|
|
|
@ -13,7 +13,6 @@ untangle
|
||||||
mysql_connector
|
mysql_connector
|
||||||
mysql
|
mysql
|
||||||
uvicorn
|
uvicorn
|
||||||
tensorflow-cpu==2.2.0
|
|
||||||
bunch
|
bunch
|
||||||
tqdm
|
tqdm
|
||||||
prettytable
|
prettytable
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
python-3.7.8
|
python-3.7.9
|
||||||
|
|