# selbioinfonivedi-web/seqbridge architecture

> Architecture diagram of the GitHub repository selbioinfonivedi-web/seqbridge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/selbioinfonivedi-web/seqbridge
- Repository: https://github.com/selbioinfonivedi-web/seqbridge

## Overview

VetGenome Hub is a FastAPI application for operating an ONT MinION sequencing pipeline. Users submit reads and reference data, launch single-sample or cohort runs, and poll job status; the pipeline sequences analysis steps, then exposes artifacts, summaries, and downstream AMR, MGE, and SNP reports. Tool adapters provide parameter schemas and dry-run command previews, while jobs execute CLI tools in WSL or isolated binding subprocesses. The README documents the adapter catalog and workflow; sampled excerpts confirm orchestration and execution, but not every report implementation or tool-to-tool handoff.

Main entry points: [`backend/app.py`](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/app.py) (API routes), [`backend/core/jobs.py`](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/jobs.py) (Job queue and store), [`backend/core/pipeline.py`](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/pipeline.py) (Pipeline runs), [`backend/core/registry.py`](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/registry.py) (Tool registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and inputs"]
  node_app["API routes<br/>[app.py]"]
  node_files["File handling<br/>[files.py]"]
end

subgraph group_workflow["Run orchestration"]
  node_pipeline["Pipeline runs<br/>[pipeline.py]"]
  node_jobs[("Job queue and store<br/>[jobs.py]")]
end

subgraph group_execution["Analysis execution"]
  node_registry["Tool registry<br/>[registry.py]"]
  node_adapters["Tool adapters"]
  node_adapter_base["Adapter contract<br/>[base.py]"]
  node_runner["WSL runner<br/>[runner.py]"]
  node_exec_binding["Binding launcher<br/>[exec_binding.py]"]
  node_storage["Job sandbox<br/>[storage.py]"]
end

subgraph group_results["Results and reporting"]
  node_results_parser["Output summaries<br/>[results.py]"]
  node_report["Run reports<br/>[report.py]"]
end

subgraph group_domain["Domain analyses"]
  node_contamination["Contamination analysis<br/>[contamination.py]"]
  node_amr["AMR reports<br/>[amr_report.py]"]
  node_mge["MGE reports<br/>[mge_report.py]"]
  node_snp["SNP reports<br/>[snp_report.py]"]
  node_nf["Nextflow integration<br/>[nf.py]"]
  node_mge_integration["MGE integration<br/>[10_integration.py]"]
  node_mge_cohort["MGE cohort summary<br/>[cohort_summary.py]"]
end

node_user(("Lab operator"))

node_user -->|"submits requests"| node_app
node_app -->|"handles uploads"| node_files
node_app -->|"launches runs"| node_pipeline
node_app -->|"manages jobs"| node_jobs
node_app -->|"lists tools"| node_registry
node_pipeline -->|"creates steps"| node_jobs
node_pipeline -->|"previews outputs"| node_registry
node_pipeline -->|"invalidates cache"| node_report
node_jobs -->|"resolves adapter"| node_registry
node_jobs -->|"executes commands"| node_runner
node_jobs -->|"creates sandbox"| node_storage
node_jobs -->|"runs adapter"| node_adapters
node_adapters -->|"uses contract"| node_adapter_base
node_runner -.->|"launches bindings"| node_exec_binding
node_app -->|"serves summaries"| node_results_parser
node_results_parser -->|"reads metadata"| node_registry
node_results_parser -->|"resolves outputs"| node_storage
node_app -->|"serves AMR reports"| node_amr
node_app -->|"serves MGE reports"| node_mge
node_app -->|"serves SNP reports"| node_snp
node_app -.->|"serves analysis"| node_contamination
node_app -.->|"exposes integration"| node_nf
node_mge -.->|"uses analysis"| node_mge_integration
node_mge -.->|"summarizes cohorts"| node_mge_cohort

click node_app "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/app.py"
click node_files "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/files.py"
click node_pipeline "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/pipeline.py"
click node_jobs "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/jobs.py"
click node_registry "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/registry.py"
click node_adapters "https://github.com/selbioinfonivedi-web/seqbridge/tree/main/backend/tools"
click node_adapter_base "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/tools/base.py"
click node_runner "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/runner.py"
click node_exec_binding "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/exec_binding.py"
click node_storage "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/storage.py"
click node_results_parser "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/results.py"
click node_report "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/report.py"
click node_contamination "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/contamination.py"
click node_amr "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/amr_report.py"
click node_mge "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/mge_report.py"
click node_snp "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/snp_report.py"
click node_nf "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/nf.py"
click node_mge_integration "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/mge_sift/modules/10_integration.py"
click node_mge_cohort "https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/mge_sift/modules/cohort_summary.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_files toneBlue
class node_pipeline,node_jobs toneAmber
class node_registry,node_adapters,node_adapter_base,node_runner,node_exec_binding,node_storage toneMint
class node_results_parser,node_report toneRose
class node_contamination,node_amr,node_mge,node_snp,node_nf,node_mge_integration,node_mge_cohort,node_user toneIndigo
```

## Components

### API and inputs

- [API routes](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/app.py): `backend/app.py`
- [File handling](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/files.py): `backend/core/files.py`

### Run orchestration

- [Pipeline runs](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/pipeline.py): `backend/core/pipeline.py`
- [Job queue and store](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/jobs.py): `backend/core/jobs.py`

### Analysis execution

- [Tool registry](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/registry.py): `backend/core/registry.py`
- [Tool adapters](https://github.com/selbioinfonivedi-web/seqbridge/tree/main/backend/tools): `backend/tools`
- [Adapter contract](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/tools/base.py): `backend/tools/base.py`
- [WSL runner](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/runner.py): `backend/core/runner.py`
- [Binding launcher](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/exec_binding.py): `backend/exec_binding.py`
- [Job sandbox](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/storage.py): `backend/core/storage.py`

### Results and reporting

- [Output summaries](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/results.py): `backend/core/results.py`
- [Run reports](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/report.py): `backend/core/report.py`

### Domain analyses

- [Contamination analysis](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/contamination.py): `backend/core/contamination.py`
- [AMR reports](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/amr_report.py): `backend/core/amr_report.py`
- [MGE reports](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/mge_report.py): `backend/core/mge_report.py`
- [SNP reports](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/snp_report.py): `backend/core/snp_report.py`
- [Nextflow integration](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/core/nf.py): `backend/core/nf.py`
- [MGE integration](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/mge_sift/modules/10_integration.py): `backend/mge_sift/modules/10_integration.py`
- [MGE cohort summary](https://github.com/selbioinfonivedi-web/seqbridge/blob/main/backend/mge_sift/modules/cohort_summary.py): `backend/mge_sift/modules/cohort_summary.py`

### Other components

- **Lab operator**

## Connections

- Lab operator → API routes: submits requests
- API routes → File handling: handles uploads (evidence: `backend/app.py`)
- API routes → Pipeline runs: launches runs (evidence: `backend/app.py`)
- API routes → Job queue and store: manages jobs (evidence: `backend/app.py`)
- API routes → Tool registry: lists tools (evidence: `backend/app.py`)
- Pipeline runs → Job queue and store: creates steps (evidence: `backend/core/pipeline.py`)
- Pipeline runs → Tool registry: previews outputs (evidence: `backend/core/pipeline.py`)
- Pipeline runs → Run reports: invalidates cache (evidence: `backend/core/pipeline.py`)
- Job queue and store → Tool registry: resolves adapter (evidence: `backend/core/jobs.py`)
- Job queue and store → WSL runner: executes commands (evidence: `backend/core/jobs.py`)
- Job queue and store → Job sandbox: creates sandbox (evidence: `backend/core/jobs.py`)
- Job queue and store → Tool adapters: runs adapter
- Tool adapters → Adapter contract: uses contract (evidence: `backend/tools/bcftools/__init__.py`)
- WSL runner → Binding launcher: launches bindings
- API routes → Output summaries: serves summaries (evidence: `backend/app.py`)
- Output summaries → Tool registry: reads metadata (evidence: `backend/core/results.py`)
- Output summaries → Job sandbox: resolves outputs (evidence: `backend/core/results.py`)
- API routes → AMR reports: serves AMR reports (evidence: `backend/app.py`)
- API routes → MGE reports: serves MGE reports (evidence: `backend/app.py`)
- API routes → SNP reports: serves SNP reports (evidence: `backend/app.py`)
- API routes → Contamination analysis: serves analysis (evidence: `backend/app.py`)
- API routes → Nextflow integration: exposes integration (evidence: `backend/app.py`)
- MGE reports → MGE integration: uses analysis
- MGE reports → MGE cohort summary: summarizes cohorts
