Skip to content

Commit 1fff362

Browse files
committed
Add dedicated Promotech runtime
1 parent dad5537 commit 1fff362

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,20 @@ RUN /opt/miniforge/bin/conda create -y -p /opt/biotools \
6161
perl-dbi perl-lwp-simple perl-dbd-sqlite \
6262
&& /opt/miniforge/bin/conda clean -afy
6363

64+
RUN /opt/miniforge/bin/conda create -y -p /opt/promotech \
65+
-c conda-forge -c bioconda \
66+
python=3.8 \
67+
numpy=1.19.5 \
68+
pandas=1.1.5 \
69+
joblib=0.17.0 \
70+
scikit-learn=0.23.2 \
71+
biopython=1.78 \
72+
progressbar2 \
73+
&& /opt/miniforge/bin/conda clean -afy \
74+
&& /opt/promotech/bin/python -c 'import numpy, pandas, joblib, Bio, progressbar, sklearn; assert sklearn.__version__.startswith("0.23")'
75+
6476
ENV PATH="/opt/biotools/bin:${PATH}"
77+
ENV DNMB_PROMOTECH_PYTHON=/opt/promotech/bin/python
6578

6679
RUN mkdir -p ${DNMB_CACHE_ROOT}/db_modules/clean/split100 \
6780
&& /opt/biotools/bin/python -m venv ${DNMB_CACHE_ROOT}/db_modules/clean/split100/conda_env \

docker/verify-runtime.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ for mod in mods:
2525
__import__(mod)
2626
PY
2727

28+
test -x "${DNMB_PROMOTECH_PYTHON}"
29+
"${DNMB_PROMOTECH_PYTHON}" - <<'PY'
30+
import joblib
31+
import numpy
32+
import pandas
33+
import progressbar
34+
import sklearn
35+
from Bio import SeqIO
36+
37+
assert sklearn.__version__.startswith("0.23"), sklearn.__version__
38+
PY
39+
2840
Rscript - <<'RS'
2941
required <- c(
3042
"DNMB", "dplyr", "ggplot2", "ggtext", "openxlsx",
@@ -47,6 +59,22 @@ if (any(promotech_bad)) {
4759
)
4860
}
4961
62+
promotech_python <- DNMB:::.dnmb_promotech_resolve_python("python3")
63+
promotech_model <- file.path(
64+
Sys.getenv("DNMB_CACHE_ROOT"),
65+
"db_modules", "promotech", "current", "Promotech", "models", "RF-HOT.model"
66+
)
67+
if (file.exists(promotech_model)) {
68+
model_load <- DNMB:::dnmb_run_external(
69+
promotech_python,
70+
args = c("-c", "import joblib, sys; joblib.load(sys.argv[1])", promotech_model),
71+
required = FALSE
72+
)
73+
if (!isTRUE(model_load$ok)) {
74+
stop("Promotech model load check failed: ", model_load$error, call. = FALSE)
75+
}
76+
}
77+
5078
acr_module <- DNMB:::dnmb_acrfinder_get_module(cache_root = Sys.getenv("DNMB_CACHE_ROOT"), required = TRUE)
5179
inherited <- strsplit(Sys.getenv("PATH"), .Platform$path.sep, fixed = TRUE)[[1]]
5280
acr_env_python <- if (!is.null(acr_module$files$env_python)) acr_module$files$env_python else ""

0 commit comments

Comments
 (0)