# denishanch/efsa_pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/denishanch/efsa_pipeline
- Repository: https://github.com/denishanch/efsa_pipeline

## Overview

EFSA Pipeline is a Nextflow DSL2 genomics workflow. Users provide read/genome files and a JSON configuration; validation normalizes and checks inputs, then enabled short-read, long-read, and reference-versus-modified analyses run, producing quality, mapping, variant, and structural-variant outputs. The graph includes the documented branches and the sampled validation internals. Validation source excerpts are partial; links for unsampled analysis stages rely on the README’s workflow description rather than inspected implementation.

Main entry points: [`modules/validation/main.py`](https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/main.py) (Validation runner), [`workflows/analysis.nf`](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/analysis.nf) (Analysis orchestration), [`workflows/short_read.nf`](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/short_read.nf) (Short-read workflow), [`workflows/long_read.nf`](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/long_read.nf) (Long-read workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Pipeline entry"]
  node_main["Nextflow entry<br/>[main.nf]"]
  node_analysis["Analysis orchestration<br/>[analysis.nf]"]
  node_sv_output["SV table aggregation"]
end

subgraph group_validation["Input validation"]
  node_validation_main["Validation runner<br/>[main.py]"]
  node_config["Config manager<br/>[config_manager.py]"]
  node_genome_validator["Genome validators"]
  node_read_validator["Read validators"]
  node_interfile["Inter-file checks"]
  node_validation_utils["Validation utilities"]
  node_params["Nextflow parameters"]
  node_ref_defragment["Reference defragmentation<br/>[ref_defragment.py]"]
end

subgraph group_short["Short-read analysis"]
  node_short_workflow["Short-read workflow<br/>[short_read.nf]"]
  node_qc["Read QC and trimming<br/>[qc.nf]"]
  node_mapping["Read mapping<br/>[mapping.nf]"]
  node_variant_calling["Variant calling<br/>[variant_calling.nf]"]
  node_sv_calling["SV calling<br/>[sv_calling.nf]"]
end

subgraph group_long["Long-read analysis"]
  node_long_workflow["Long-read workflow<br/>[long_read.nf]"]
  node_assembly["Assembly analysis<br/>[assembly.nf]"]
end

subgraph group_comparison["Genome comparison"]
  node_comparison_workflow["Reference comparison<br/>[fasta_ref_x_mod.nf]"]
end

node_user(("Pipeline user"))
node_inputs["Input files and config"]
node_outputs["Pipeline outputs"]

node_user -->|"provides"| node_inputs
node_inputs -->|"starts run"| node_main
node_main -->|"validates first"| node_validation_main
node_validation_main -->|"loads configuration"| node_config
node_validation_main -->|"validates genomes"| node_genome_validator
node_validation_main -.->|"validates reads"| node_read_validator
node_validation_main -.->|"checks consistency"| node_interfile
node_validation_main -->|"prepares reference"| node_ref_defragment
node_config -->|"uses helpers"| node_validation_utils
node_genome_validator -->|"uses helpers"| node_validation_utils
node_read_validator -->|"uses helpers"| node_validation_utils
node_validation_main -->|"writes parameters"| node_params
node_validation_main -->|"enables branches"| node_analysis
node_analysis -->|"runs if enabled"| node_short_workflow
node_analysis -->|"runs if enabled"| node_long_workflow
node_analysis -->|"runs if enabled"| node_comparison_workflow
node_short_workflow -.->|"quality controls"| node_qc
node_short_workflow -.->|"maps reads"| node_mapping
node_short_workflow -.->|"calls variants"| node_variant_calling
node_short_workflow -.->|"calls SVs"| node_sv_calling
node_long_workflow -.->|"maps reads"| node_mapping
node_long_workflow -.->|"calls SVs"| node_sv_calling
node_long_workflow -.->|"analyzes assembly"| node_assembly
node_comparison_workflow -.->|"analyzes variants"| node_sv_calling
node_analysis -->|"aggregates tables"| node_sv_output
node_sv_output -->|"writes tables"| node_outputs

click node_inputs "https://github.com/denishanch/efsa_pipeline/tree/main/data/inputs"
click node_main "https://github.com/denishanch/efsa_pipeline/blob/main/main.nf"
click node_validation_main "https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/main.py"
click node_config "https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/validation-pkg/validation_pkg/config_manager.py"
click node_genome_validator "https://github.com/denishanch/efsa_pipeline/tree/main/modules/validation/validation-pkg/validation_pkg/validators"
click node_read_validator "https://github.com/denishanch/efsa_pipeline/tree/main/modules/validation/validation-pkg/validation_pkg/validators"
click node_interfile "https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/validation-pkg/validation_pkg/validators/interfile_genome.py"
click node_validation_utils "https://github.com/denishanch/efsa_pipeline/tree/main/modules/validation/validation-pkg/validation_pkg/utils"
click node_params "https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/utils/nextflow_params_handler.py"
click node_ref_defragment "https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/utils/ref_defragment.py"
click node_short_workflow "https://github.com/denishanch/efsa_pipeline/blob/main/workflows/short_read.nf"
click node_qc "https://github.com/denishanch/efsa_pipeline/blob/main/modules/qc.nf"
click node_mapping "https://github.com/denishanch/efsa_pipeline/blob/main/modules/mapping.nf"
click node_variant_calling "https://github.com/denishanch/efsa_pipeline/blob/main/modules/variant_calling.nf"
click node_sv_calling "https://github.com/denishanch/efsa_pipeline/blob/main/modules/sv_calling.nf"
click node_long_workflow "https://github.com/denishanch/efsa_pipeline/blob/main/workflows/long_read.nf"
click node_assembly "https://github.com/denishanch/efsa_pipeline/blob/main/modules/assembly.nf"
click node_comparison_workflow "https://github.com/denishanch/efsa_pipeline/blob/main/workflows/fasta_ref_x_mod.nf"
click node_analysis "https://github.com/denishanch/efsa_pipeline/blob/main/workflows/analysis.nf"
click node_sv_output "https://github.com/denishanch/efsa_pipeline/blob/main/modules/utils/create_sv_output.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_main,node_analysis,node_sv_output,node_user toneBlue
class node_validation_main,node_config,node_genome_validator,node_read_validator,node_interfile,node_validation_utils,node_params,node_ref_defragment toneAmber
class node_short_workflow,node_qc,node_mapping,node_variant_calling,node_sv_calling toneMint
class node_long_workflow,node_assembly toneRose
class node_comparison_workflow,node_outputs toneIndigo
class node_inputs toneTeal
```

## Components

### Pipeline entry

- [Nextflow entry](https://github.com/denishanch/efsa_pipeline/blob/main/main.nf): `main.nf`
- [Analysis orchestration](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/analysis.nf): `workflows/analysis.nf`
- [SV table aggregation](https://github.com/denishanch/efsa_pipeline/blob/main/modules/utils/create_sv_output.py): `modules/utils/create_sv_output.py`

### Input validation

- [Validation runner](https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/main.py): `modules/validation/main.py`
- [Config manager](https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/validation-pkg/validation_pkg/config_manager.py): `modules/validation/validation-pkg/validation_pkg/config_manager.py`
- [Genome validators](https://github.com/denishanch/efsa_pipeline/tree/main/modules/validation/validation-pkg/validation_pkg/validators): `modules/validation/validation-pkg/validation_pkg/validators`
- [Read validators](https://github.com/denishanch/efsa_pipeline/tree/main/modules/validation/validation-pkg/validation_pkg/validators): `modules/validation/validation-pkg/validation_pkg/validators`
- [Inter-file checks](https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/validation-pkg/validation_pkg/validators/interfile_genome.py): `modules/validation/validation-pkg/validation_pkg/validators/interfile_genome.py`
- [Validation utilities](https://github.com/denishanch/efsa_pipeline/tree/main/modules/validation/validation-pkg/validation_pkg/utils): `modules/validation/validation-pkg/validation_pkg/utils`
- [Nextflow parameters](https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/utils/nextflow_params_handler.py): `modules/validation/utils/nextflow_params_handler.py`
- [Reference defragmentation](https://github.com/denishanch/efsa_pipeline/blob/main/modules/validation/utils/ref_defragment.py): `modules/validation/utils/ref_defragment.py`

### Short-read analysis

- [Short-read workflow](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/short_read.nf): `workflows/short_read.nf`
- [Read QC and trimming](https://github.com/denishanch/efsa_pipeline/blob/main/modules/qc.nf): `modules/qc.nf`
- [Read mapping](https://github.com/denishanch/efsa_pipeline/blob/main/modules/mapping.nf): `modules/mapping.nf`
- [Variant calling](https://github.com/denishanch/efsa_pipeline/blob/main/modules/variant_calling.nf): `modules/variant_calling.nf`
- [SV calling](https://github.com/denishanch/efsa_pipeline/blob/main/modules/sv_calling.nf): `modules/sv_calling.nf`

### Long-read analysis

- [Long-read workflow](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/long_read.nf): `workflows/long_read.nf`
- [Assembly analysis](https://github.com/denishanch/efsa_pipeline/blob/main/modules/assembly.nf): `modules/assembly.nf`

### Genome comparison

- [Reference comparison](https://github.com/denishanch/efsa_pipeline/blob/main/workflows/fasta_ref_x_mod.nf): `workflows/fasta_ref_x_mod.nf`

### Other components

- **Pipeline user**
- [Input files and config](https://github.com/denishanch/efsa_pipeline/tree/main/data/inputs): `data/inputs`
- **Pipeline outputs**

## Connections

- Pipeline user → Input files and config: provides (evidence: `README.md`)
- Input files and config → Nextflow entry: starts run (evidence: `README.md`)
- Nextflow entry → Validation runner: validates first (evidence: `README.md`)
- Validation runner → Config manager: loads configuration (evidence: `modules/validation/main.py`)
- Validation runner → Genome validators: validates genomes (evidence: `modules/validation/main.py`)
- Validation runner → Read validators: validates reads
- Validation runner → Inter-file checks: checks consistency
- Validation runner → Reference defragmentation: prepares reference (evidence: `modules/validation/main.py`)
- Config manager → Validation utilities: uses helpers (evidence: `modules/validation/validation-pkg/validation_pkg/config_manager.py`)
- Genome validators → Validation utilities: uses helpers (evidence: `modules/validation/validation-pkg/validation_pkg/validators/genome_validator.py`)
- Read validators → Validation utilities: uses helpers (evidence: `modules/validation/validation-pkg/validation_pkg/validators/read_validator.py`)
- Validation runner → Nextflow parameters: writes parameters (evidence: `modules/validation/main.py`)
- Validation runner → Analysis orchestration: enables branches (evidence: `README.md`)
- Analysis orchestration → Short-read workflow: runs if enabled (evidence: `README.md`)
- Analysis orchestration → Long-read workflow: runs if enabled (evidence: `README.md`)
- Analysis orchestration → Reference comparison: runs if enabled (evidence: `README.md`)
- Short-read workflow → Read QC and trimming: quality controls
- Short-read workflow → Read mapping: maps reads
- Short-read workflow → Variant calling: calls variants
- Short-read workflow → SV calling: calls SVs
- Long-read workflow → Read mapping: maps reads
- Long-read workflow → SV calling: calls SVs
- Long-read workflow → Assembly analysis: analyzes assembly
- Reference comparison → SV calling: analyzes variants
- Analysis orchestration → SV table aggregation: aggregates tables (evidence: `README.md`)
- SV table aggregation → Pipeline outputs: writes tables (evidence: `README.md`)
