# collaborativebioinformatics/clinical_svs architecture

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

- Interactive diagram: https://gitdiagram.com/collaborativebioinformatics/clinical_svs
- Repository: https://github.com/collaborativebioinformatics/clinical_svs

## Overview

##### Project type and purpose
- This is a hybrid “full-stack” bioinformatics pipeline + interactive web app.
- Purpose: ingest VCFs of structural variants (SVs), annotate them with clinical/genomic information, perform enrichment analyses, and present results either via command-line outputs (annotated VCF/CSV + QC graphs) or through a Shiny web interface.

##### File structure
Top-level directories:
- R/                  ← R-based annotation modules & CLI scripts
- VCF_parser/         ← Python script to preprocess VCFs
- shiny/              ← Shiny app (app.R, assets, R modules)
- demo_outputs/       ← example enrichment outputs
- testdata/           ← sample inputs and expected outputs

Key scripts:
- R/prepare_annotation_data.R      ← builds annotation_data.RData (data prep)
- R/annotate_vcf.R                 ← master CLI annotator
- R/annotate_*.R                   ← modular annotation functions (genes, frequency, clinical)
- R/geneFunctionalAnnotation.R     ← enrichment (KEGG, Reactome, DO)
- shiny/app.R + shiny/*.R          ← UI + server sourcing same modules
- VCF_parser/VCFanalyse.py         ← Python-based VCF filtering/parsing

Config/build: no Docker files, but Rscript wrappers and Python script. Dependencies declared in README.

##### README for additional insights
- Two usage modes: (1) CLI workflow (SV calling → annotation → QC graphs) (2) Interactive Shiny app
- Lists external data sources: gnomAD-SV catalog, dbVar clinical SVs, OMIM, Gencode v35, biomedical ontologies

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Input Layer"
        VSCTest["Raw VCFs<br/>(testdata/)"]:::dataSources
        VCFParserDir["VCF_parser/"]:::python
        VCFAnalyse["VCFanalyse.py"]:::python
        VCFReadme["README.md"]:::python
    end

    %% Data Preparation
    subgraph "Data Preparation"
        Prep["prepare_annotation_data.R"]:::modules
        AnnotationData["annotation_data.RData"]:::dataSources
    end

    %% CLI Workflow
    subgraph "CLI Workflow"
        Orchestrator["annotate_vcf.R"]:::modules
        Genes["annotate_genes.R"]:::modules
        Freq["annotate_frequency.R"]:::modules
        Known["annotate_known_clinical_SVs.R"]:::modules
        Score["annotate_clinical_score.R"]:::modules
        AnnotatedOut["Annotated VCF + CSV"]:::outputs
    end

    %% Enrichment Module
    subgraph "Enrichment Module"
        Enrich["geneFunctionalAnnotation.R"]:::modules
        DemoOut["demo_outputs/"]:::outputs
    end

    %% Shiny App
    subgraph "Interactive Web App"
        App["app.R"]:::ui
        SGenes["annotate_genes.R"]:::modules
        SFreq["annotate_frequency.R"]:::modules
        SKnown["annotate_known_clinical_SVs.R"]:::modules
        SScore["annotate_clinical_score.R"]:::modules
        SEnrich["geneFunctionalAnnotation.R"]:::modules
        Assets["assets/"]:::ui
        SVCFOut["output.vcf"]:::outputs
        SCSVOut["output.csv"]:::outputs
    end

    %% Flows
    VSCTest --> Prep
    VCFParserDir --> VCFAnalyse
    VCFAnalyse --> Orchestrator
    Prep --> AnnotationData
    AnnotationData --> Orchestrator
    AnnotationData --> App

    Orchestrator --> Genes
    Orchestrator --> Freq
    Orchestrator --> Known
    Orchestrator --> Score
    Genes --> AnnotatedOut
    Freq --> AnnotatedOut
    Known --> AnnotatedOut
    Score --> AnnotatedOut

    AnnotatedOut --> Enrich
    Enrich --> DemoOut

    App --> SGenes
    App --> SFreq
    App --> SKnown
    App --> SScore
    App --> SEnrich
    SGenes --> Assets
    SFreq --> Assets
    SKnown --> Assets
    SScore --> Assets
    SEnrich --> Assets
    Assets --> SVCFOut
    Assets --> SCSVOut

    %% Click Events
    click VSCTest "https://github.com/collaborativebioinformatics/clinical_svs/tree/main/testdata/"
    click VCFParserDir "https://github.com/collaborativebioinformatics/clinical_svs/tree/main/VCF_parser/"
    click VCFAnalyse "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/VCF_parser/VCFanalyse.py"
    click VCFReadme "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/VCF_parser/README.md"
    click Prep "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/prepare_annotation_data.R"
    click AnnotationData "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/annotation_data.RData"
    click Orchestrator "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/annotate_vcf.R"
    click Genes "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/annotate_genes.R"
    click Freq "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/annotate_frequency.R"
    click Known "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/annotate_known_clinical_SVs.R"
    click Score "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/annotate_clinical_score.R"
    click Enrich "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/R/geneFunctionalAnnotation.R"
    click DemoOut "https://github.com/collaborativebioinformatics/clinical_svs/tree/main/demo_outputs/"
    click App "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/app.R"
    click SGenes "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/annotate_genes.R"
    click SFreq "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/annotate_frequency.R"
    click SKnown "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/annotate_known_clinical_SVs.R"
    click SScore "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/annotate_clinical_score.R"
    click SEnrich "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/geneFunctionalAnnotation.R"
    click Assets "https://github.com/collaborativebioinformatics/clinical_svs/tree/main/shiny/assets/"
    click SVCFOut "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/output.vcf"
    click SCSVOut "https://github.com/collaborativebioinformatics/clinical_svs/blob/main/shiny/output.csv"

    %% Styles
    classDef dataSources fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef modules fill:#90EE90,stroke:#333,stroke-width:1px
    classDef python fill:#FFA500,stroke:#333,stroke-width:1px
    classDef ui fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef outputs fill:#f0f0f0,stroke:#333,stroke-width:1px
```
