Skip to content

Add Dockerfile for mfR module#114

Open
gbanco4 wants to merge 6 commits into
masterfrom
mfr/1.0
Open

Add Dockerfile for mfR module#114
gbanco4 wants to merge 6 commits into
masterfrom
mfr/1.0

Conversation

@gbanco4

@gbanco4 gbanco4 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator
  • Adds mfr/1.0/Dockerfile: a single combined R + Python/htslib container for the mfR lcr-module (hierarchical clustering of non-coding mutation positions into "foci"), built from condaforge/mambaforge:latest
  • Python side: python>=3.9, htslib (provides tabix, used for streaming per-chromosome MAF extraction)
  • One image is used for both the extraction and clustering rules in lcr-modules' mfR/1.0 — nothing requires them to run in separate environments, and the combined env solves cleanly with no package conflicts
  • Adds mfr/1.0/run_tests.sh: Battenberg-style smoke tests (same pattern as sniffles/1.1/mosdepth/1.0) verifying Rscript and each R package load, and that python/tabix are on PATH. Verified locally against a real conda env built from this Dockerfile's exact package list, all seven checks pass.

Builds ghcr.io/lcr-bccrc/lcr-scripts/mfr:1.0, which lcr-modules' mfR/1.0 config/default.yaml already points at (see companion PR on lcr-modules).

During liftover tests, chain file downloads using curl were failing, causing the GitHub actions to fail. To fix this, I downloaded the chain files and placed them within liftover/1.0/data/ and symlinked these within 2.0/.

gbanco4 and others added 6 commits July 16, 2026 20:07
Builds ghcr.io/lcr-bccrc/lcr-scripts/mfr:1.0, referenced by both rules
in lcr-modules' mfR/1.0. R (clustering) and Python/htslib (tabix-based
MAF extraction) share one image since nothing requires them separate
and the combined env solves with no conflicts.
Battenberg-style checks (same pattern as sniffles/1.1 and mosdepth/1.0)
verifying Rscript and each R package (readr, dplyr, cluster, ggplot2)
load, and that python and tabix are on PATH. Verified against a real
conda env built from this Dockerfile's exact package list -- all seven
checks pass.
The build was failing on the chained `mamba clean --all --yes`: the
preceding `mamba install` transaction succeeds (all packages install
fine), but pulls in a newer libxml2 as a transitive dependency of
r-base/python/htslib than what condaforge/mambaforge:latest's base env
was originally linked against. mamba's own libmambapy extension is
linked against the original libxml2, so the *next* mamba invocation
(the chained `mamba clean`) fails at import time:
  ImportError: libxml2.so.2: cannot open shared object file

Since nothing downstream needs mamba to still work inside the built
image, cleaning the package cache via `rm -rf /opt/conda/pkgs/*`
avoids depending on a second mamba invocation entirely. This also
matches the majority pattern already used elsewhere in this repo
(mosdepth, sniffles, battenberg, starfish, etc.) -- this Dockerfile
was the outlier, having carried over `mamba clean` unreconsidered
from the original prototype.
Runs the same operations mfR's src/python/extract_chrom_maf.py and
src/R/cluster_foci.R perform (tabix per-chromosome extraction + coding-
variant filtering, then hierarchical clustering into foci) against
committed synthetic per-sample MAFs, comparing output to committed
golden files -- catches real output-correctness regressions, not just
"packages import" like the smoke test did.

This immediately caught a real bug: silhouette(lab, d) returns a bare
NA (not a matrix) when every cluster is a singleton, which happens at
h_min before any merge -- indexing NA[, "sil_width"] crashed uncaught.
Fixed here and in the lcr-modules source (companion commit).

ggplot2/cairo rendering is exercised (proves the plotting stack works)
but not included in the golden-file diff, since PDF output isn't
byte-stable across builds.
run_tests.sh was failing in CI when UCSC downloads were unavailable.
Read chain files from data/ (committed in a prior commit) instead,
and symlink liftover/2.0/data to the 1.0 copy, matching the existing
pattern for liftover.yaml and run_tests.sh.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant