# rinaldi-rpy/population_variant_calling architecture

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

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

## Overview

This repository documents a Snakemake workflow that takes multi-sample FASTQ reads through trimming, mapping, alignment processing, QC and population variant calling to a filtered VCF. Separate shell and R scripts provide VCF threshold assessment and downstream population analyses. The main workflow and downstream script internals were not sampled, so links among their documented stages are shown only where the README describes them; no finer implementation wiring is assumed.

Main entry points: [`project/analysis.sh`](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/analysis.sh) (Analysis runner), [`Snakefile`](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile) (Snakemake workflow), [`project/qc_vcf.sh`](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/qc_vcf.sh) (VCF threshold QC), [`config.yaml`](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/config.yaml) (Workflow config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Read-to-VCF workflow"]
  node_snakemake["Snakemake workflow"]
  node_trimming["Read trimming"]
  node_reference["Reference indexing"]
  node_mapping["Read mapping"]
  node_postprocess["BAM processing"]
  node_alignmentqc["Alignment QC"]
  node_variantcalling["Variant calling"]
  node_filtering["VCF filtering"]
  node_config["Workflow config<br/>[config.yaml]"]
end

subgraph group_qc["Variant QC"]
  node_vcfqc["VCF threshold QC<br/>[qc_vcf.sh]"]
  node_qcmetrics["QC metrics"]
end

subgraph group_analysis["Population analysis"]
  node_analysis["Analysis runner<br/>[analysis.sh]"]
  node_admixture["Admixture plots<br/>[admixture_plot.r]"]
  node_candidategenes["Candidate genes<br/>[candidate_gene.r]"]
  node_circos["Circos plots<br/>[circos_plot.r]"]
  node_pca["PCA plots<br/>[pca_plot.r]"]
  node_rohfroh["ROH and FROH<br/>[roh_froh_cli.r]"]
  node_rohislands["ROH islands<br/>[roh_island_cli.r]"]
  node_analysisinputs["Population datasets"]
  node_metadata["Analysis metadata"]
end

subgraph group_outputs["Workflow outputs"]
  node_bam["Sorted BAMs"]
  node_mappingreports["Mapping reports"]
  node_populationvcf["Population VCF"]
end

node_sequencing["FASTQ reads"]

node_sequencing -->|"provides reads"| node_trimming
node_config -->|"configures"| node_snakemake
node_snakemake -->|"runs"| node_trimming
node_snakemake -->|"runs"| node_reference
node_snakemake -->|"runs"| node_mapping
node_snakemake -->|"runs"| node_postprocess
node_snakemake -->|"runs"| node_alignmentqc
node_snakemake -->|"runs"| node_variantcalling
node_snakemake -->|"runs"| node_filtering
node_trimming -->|"provides reads"| node_mapping
node_reference -->|"provides index"| node_mapping
node_mapping -->|"provides alignments"| node_postprocess
node_postprocess -->|"writes"| node_bam
node_postprocess -->|"provides BAMs"| node_alignmentqc
node_alignmentqc -->|"writes reports"| node_mappingreports
node_postprocess -->|"provides BAMs"| node_variantcalling
node_variantcalling -->|"provides variants"| node_filtering
node_filtering -->|"writes filtered VCF"| node_populationvcf
node_populationvcf -->|"assesses"| node_vcfqc
node_vcfqc -->|"writes metrics"| node_qcmetrics
node_qcmetrics -->|"guides thresholds"| node_analysis
node_analysisinputs -->|"provides VCFs"| node_analysis
node_metadata -->|"provides annotations"| node_analysis
node_analysis -->|"runs"| node_admixture
node_analysis -->|"runs"| node_candidategenes
node_analysis -->|"runs"| node_circos
node_analysis -->|"runs"| node_pca
node_analysis -->|"runs"| node_rohfroh
node_analysis -->|"runs"| node_rohislands

click node_snakemake "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_trimming "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_reference "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_mapping "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_postprocess "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_alignmentqc "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_variantcalling "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_filtering "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile"
click node_config "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/config.yaml"
click node_vcfqc "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/qc_vcf.sh"
click node_analysis "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/analysis.sh"
click node_admixture "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/admixture_plot.r"
click node_candidategenes "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/candidate_gene.r"
click node_circos "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/circos_plot.r"
click node_pca "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/pca_plot.r"
click node_rohfroh "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/roh_froh_cli.r"
click node_rohislands "https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/roh_island_cli.r"
click node_analysisinputs "https://github.com/rinaldi-rpy/population_variant_calling/tree/main/project/data"
click node_metadata "https://github.com/rinaldi-rpy/population_variant_calling/tree/main/project/input"

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_snakemake,node_trimming,node_reference,node_mapping,node_postprocess,node_alignmentqc,node_variantcalling,node_filtering,node_config toneBlue
class node_vcfqc,node_qcmetrics toneAmber
class node_analysis,node_admixture,node_candidategenes,node_circos,node_pca,node_rohfroh,node_rohislands,node_analysisinputs,node_metadata toneMint
class node_bam,node_mappingreports,node_populationvcf toneRose
class node_sequencing toneIndigo
```

## Components

### Read-to-VCF workflow

- [Snakemake workflow](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [Read trimming](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [Reference indexing](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [Read mapping](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [BAM processing](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [Alignment QC](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [Variant calling](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [VCF filtering](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/Snakefile): `Snakefile`
- [Workflow config](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/config.yaml): `config.yaml`

### Variant QC

- [VCF threshold QC](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/qc_vcf.sh): `project/qc_vcf.sh`
- **QC metrics**

### Population analysis

- [Analysis runner](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/analysis.sh): `project/analysis.sh`
- [Admixture plots](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/admixture_plot.r): `project/code/admixture_plot.r`
- [Candidate genes](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/candidate_gene.r): `project/code/candidate_gene.r`
- [Circos plots](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/circos_plot.r): `project/code/circos_plot.r`
- [PCA plots](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/pca_plot.r): `project/code/pca_plot.r`
- [ROH and FROH](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/roh_froh_cli.r): `project/code/roh_froh_cli.r`
- [ROH islands](https://github.com/rinaldi-rpy/population_variant_calling/blob/main/project/code/roh_island_cli.r): `project/code/roh_island_cli.r`
- [Population datasets](https://github.com/rinaldi-rpy/population_variant_calling/tree/main/project/data): `project/data`
- [Analysis metadata](https://github.com/rinaldi-rpy/population_variant_calling/tree/main/project/input): `project/input`

### Workflow outputs

- **Sorted BAMs**
- **Mapping reports**
- **Population VCF**

### Other components

- **FASTQ reads**

## Connections

- FASTQ reads → Read trimming: provides reads
- Workflow config → Snakemake workflow: configures
- Snakemake workflow → Read trimming: runs
- Snakemake workflow → Reference indexing: runs
- Snakemake workflow → Read mapping: runs
- Snakemake workflow → BAM processing: runs
- Snakemake workflow → Alignment QC: runs
- Snakemake workflow → Variant calling: runs
- Snakemake workflow → VCF filtering: runs
- Read trimming → Read mapping: provides reads
- Reference indexing → Read mapping: provides index
- Read mapping → BAM processing: provides alignments
- BAM processing → Sorted BAMs: writes
- BAM processing → Alignment QC: provides BAMs
- Alignment QC → Mapping reports: writes reports
- BAM processing → Variant calling: provides BAMs
- Variant calling → VCF filtering: provides variants
- VCF filtering → Population VCF: writes filtered VCF
- Population VCF → VCF threshold QC: assesses
- VCF threshold QC → QC metrics: writes metrics
- QC metrics → Analysis runner: guides thresholds
- Population datasets → Analysis runner: provides VCFs
- Analysis metadata → Analysis runner: provides annotations
- Analysis runner → Admixture plots: runs
- Analysis runner → Candidate genes: runs
- Analysis runner → Circos plots: runs
- Analysis runner → PCA plots: runs
- Analysis runner → ROH and FROH: runs
- Analysis runner → ROH islands: runs
