# nf-cmgg/wisecondorx architecture

> Architecture diagram of the GitHub repository nf-cmgg/wisecondorx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nf-cmgg/wisecondorx
- Repository: https://github.com/nf-cmgg/wisecondorx

## Overview

##### Project type and purpose
- This is an nf-core bioinformatics pipeline written in Nextflow DSL2.
- Its goal is to run the WisecondorX tool in two stages:
- “convert”: transform alignment files into NPZ format
- “newref”: build a reference from all NPZ files
- It follows the nf-core standard: modularized code, centralized configuration, containerized environments, CI testing.

##### File structure
- Top-level workflow:
- main.nf (imports workflows/wisecondorx.nf)
- workflows/wisecondorx.nf (defines the two main stages)
- Modules directory: modules/nf-core/...
- Each module has: main.nf (process), environment.yml (Conda), meta.yml (documentation), tests
- Subworkflows: reusable composites in subworkflows/nf-core and subworkflows/local
- Configuration:
- nextflow.config + nf-core.yml + conf/*.config (institute, test settings)
- tower.yml (Seqera Tower integration)
- Assets: report templates (adaptivecard.json, email templates, slackreport.json)
- Tests:
- tests/ (pipeline-level)
- module and subworkflow tests under their own directories
- CI & tooling: GitHub workflows, nf-test integration, pre-commit, .devcontainer, Docker/Singularity/Conda support.

##### README
- Confirms the two-step pipeline and how to run with Nextflow profiles
- Mentions container support and nf-core community standards
- Points to parameter docs and citations

- Nextflow Engine (runtime orchestrator)
- Workflow layer: main.nf + workflows/wisecondorx.nf
- Modules (modules/nf-core/…): encapsulated Nextflow processes
- Subworkflows (subworkflows/…): reusable composite workflows
- Configuration (nextflow.config, conf/*.config, nf-core.yml)
- Assets & Reporting Templates (assets/)
- External Services: Conda, Docker Hub, Singularity, Seqera Tower
- Test Suite (tests/, module tests, CI pipelines)
- Data Storage: Input samplesheet & FASTQ/BAM, NPZ outputs, reference outputs
b. Relationships and data flow:
1. User supplies input samplesheet → Nextflow Engine
2. Nextflow Engine reads configuration → selects profiles (docker/singularity/conda)
3. Workflow layer invokes subworkflows and modules in sequence:
- convert subworkflow (modules/nf-core/wisecondorx/convert) → NPZ files
- newref subworkflow (modules/nf-core/wisecondorx/newref) → reference NPZ
4. Each module pulls its Conda/Docker/Singularity environment, executes processes.
5. Assets are used to generate reports (email, Slack, multiQC)
6. Outputs written to outdir.
7. CI & nf-test run pipeline and module tests on commits.
8. Seqera Tower (optional) triggers runs and monitors status.
c. Architectural patterns & principles:
- DSL2 modularization: clear separation between workflows, modules, and subworkflows
- Infrastructure-as-code: config files declare compute profiles, parameters, environments
- Container-first design: reproducible environments via Conda, Docker, Singularity
- nf-core conventions: standard directory layout, CI integration, community guidelines
d. Key technologies & frameworks:
- Nextflow DSL2
- nf-core modules & templates
- Conda / Docker / Singularity
- GitHub Actions (ci.yml, linting.yml, etc.)
- nf-test for pipeline validation
- Seqera Tower for cloud execution

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Input Data
    InputData["User Input<br/>(samplesheet, FASTQ/BAM)"]:::external

    %% Orchestration
    subgraph "Orchestration Layer"
        NextflowEngine["Nextflow Engine<br/>(main.nf)"]:::orchestration
    end

    %% Configuration
    subgraph "Configuration"
        CentralConfig["nextflow.config"]:::config
        NfcoreConfig[".nf-core.yml"]:::config
        ProfileConfig["conf/base.config<br/>(and other profiles)"]:::config
        TowerIntegration["tower.yml"]:::config
    end

    %% Workflow Layer
    subgraph "Workflow Layer"
        PipelineWorkflow["Pipeline Workflow<br/>(workflows/wisecondorx.nf)"]:::workflow
    end

    %% Modules
    subgraph "Modules Directory" 
        ModulesDir["modules/nf-core/"]:::modules
        subgraph "WisecondorX Modules"
            ConvertModule["Convert Process<br/>(main.nf)"]:::modules
            ConvertEnv["Convert Env<br/>(environment.yml)"]:::config
            NewrefModule["Newref Process<br/>(main.nf)"]:::modules
            NewrefEnv["Newref Env<br/>(environment.yml)"]:::config
        end
    end

    %% Subworkflows
    subgraph "Subworkflows"
        LocalSubworkflow["Local Utils<br/>(subworkflows/local/utils_nfcore_wisecondorx_pipeline/main.nf)"]:::subworkflow
        NfcoreSubworkflow["nf-core Utils<br/>(subworkflows/nf-core/utils_nextflow_pipeline/main.nf)"]:::subworkflow
    end

    %% External Services
    subgraph "External Services"
        Conda["Conda"]:::external
        Docker["Docker Hub"]:::external
        Singularity["Singularity"]:::external
        Tower["Seqera Tower"]:::external
    end

    %% Assets & Reporting
    Assets["Assets & Reporting Templates<br/>(assets/)"]:::assets

    %% Outputs
    subgraph "Pipeline Outputs"
        NPZOutputs["NPZ Files"]:::external
        ReferenceOutputs["Reference NPZ"]:::external
    end

    %% Test Suite & CI
    subgraph "Testing & CI"
        PipelineTests["Pipeline Tests<br/>(tests/main.nf.test)"]:::tests
        ModuleTests["Module Tests<br/>(modules/nf-core/wisecondorx/convert/tests/main.nf.test)"]:::tests
        CI["CI Workflows<br/>(.github/workflows/ci.yml)"]:::tests
        NfTest["nf-test.config"]:::tests
    end

    %% Data Flow & Dependencies
    InputData --> NextflowEngine
    NextflowEngine --> CentralConfig
    NextflowEngine --> NfcoreConfig
    NextflowEngine --> ProfileConfig
    NextflowEngine --> TowerIntegration
    NextflowEngine --> PipelineWorkflow
    PipelineWorkflow --> LocalSubworkflow
    PipelineWorkflow --> NfcoreSubworkflow
    PipelineWorkflow --> ConvertModule
    ConvertModule --> ConvertEnv
    PipelineWorkflow --> NewrefModule
    NewrefModule --> NewrefEnv
    ConvertModule --> NPZOutputs
    NPZOutputs --> NewrefModule
    NewrefModule --> ReferenceOutputs
    ConvertModule --> Conda
    ConvertModule --> Docker
    ConvertModule --> Singularity
    NewrefModule --> Conda
    NewrefModule --> Docker
    NewrefModule --> Singularity
    PipelineWorkflow --> Assets
    ReferenceOutputs --> Assets
    NextflowEngine --> Tower
    CI --> PipelineTests
    CI --> ModuleTests
    CI --> NfTest
    CI --> PipelineWorkflow

    %% Click Events
    click NextflowEngine "https://github.com/nf-cmgg/wisecondorx/blob/master/main.nf"
    click PipelineWorkflow "https://github.com/nf-cmgg/wisecondorx/blob/master/workflows/wisecondorx.nf"
    click ConvertModule "https://github.com/nf-cmgg/wisecondorx/blob/master/modules/nf-core/wisecondorx/convert/main.nf"
    click ConvertEnv "https://github.com/nf-cmgg/wisecondorx/blob/master/modules/nf-core/wisecondorx/convert/environment.yml"
    click NewrefModule "https://github.com/nf-cmgg/wisecondorx/blob/master/modules/nf-core/wisecondorx/newref/main.nf"
    click NewrefEnv "https://github.com/nf-cmgg/wisecondorx/blob/master/modules/nf-core/wisecondorx/newref/environment.yml"
    click ModulesDir "https://github.com/nf-cmgg/wisecondorx/tree/master/modules/nf-core/"
    click LocalSubworkflow "https://github.com/nf-cmgg/wisecondorx/blob/master/subworkflows/local/utils_nfcore_wisecondorx_pipeline/main.nf"
    click NfcoreSubworkflow "https://github.com/nf-cmgg/wisecondorx/blob/master/subworkflows/nf-core/utils_nextflow_pipeline/main.nf"
    click CentralConfig "https://github.com/nf-cmgg/wisecondorx/blob/master/nextflow.config"
    click NfcoreConfig "https://github.com/nf-cmgg/wisecondorx/blob/master/.nf-core.yml"
    click ProfileConfig "https://github.com/nf-cmgg/wisecondorx/blob/master/conf/base.config"
    click TowerIntegration "https://github.com/nf-cmgg/wisecondorx/blob/master/tower.yml"
    click Assets "https://github.com/nf-cmgg/wisecondorx/tree/master/assets/"
    click PipelineTests "https://github.com/nf-cmgg/wisecondorx/blob/master/tests/main.nf.test"
    click ModuleTests "https://github.com/nf-cmgg/wisecondorx/blob/master/modules/nf-core/wisecondorx/convert/tests/main.nf.test"
    click CI "https://github.com/nf-cmgg/wisecondorx/blob/master/.github/workflows/ci.yml"
    click NfTest "https://github.com/nf-cmgg/wisecondorx/blob/master/nf-test.config"

    %% Styles
    classDef orchestration fill:#89CFF0,stroke:#555,stroke-width:1px;
    classDef workflow fill:#ADD8E6,stroke:#555,stroke-width:1px;
    classDef modules fill:#98FB98,stroke:#555,stroke-width:1px;
    classDef subworkflow fill:#90EE90,stroke:#555,stroke-width:1px;
    classDef config fill:#FFFF99,stroke:#555,stroke-width:1px;
    classDef assets fill:#FFA500,stroke:#555,stroke-width:1px;
    classDef external fill:#DDA0DD,stroke:#555,stroke-width:1px;
    classDef tests fill:#D3D3D3,stroke:#555,stroke-width:1px;
```
