Installation Guide¶
PBI-Scope is designed to run with Docker.
Requirements¶
- Docker 20.10+
- Docker Compose 2+
- 225+ GB free disk
- 16 GB RAM minimum (32 GB recommended)
1) Clone and configure¶
git clone https://github.com/ThibaultSchowing/PBI-Scope.git
cd PBI-Scope
# Copy the example env file and open it to fill in NCBI credentials:
cp .env.example .env
# Set NCBI_EMAIL=your.email@example.com (and NCBI_API_KEY if you have one)
# Append your host UID and GID so containers write files as your user (not root):
echo "UID=$(id -u)" >> .env
echo "GID=$(id -g)" >> .env
Why UID/GID? Docker containers run as root by default. Without this, files written to bind-mounted directories (
./notebooks,./outputs,./pipeline_logs) are owned by root and requiresudoto delete or edit. SettingUID/GIDmakes containers run as your host user so all output files belong to you.On macOS with Docker Desktop this is handled transparently — setting the values is still safe and recommended for portability.
2) Run pipeline¶
First run takes hours
On the first execution, downloading public data, resolving/downloading host genomes, merging files, and building BLAST databases are time-consuming operations (often 10+ hours depending on data size and network). The pipeline is not stalled — it is processing large genomic files. Subsequent runs are much faster as they reuse cached data.
Pipeline order:
- public phage download + merge
- private source validation/ingestion (if present)
- host resolution/download from NCBI
- database + indexes + GFF3 + reports
- BLAST database build (phages, proteins, hosts, private, combined)
3) Start analysis container¶
Port mapping — quick reference | Scope | Port | Where it is defined | |-------|------|---------------------| | Inside container |
8888|Dockerfile.analysis:57(EXPOSE 8888) ·Dockerfile.analysis:100(--port=8888) ·entrypoint.analysis.sh:33(--port=8888) · healthcheckDockerfile.analysis:88(curl http://localhost:8888/api) | | On host (mapped) |8886|docker-compose.yml:69("8886:8888"→host:container) | Host8886→ container8888. If8886is already in use on the host, change the left side indocker-compose.yml:69(e.g."8887:8888") and use that host port in the URL/tunnel below. Jupyter is always8888inside the container.⚠️ Security note: The analysis container starts Jupyter Lab with authentication and XSRF protection disabled — this is intentional for local/SSH-tunnelled development. See the Analysis Container Guide for a full explanation and hardening steps before exposing the service to a network.
If remote, use an SSH tunnel (safe because traffic stays inside the encrypted SSH connection):
# host 8886 (docker-compose.yml:69) → container 8888 (Dockerfile.analysis:57)
# forward remote host:8886 to local 8888:
ssh -L 8888:localhost:8886 user@server
# if you changed the host port to 8887 in docker-compose.yml:69, use instead:
# ssh -L 8888:localhost:8887 user@server
Then open http://localhost:8888 (or http://localhost:8887 if you used the 8887:8888 mapping / 8887:localhost:8887 tunnel).
4) Start API container (optional)¶
The REST API provides a lightweight interface for querying the database without the full pbi package. It supports metadata queries, single sequence retrieval, and SQL exploration.
API is available at http://localhost:8000. See API Reference for endpoints.
Preferred analysis access¶
- Preferred: VS Code + Dev Containers attached to the running
analysisservice — provides a full IDE workflow. See Analysis Container Guide for local and remote connection instructions. - Stable fallback: Jupyter Lab on
http://localhost:8888locally (http://localhost:8886on the server host viadocker-compose.yml:698886:8888→ssh -L 8888:localhost:8886 user@server). If you remapped the host port to8887, usehttp://localhost:8887/ssh -L 8887:localhost:8887. - API: Quick exploration and metadata lookups without loading the full package.
OOM caution¶
For large joins/sequence retrieval, use chunked queries and avoid loading very large tables into memory in a single cell.
Private data note¶
If you use private_data/ sources, see Private Data Ingestion for the required layout. Host FASTA files (hosts/<Host_ID>.fna) are only required when your metadata uses real Host_ID values — sources with Host_ID/Host_name set to unknown run in phage-only mode without a hosts/ directory.
Example data is ingested — remove it before running
The repository ships a synthetic example dataset (private_data/test_private/). Use it to observe the expected folder structure, then rename the folder, empty it, or delete it before running the pipeline — anything left in private_data/ WILL be ingested into your database.
Docker Services¶
PBI-Scope runs three Docker services:
| Service | Purpose | Host → Container Port |
|---|---|---|
pipeline |
Builds/updates the database | — |
analysis |
Read-only data access for users (preferred) — Jupyter Lab | 8886 → 8888 (docker-compose.yml:69 8886:8888; container 8888 defined in Dockerfile.analysis:57 EXPOSE 8888 / Dockerfile.analysis:100 --port=8888) |
api |
REST API for metadata queries, sequence retrieval, and SQL exploration | 8000 → 8000 (docker-compose.yml:44) |
Volumes and Mounts¶
+--------------------------- docker-compose ---------------------------+
| |
| named volume: pbi-data -> mounted at /data in all services |
| named volume: pbi-cache -> mounted at /cache in pipeline |
| |
| bind mount: ./private_data -> /private-data (rw pipeline, ro analysis)
| bind mount: ./pipeline_logs -> /pipeline-logs (rw pipeline, ro analysis)
| bind mount: ./notebooks -> /workspace (analysis)
| bind mount: ./outputs -> /results (analysis)
+---------------------------------------------------------------------+