# rinaldi-rpy/smallruminantcadd architecture

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

- Interactive diagram: https://gitdiagram.com/rinaldi-rpy/smallruminantcadd
- Repository: https://github.com/rinaldi-rpy/smallruminantcadd

## Overview

Automated CADD Pipeline v2 is a configurable Snakemake workflow for building and validating variant-deleteriousness models and producing CADD scores for non-human species. Its broad workflow runs from reference/alignment preparation and variant-set generation through annotation, feature preparation, model training, and score generation; it also supports regional evaluation and conservation annotation generation. The README documents these capabilities, while sampled source confirms selected processing and modeling behavior. The exact rule-level wiring is not fully visible in the excerpts, so the graph keeps orchestration links broad rather than asserting unverified helper-to-helper calls.

Main entry points: [`workflow/Snakefile`](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/Snakefile) (Snakemake workflow), [`workflow/rules/annotate_variants.smk`](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/annotate_variants.smk) (Variant annotation), [`workflow/rules/cadd_score.smk`](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/cadd_score.smk) (CADD score generation), [`resources`](https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/resources) (Reference and MSA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ancestry["Genome and Ancestry"]
  node_resources["Reference and MSA"]
  node_config["Workflow configuration"]
  node_workflow["Snakemake workflow"]
  node_alignment["Ancestral extraction"]
  node_coverage["Coverage statistics"]
end

subgraph group_variants["Variant Sets"]
  node_derived["Derived variants"]
  node_simulation["Simulated variants"]
  node_variant_sources["Population variants"]
end

subgraph group_annotations["Annotations"]
  node_conservation["Conservation data"]
  node_annotation_rules["Variant annotation"]
  node_annotation_scripts["Annotation processors"]
end

subgraph group_modeling["Modeling and Scores"]
  node_cadd["CADD score generation<br/>[cadd_score.smk]"]
  node_score_scripts["Score processing"]
  node_dataset["Feature preparation"]
  node_train_test["Train and test"]
  node_train_model["Model fitting<br/>[train_model.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Regional evaluation"]
  node_results["Pipeline outputs"]
end

node_user(("Pipeline user"))

node_user -->|"runs"| node_workflow
node_workflow -->|"reads settings"| node_config
node_workflow -->|"dispatches"| node_alignment
node_resources -->|"provides sequences"| node_alignment
node_alignment -->|"coverage input"| node_coverage
node_workflow -->|"dispatches"| node_conservation
node_resources -->|"provides alignment"| node_conservation
node_workflow -->|"dispatches"| node_derived
node_resources -->|"provides reference"| node_derived
node_variant_sources -->|"provides variants"| node_derived
node_workflow -->|"dispatches"| node_simulation
node_resources -->|"provides reference"| node_simulation
node_workflow -->|"dispatches"| node_annotation_rules
node_derived -->|"variant input"| node_annotation_rules
node_simulation -->|"variant input"| node_annotation_rules
node_annotation_rules -->|"invokes"| node_annotation_scripts
node_conservation -->|"annotation input"| node_annotation_rules
node_workflow -->|"dispatches"| node_train_test
node_annotation_rules -->|"annotated input"| node_dataset
node_dataset -->|"prepared features"| node_train_test
node_train_test -->|"invokes"| node_train_model
node_workflow -->|"dispatches"| node_cadd
node_train_model -->|"trained model"| node_cadd
node_annotation_rules -->|"annotated variants"| node_cadd
node_cadd -->|"invokes"| node_score_scripts
node_workflow -->|"dispatches"| node_evaluation
node_train_test -->|"test predictions"| node_evaluation
node_evaluation -->|"writes reports"| node_results
node_cadd -->|"writes scores"| node_results
node_coverage -->|"writes statistics"| node_results

click node_resources "https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/resources"
click node_config "https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/config"
click node_workflow "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/Snakefile"
click node_alignment "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/alignment_processing.smk"
click node_coverage "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/alignment_processing/report_ancestral_coverage.py"
click node_conservation "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/generate_annotations.smk"
click node_derived "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/derive_variants.smk"
click node_simulation "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/simulate_variants.smk"
click node_annotation_rules "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/annotate_variants.smk"
click node_annotation_scripts "https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/workflow/scripts/annotate_variants"
click node_cadd "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/cadd_score.smk"
click node_score_scripts "https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/workflow/scripts/cadd_score"
click node_dataset "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/annotate_variants/data_preparation.py"
click node_train_test "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/train_test_model.smk"
click node_train_model "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/train_test_model/train_model.py"
click node_evaluation "https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/train_test_model/average_auc_by_region.py"
click node_results "https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/results"

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_resources,node_config,node_workflow,node_alignment,node_coverage,node_user toneBlue
class node_derived,node_simulation,node_variant_sources toneAmber
class node_conservation,node_annotation_rules,node_annotation_scripts toneMint
class node_cadd,node_score_scripts,node_dataset,node_train_test,node_train_model toneRose
class node_evaluation,node_results toneIndigo
```

## Components

### Genome and Ancestry

- [Reference and MSA](https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/resources): `resources`
- [Workflow configuration](https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/config): `config`
- [Snakemake workflow](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/Snakefile): `workflow/Snakefile`
- [Ancestral extraction](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/alignment_processing.smk): `workflow/rules/alignment_processing.smk`
- [Coverage statistics](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/alignment_processing/report_ancestral_coverage.py): `workflow/scripts/alignment_processing/report_ancestral_coverage.py`

### Variant Sets

- [Derived variants](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/derive_variants.smk): `workflow/rules/derive_variants.smk`
- [Simulated variants](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/simulate_variants.smk): `workflow/rules/simulate_variants.smk`
- **Population variants**

### Annotations

- [Conservation data](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/generate_annotations.smk): `workflow/rules/generate_annotations.smk`
- [Variant annotation](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/annotate_variants.smk): `workflow/rules/annotate_variants.smk`
- [Annotation processors](https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/workflow/scripts/annotate_variants): `workflow/scripts/annotate_variants`

### Modeling and Scores

- [CADD score generation](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/cadd_score.smk): `workflow/rules/cadd_score.smk`
- [Score processing](https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/workflow/scripts/cadd_score): `workflow/scripts/cadd_score`
- [Feature preparation](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/annotate_variants/data_preparation.py): `workflow/scripts/annotate_variants/data_preparation.py`
- [Train and test](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/rules/train_test_model.smk): `workflow/rules/train_test_model.smk`
- [Model fitting](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/train_test_model/train_model.py): `workflow/scripts/train_test_model/train_model.py`

### Evaluation

- [Regional evaluation](https://github.com/rinaldi-rpy/smallruminantcadd/blob/main/workflow/scripts/train_test_model/average_auc_by_region.py): `workflow/scripts/train_test_model/average_auc_by_region.py`
- [Pipeline outputs](https://github.com/rinaldi-rpy/smallruminantcadd/tree/main/results): `results`

### Other components

- **Pipeline user**

## Connections

- Pipeline user → Snakemake workflow: runs
- Snakemake workflow → Workflow configuration: reads settings
- Snakemake workflow → Ancestral extraction: dispatches
- Reference and MSA → Ancestral extraction: provides sequences
- Ancestral extraction → Coverage statistics: coverage input
- Snakemake workflow → Conservation data: dispatches
- Reference and MSA → Conservation data: provides alignment
- Snakemake workflow → Derived variants: dispatches
- Reference and MSA → Derived variants: provides reference
- Population variants → Derived variants: provides variants
- Snakemake workflow → Simulated variants: dispatches
- Reference and MSA → Simulated variants: provides reference
- Snakemake workflow → Variant annotation: dispatches
- Derived variants → Variant annotation: variant input
- Simulated variants → Variant annotation: variant input
- Variant annotation → Annotation processors: invokes
- Conservation data → Variant annotation: annotation input
- Snakemake workflow → Train and test: dispatches
- Variant annotation → Feature preparation: annotated input
- Feature preparation → Train and test: prepared features
- Train and test → Model fitting: invokes
- Snakemake workflow → CADD score generation: dispatches
- Model fitting → CADD score generation: trained model
- Variant annotation → CADD score generation: annotated variants
- CADD score generation → Score processing: invokes
- Snakemake workflow → Regional evaluation: dispatches
- Train and test → Regional evaluation: test predictions
- Regional evaluation → Pipeline outputs: writes reports
- CADD score generation → Pipeline outputs: writes scores
- Coverage statistics → Pipeline outputs: writes statistics
