Skip to content

Commit

Permalink
Update for super
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzzs committed Nov 23, 2023
1 parent cdd947b commit 89f5da1
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Docking/ProgressiveDocking/activation_script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo Activating virtual environment
source ~/.bashrc
conda activate DeepDockingRemote
conda activate app-deepdocking-gui-remote
2 changes: 1 addition & 1 deletion Docking/ProgressiveDocking/phase_2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ python $script_path/jobid_writer.py -file_path $project_path -n_it $iteration -j
# For some reason, running this with the conda environment activated causes an error.
# We must deactivate it before running!
source ~/.bashrc
source $local_path/deactivation_script.sh
source $script_path/deactivation_script.sh

# Move into the project
cd $project_path/iteration_$iteration
Expand Down
2 changes: 1 addition & 1 deletion Docking/ProgressiveDocking/phase_3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ python jobid_writer.py -file_path $project_path -n_it $iteration -jid $SLURM_JOB
cd $project_path/iteration_$iteration
echo Running Phase 3
mkdir res
for i in $(ls -d chunks_smi/*); do fld=$(echo $i | rev | cut -d'/' -f 1 | rev); mkdir res/$fld; cd res/$fld; sbatch $slurm_args_g $scripts/autodock_gpu_ad.sh 64 sw $PATH_FLD ../../$i'/'$fld'_'pdbqt list.txt $num_energy_evaluations $num_runs $path_to_auto_dock_gpu $scripts; cd ../../;done
for i in $(ls -d chunks_smi/*); do fld=$(echo $i | rev | cut -d'/' -f 1 | rev); mkdir res/$fld; cd res/$fld; sbatch $slurm_args_g $scripts/autodock_gpu_ad.sh 128 sw $PATH_FLD ../../$i'/'$fld'_'pdbqt list.txt $num_energy_evaluations $num_runs $path_to_auto_dock_gpu $scripts; cd ../../;done

cd $scripts
python phase_changer.py -pf phase_3.sh -itr $project_path/iteration_$iteration
Expand Down
4 changes: 4 additions & 0 deletions Docking/ProgressiveDocking/phase_a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ echo - Chunk Size: $chunk_size
echo - Percent First Mol: $percent_fist_mol
echo - Percent Last Mol: $percent_last_mol

# This should activate the conda environment
source ~/.bashrc
source $local_path/activation_script.sh

# Grab everything from the logs file
file_path=$(sed -n '1p' $2/$3/logs.txt)
protein=$(sed -n '2p' $2/$3/logs.txt)
Expand Down
2 changes: 1 addition & 1 deletion Docking/ProgressiveDocking/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def train_valid_test(file_name):

f_names = []
# Getting all the morgan_1024_predictions/smile_all_##.txt files
for f in glob.glob(data_directory+'/smile*_all_*.txt'):
for f in glob.glob(data_directory+'/*.txt'):
f_names.append(f)

print("num_f_names: ", len(f_names))
Expand Down
4 changes: 1 addition & 3 deletions GUI/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions GUI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
"scripts": {
"test": "mocha",
"start-lin": "export FLASK_APP=server.py && export FLASK_ENV=local_host && flask run",
"start-win": "conda activate DeepDockingLocal && set FLASK_APP=server.py && set FLASK_ENV=local_host && flask run",
"start-dev": "conda activate DeepDockingLocal && set FLASK_APP=server.py && set FLASK_ENV=development && set FLASK_DEBUG=1 && flask run",
"start-lin-global": "export FLASK_APP=server.py && export FLASK_ENV=local_host && flask run --host=0.0.0.0",
"start-win": "conda activate app-deepdocking-gui && set FLASK_APP=server.py && set FLASK_ENV=local_host && flask run",
"start-dev": "conda activate app-deepdocking-gui && set FLASK_APP=server.py && set FLASK_ENV=development && set FLASK_DEBUG=1 && flask run",
"build": "webpack --progress --config webpack.config.js",
"dev-build": "webpack -d --progress --config webpack.config.js"
},
Expand Down
20 changes: 10 additions & 10 deletions GUI/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
MODE_SCAFFOLD = None
PROJECTS_PATH = './src/backend/projects/'

# Launching the app automatically if prompted
if not app.debug:
# Ask user if they want to open the DD website automatically
prompt = "\nOpen Website On Default Browser? \nEnter y to launch or any other key to open manually: "
open_site = True if input(prompt).rstrip() == "y" else False
if open_site:
import webbrowser
webbrowser.open("http://127.0.0.1:5000/")
else:
print("Enter the provided link into your browser.")
# # Launching the app automatically if prompted
# if not app.debug:
# # Ask user if they want to open the DD website automatically
# prompt = "\nOpen Website On Default Browser? \nEnter y to launch or any other key to open manually: "
# open_site = True if input(prompt).rstrip() == "y" else False
# if open_site:
# import webbrowser
# webbrowser.open("http://127.0.0.1:5000/")
# else:
# print("Enter the provided link into your browser.")

def serve_pil_image(pil_img):
img_io = BytesIO()
Expand Down
14 changes: 12 additions & 2 deletions GUI/src/backend/auto_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class SSH:

""" This class will automatically ssh into the host cluster. """

def __init__(self, host=None):
def __init__(self, host=None, port=None):
if host is None:
try:
json_str = open('src/backend/db.json').read() # TODO: Sibling files not recognizing each other when called from another file path.
Expand All @@ -16,9 +16,19 @@ def __init__(self, host=None):
except FileNotFoundError as e:
print(e.__traceback__, "'db.json' not found! Please run the installation first before running GUI.")
raise e

if port is None:
try:
json_str = open('src/backend/db.json').read() # TODO: Sibling files not recognizing each other when called from another file path.
db_dict = json.loads(json_str)
port = db_dict['port']
except FileNotFoundError as e:
print(e.__traceback__, "'db.json' not found! Please run the installation first before running GUI.")
raise e

# The information that will allow for ssh
self.host = host
self.port = port
self.user = ""
self.pwrd = ""
self.ssh = None
Expand All @@ -40,7 +50,7 @@ def connect(self, username, password):
# Connect to ssh and set out ssh object
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(self.host, username=self.user, password=self.pwrd)
ssh.connect(self.host, port=self.port, username=self.user, password=self.pwrd)
self.ssh = ssh

def download(self, remote_path, local_path):
Expand Down
3 changes: 2 additions & 1 deletion GUI/src/backend/backend_sanity_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ def check_backend():
json_str = open('src/backend/db.json').read() # TODO: Sibling files not recognizing each other when called from another file path.
db_dict = json.loads(json_str)
ip = db_dict['ip']
port = db_dict.get['port']

user = input("cluster username: ")
password = input("cluster password: ")
ssh_connection = SSH(host=ip)
ssh_connection = SSH(host=ip, port=port)
ssh_connection.connect(username=user, password=password)
backend = Backend(ssh=ssh_connection)
return backend
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bash prepare_receptor.py receptor.pdb 'x_size,y_size,z_size' 'x_center,y_center,
- path_adt_scripts: path to folder with AutodockTools python scripts (prepare_receptor4.py, etc etc..)

## 1. Starting up the GUI
After installation, a new Conda environment on your local device called *DeepDockingLocal* should now be available. To start up the GUI, activate the *DeepDockingLocal* environment then navigate to `Deep-Docking/GUI` and run the appropriate command to start up the server.
After installation, a new Conda environment on your local device called *app-deepdocking-gui* should now be available. To start up the GUI, activate the *app-deepdocking-gui* environment then navigate to `Deep-Docking/GUI` and run the appropriate command to start up the server.

For mac and linux:
```bash
Expand All @@ -84,7 +84,7 @@ npm run start-win
After running the above, you should see something similar to the following:
```bash
> [email protected] start-win
> conda activate DeepDockingLocal && set FLASK_APP=server.py && set FLASK_ENV=local_host && flask run
> conda activate app-deepdocking-gui && set FLASK_APP=server.py && set FLASK_ENV=local_host && flask run

* Serving Flask app "server.py "
* Environment: local_host
Expand Down Expand Up @@ -178,7 +178,7 @@ From the top scoring tab (figure 7) we can download a list of the top 1000 molec
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' Object has no attribute 'decode'
```
>This error is followed by an `IndexError` on line 264 of `get_model_image` and is most likely a dependancy issue with keras, make sure you have version 2.10.0 of `h5py` (versions 3.0+ cause issues) installed on the cluster side in the `DeepDockingRemote` conda environment. You can check the version by first activating the conda environment and then typing `pip show h5py`.<br>
>This error is followed by an `IndexError` on line 264 of `get_model_image` and is most likely a dependancy issue with keras, make sure you have version 2.10.0 of `h5py` (versions 3.0+ cause issues) installed on the cluster side in the `app-deepdocking-gui-remote` conda environment. You can check the version by first activating the conda environment and then typing `pip show h5py`.<br>
>You can install/downgrade it using pip: `pip install h5py==2.10.0`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DeepDockingLocal
name: app-deepdocking-gui
channels:
- conda-forge
- bioconda
Expand Down
4 changes: 2 additions & 2 deletions installation/install-linux.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/bin/bash -l

# Create the local env
python3 install.py --phase install_local
# Activate the env
conda activate DeepDockingLocal 2> conda.out
conda activate app-deepdocking-gui 2> conda.out
# Install remote files and create remote env
python3 install.py --phase install_remote
2 changes: 1 addition & 1 deletion installation/install-windows.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
python install.py --phase install_local
call conda activate DeepDockingLocal > conda.out
call conda activate app-deepdocking-gui > conda.out
python install.py --phase install_remote
Loading

0 comments on commit 89f5da1

Please sign in to comment.