Docker Tutorial¶
spMetaTME is distributed with a Docker environment to ensure that all dependencies (Python, R for domain clustering, PyTorch Geometric) are exactly as needed. This is the simplest way to get up and running if you have Docker and an NVIDIA GPU.
Prerequisites¶
Docker Installed: Follow instructions on Docker’s website.
NVIDIA Container Toolkit (Optional but recommended): For using GPUs inside Docker. See instructions here.
Building the Image¶
If you want to build the spmetatme image from source:
Clone the repository:
git clone https://github.com/SurajRepo/spmetatme.git cd spmetatme
Build the Docker image:
docker build -t spmetatme:latest .
Basic Usage¶
The Docker image uses the spmetatme CLI as its entry point. You can run any subcommand directly.
Get Help¶
docker run --rm spmetatme --help
Inference Help¶
docker run --rm spmetatme infer --help
Working with Local Data¶
Since the container has its own isolated file system, you must mount your local directory to the container’s /app directory to analyze your files. Select –model-species human or mouse based on your data. and –metabolic-model based on the model you want to use.
Windows (PowerShell/CMD)¶
Use the %CD% variable to mount your current folder:
docker run --rm -it --gpus all -v "%CD%:/app" spmetatme infer --input data/my_sample.h5ad --model-species human --metabolic-model breast_cancer
Linux / Mac¶
Use the $(pwd) variable to mount your current folder:
docker run --rm -it --gpus all -v $(pwd):/app spmetatme infer --input data/my_sample.h5ad --model-species human --metabolic-model breast_cancer
Understanding the Flags:¶
--gpus all: Enables GPU acceleration inside the container (highly recommended).-v "%CD%:/app": Binds your local folder to the container’s work directory. Data and results are shared.-it: Enables interactive mode so you can see live logs.--rm: Automatically removes the container after it stops.
Windows Helper: run_docker.cmd¶
For Windows users, we provide a pre-configured script (run_docker.cmd) in the repository to simplify these commands.
Example Inference:
run_docker.cmd infer --input data/CID4535.h5ad --model-species human --metabolic-model breast_cancer
Example Pretraining:
run_docker.cmd pretrain --training-list data/*.h5ad --metabolic-model breast_cancer --repo-id MyRepo/v1
Advanced: Accessing the Container Shell¶
If you want to explore the container manually:
docker run --rm -it --gpus all -v "%CD%:/app" --entrypoint bash spmetatme
Once inside, you can run spmetatme or standard Python commands manually.