This service exposes a small FastAPI wrapper around the nf-core/diseasemodulediscovery Nextflow pipeline. It runs the pipeline in a container and stores each run under ${DATA_DIR}/runs/<run_id>/.
git clone https://github.com/REPO4EU/nextflow-api.git
cd nextflow-apiThe API expects the nf-core/diseasemodulediscovery pipeline to be available locally and referenced by PIPELINE_DIR in .env.
git clone https://github.com/nf-core/diseasemodulediscovery.git diseasemodulediscoveryIf you place the pipeline somewhere else, update PIPELINE_DIR accordingly.
Create or edit .env in the repository root. A minimal configuration looks like this:
DATA_DIR=/absolute/path/to/data/dir/
PIPELINE_DIR=/absolute/path/to/pipeline/dir/
JWT_SECRET=your-jwt-secret
AUTH_ENABLED=trueNotes:
DATA_DIRis mounted into the container and holds run data and the SQLite database.PIPELINE_DIRmust point at the clonednf-core/diseasemodulediscoveryrepository.JWT_SECRETis used to validate incoming bearer tokens whenAUTH_ENABLED=true.- Set
AUTH_ENABLED=falseto disable authentication for all protected endpoints.
A nextflow.config file in the repository root is automatically passed to every pipeline run via the -c flag. Use it to set Nextflow options that apply to all runs, for example:
cleanup = truedocker compose up --buildOnce the container is running, the API is available at:
http://localhost:8000
Docs and interactive queries:
http://localhost:8000/docs
Useful endpoints:
POST /nextflow-api/runs- submit a new pipeline runGET /nextflow-api/runs- list runsGET /nextflow-api/runs/{run_id}- inspect a runGET /nextflow-api/runs/{run_id}/logs- read the Nextflow log for a runDELETE /nextflow-api/runs/{run_id}- cancel a running job
Each submission gets its own run directory under data/runs/<run_id>/.
${DATA_DIR}/runs/<run_id>/
├── nextflow.log
├── results/
└── work/
nextflow.logcontains the Nextflow execution log.work/contains Nextflow intermediate work files.results/contains the pipeline outputs produced by the run.
The API also stores run metadata in data/runs.db, including status, timestamps, and exit code.
POST /nextflow-api/runs accepts multipart form data with three fields:
| Field | Type | Description |
|---|---|---|
params |
JSON string | Pipeline parameters passed as --key value flags |
profile |
string | Nextflow profile(s), e.g. docker or docker,test (default: docker) |
files |
file(s) | Input files to upload (optional, repeatable) |
Uploaded files are saved to the run's input/ directory before the pipeline starts. The pipeline is then executed with the run directory as its working directory, so uploaded files can be referenced in params using the relative prefix input/<filename> — no absolute paths needed.
Example with two input files:
curl -X POST http://localhost:8000/nextflow-api/runs \
-F 'params={"seeds":"input/seeds.csv","network":"input/ppi.csv"}' \
-F 'profile=docker' \
-F 'files=@seeds.csv' \
-F 'files=@ppi.csv'Here is a simple end-to-end flow using curl after the container is up.
Submit a run and store the id:
run_id=$(curl -s -X POST http://localhost:8000/nextflow-api/runs \
-F 'params={"seeds":"input/entrez_seeds_1.csv", "network": "input/entrez_ppi.csv"}' \
-F 'profile=docker,test' \
-F 'files=@test_data/entrez_seeds_1.csv' \
-F 'files=@test_data/entrez_ppi.csv' \
| python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')echo $run_idCheck the run status:
curl -s http://localhost:8000/nextflow-api/runs/$run_idRead the Nextflow log:
curl -s http://localhost:8000/nextflow-api/runs/$run_id/logsList all runs:
curl -s http://localhost:8000/nextflow-api/runsIf you omit profile, the API uses docker by default.
docker compose run --build --rm nextflow-api python3.11 -m pytest tests/docker compose run --build --rm nextflow-api bash