# gatk-workflows/gatk4-rnaseq-germline-snps-indels architecture

> Architecture diagram of the GitHub repository gatk-workflows/gatk4-rnaseq-germline-snps-indels, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels
- Repository: https://github.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels

## Overview

##### Project type and purpose
- This is an open-source workflow definition using WDL (Workflow Description Language) for germline SNP/indel discovery from RNA-seq data with GATK4.
- It is intended to run on Broad’s Google Cloud Platform (GCP) environment (e.g., via Cromwell or Terra), using Docker containers for each GATK/tool step.

##### File structure
- Top-level files only:
- gatk4-rna-best-practices.wdl – the workflow script defining tasks and data flow
- gatk4-rna-germline-variant-calling.inputs.json – example input parameter set (uBAM, references, resource files)
- .dockstore.yml – metadata for publishing this workflow to Dockstore (registry)
- LICENSE & README.md – licensing and high-level documentation
- No subdirectories; everything is defined in the WDL and driven by the JSON input.

##### README for additional insights
- Input: uBAM (unmapped BAM)
- Outputs: aligned BAM + index, raw VCF + index, filtered VCF + index
- Runtime tuned for GCP, Docker-based execution, users must supply reference/resource bundles
- Integration points: Terra UI, Cromwell execution engine, GCS buckets, Dockstore registry

##### Detailed breakdown of components
- Stage’s input & output artifacts (BAM, VCF).
- Parameter injection from the JSON file (e.g., reference FASTA, resource bundles).
- Retry or scatter/gather patterns if used by the WDL (parallelization).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Services
    subgraph "External Services"
        User["User (Terra UI / Cromwell CLI)"]:::external
        Dockstore["Dockstore Registry"]:::external
        DockerReg["Docker Registry"]:::external
    end

    %% Workflow Definition Files
    subgraph "Workflow Definition"
        WDL["gatk4-rna-best-practices.wdl"]:::definition
        JSON["gatk4-rna-germline-variant-calling.inputs.json"]:::definition
        YML[".dockstore.yml"]:::definition
        README["README.md"]:::definition
        LICENSE["LICENSE"]:::definition
    end

    %% Orchestration Layer
    WorkflowEngine["Workflow Engine<br>(Cromwell/Terra)"]:::orchestration

    %% Storage Layer
    subgraph "GCS Buckets"
        InputsBucket["Input Bucket"]:::storage
        InterimBucket["Intermediate Bucket"]:::storage
        OutputBucket["Output Bucket"]:::storage
    end

    %% Compute Layer
    subgraph "GCP Worker VMs"
        subgraph "Tasks (Docker Containers)"
            Align["Alignment"]:::compute
            BQSR["BaseRecalibrator<br>/ ApplyBQSR"]:::compute
            HCall["HaplotypeCaller"]:::compute
            Filter["VariantFiltration"]:::compute
        end
    end

    %% Connections
    User -->|"submit workflow"| WorkflowEngine
    WorkflowEngine -->|"reads WDL"| WDL
    WorkflowEngine -->|"reads inputs"| JSON
    WorkflowEngine -->|"reads metadata"| YML
    WorkflowEngine -->|"accesses docs"| README
    WorkflowEngine -->|"accesses license"| LICENSE
    WorkflowEngine -->|"orchestrates VMs"| Align
    WorkflowEngine -->|"status/logs"| Dockstore

    DockerReg -->|"pull images"| Align
    DockerReg -->|"pull images"| BQSR
    DockerReg -->|"pull images"| HCall
    DockerReg -->|"pull images"| Filter

    JSON -.->|"parameters"| Align
    JSON -.->|"parameters"| BQSR
    JSON -.->|"parameters"| HCall
    JSON -.->|"parameters"| Filter

    Align -->|"writes BAM"| InterimBucket
    InterimBucket -->|"reads BAM"| BQSR
    BQSR -->|"writes recalibrated BAM"| InterimBucket
    InterimBucket -->|"reads BAM"| HCall
    HCall -->|"writes raw VCF"| InterimBucket
    InterimBucket -->|"reads raw VCF"| Filter
    Filter -->|"writes filtered VCF"| OutputBucket

    WorkflowEngine -->|"reads/writes"| InputsBucket
    WorkflowEngine -->|"reads/writes"| InterimBucket
    WorkflowEngine -->|"reads/writes"| OutputBucket

    %% Click Events
    click WDL "https://github.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels/blob/master/gatk4-rna-best-practices.wdl"
    click JSON "https://github.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels/blob/master/gatk4-rna-germline-variant-calling.inputs.json"
    click YML "https://github.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels/blob/master/.dockstore.yml"
    click README "https://github.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels/blob/master/README.md"
    click LICENSE "https://github.com/gatk-workflows/gatk4-rnaseq-germline-snps-indels/tree/master/LICENSE"

    %% Styles
    classDef orchestration fill:#BBDEFB,stroke:#1976D2
    classDef compute fill:#C8E6C9,stroke:#388E3C
    classDef storage fill:#FFE0B2,stroke:#FB8C00
    classDef external fill:#EEEEEE,stroke:#888888
    classDef definition fill:#F3E5F5,stroke:#8E24AA
```
