Skip to content

Commit

Permalink
Reinvent: Dockerfile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksashka11 committed Dec 26, 2024
1 parent f3e6e3b commit 9c75654
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
14 changes: 12 additions & 2 deletions packages/Chem/dockerfiles/reinvent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ WORKDIR /app
RUN git clone https://github.com/MolecularAI/REINVENT4.git && \
git clone https://github.com/MolecularAI/DockStream.git

RUN find /app/REINVENT4 -type f -exec sed -i 's/model_dump()/model_config/g' {} +
# Fix issues by modifying specific scripts in the REINVENT repository
# Replace calls to `model_dump()` with `model_config` due to compatibility problems
RUN find /app/REINVENT4/reinvent -type f \( -name "Reinvent.py" -o -name "run_staged_learning.py" \) \
-exec sed -i 's/model_dump()/model_config/g' {} +

COPY . /app

Expand All @@ -35,6 +38,7 @@ RUN python3.10 -m venv /app/venv && \
cd /app/REINVENT4 && \
/app/venv/bin/pip install --no-deps .

# Install Miniforge for macOS compatibility (handles macOS-specific Python environment issues)
RUN if [ "$(uname -m)" = "aarch64" ]; then \
curl -fsSL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh -o /tmp/miniforge.sh; \
else \
Expand All @@ -51,7 +55,13 @@ RUN conda update -n base -c defaults conda -y

WORKDIR /app/DockStream

RUN sed -i 's/python = 3.7/python = 3.10/' environment.yml
# Update DockStream environment file:
# - Change Python version to 3.10
# - Remove incompatible `pydantic` version and manually specify compatible version
RUN sed -i 's/python = 3.7/python = 3.10/' environment.yml && \
sed -i '/pydantic/d' environment.yml && \
sed -i '/dependencies:/a \ - pip' environment.yml && \
sed -i '/- pip/a \ - pip:\n - pydantic==1.10.19' environment.yml

RUN conda env create -f environment.yml && \
conda clean --all --yes
Expand Down
15 changes: 7 additions & 8 deletions packages/Chem/dockerfiles/reinvent/reinvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@

app = Flask(__name__)

# Configure logging
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[
logging.StreamHandler(sys.stdout) # Output logs to stdout for Docker compatibility
logging.StreamHandler(sys.stdout)
]
)

Expand Down Expand Up @@ -78,7 +77,7 @@ def run_reinvent():
device = "cpu"
"""

prior_filename = "/Users/aleksashka/REINVENT4/priors/mol2mol_similarity.prior"
prior_filename = f"/{current_directory}/REINVENT4/priors/mol2mol_similarity.prior"
parameters = f"""
[parameters]
prior_file = "{prior_filename}"
Expand All @@ -87,7 +86,7 @@ def run_reinvent():
sample_strategy = "multinomial"
smiles_file = "/{current_directory}/{smiles_filename}"
batch_size = 5
batch_size = 1
use_checkpoint = false
use_cuda = false
Expand All @@ -106,7 +105,7 @@ def run_reinvent():
[[stage]]
max_score = 1.0
max_steps = 25
max_steps = 1
chkpt_file = 'stage1.chkpt'
[stage.scoring]
Expand All @@ -117,9 +116,9 @@ def run_reinvent():
[[stage.scoring.component.DockStream.endpoint]]
name = "Docking with Dockstream"
weight = 1
params.configuration_path = "/Users/aleksashka/Desktop/AutoDock_Vina_demo/kras_docking.json"
params.docker_script_path = "/Users/aleksashka/DockStream/docker.py"
params.docker_python_path = "/opt/anaconda3/envs/DockStream/bin/python"
params.configuration_path = "/{current_directory}/kras_docking.json"
params.docker_script_path = "/{current_directory}/DockStream/docker.py"
params.docker_python_path = "/opt/conda/envs/DockStream/bin/python"
transform.type = "reverse_sigmoid"
transform.high = 0
transform.low = -10
Expand Down

0 comments on commit 9c75654

Please sign in to comment.