# yazbraimah/nywws architecture

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

- Interactive diagram: https://gitdiagram.com/yazbraimah/nywws
- Repository: https://github.com/yazbraimah/nywws

## Overview

NYWWS is a Snakemake pipeline for identifying and quantifying SARS-CoV-2 variants in New York wastewater BAM samples using Freyja. Users generate a BAM sample manifest, configure inputs, and run the workflow; Freyja variant results can be parsed into sample-level abundances. The repository also includes a results-summary script and a separate deprecated mutation-based deconvolution tool. Workflow internals are not excerpted, so links beyond the documented execution path are omitted or marked unverified.

Main entry points: [`Snakefile`](https://github.com/yazbraimah/nywws/blob/main/Snakefile) (Snakemake workflow), [`deprecated/scripts/deconvolveVariants.py`](https://github.com/yazbraimah/nywws/blob/main/deprecated/scripts/deconvolveVariants.py) (Mutation deconvolution), [`scripts/make_bam_json_samples.py`](https://github.com/yazbraimah/nywws/blob/main/scripts/make_bam_json_samples.py) (Manifest generator), [`samples_bam.json`](https://github.com/yazbraimah/nywws/blob/main/samples_bam.json) (BAM manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and configuration"]
  node_bam_samples["BAM samples"]
  node_manifest_generator["Manifest generator"]
  node_sample_manifest["BAM manifest<br/>[samples_bam.json]"]
  node_configuration["Pipeline config<br/>[config.yml]"]
end

subgraph group_workflow["Variant surveillance"]
  node_workflow["Snakemake workflow"]
  node_freyja["Freyja analysis"]
  node_reference_assets["Reference assets"]
end

subgraph group_results["Results handling"]
  node_variant_results["Demix results"]
  node_demix_parser["Demix parser<br/>[parse_demix.py]"]
  node_summary["Results summary"]
end

subgraph group_legacy["Deprecated analysis"]
  node_legacy_calls["Variant calls"]
  node_legacy_database["Variant definitions"]
  node_legacy_deconvolution["Mutation deconvolution"]
  node_legacy_reports["Legacy reports"]
end

node_user(("Pipeline user"))

node_user -->|"provides BAMs"| node_bam_samples
node_user -->|"runs generator"| node_manifest_generator
node_manifest_generator -->|"writes manifest"| node_sample_manifest
node_user -->|"configures paths"| node_configuration
node_user -->|"runs pipeline"| node_workflow
node_workflow -->|"uses for quantification"| node_freyja
node_workflow -.->|"reads samples"| node_sample_manifest
node_workflow -.->|"reads settings"| node_configuration
node_workflow -.->|"may use references"| node_reference_assets
node_freyja -.->|"produces results"| node_variant_results
node_user -->|"parses results"| node_demix_parser
node_variant_results -->|"reads demix file"| node_demix_parser
node_user -.->|"generates summary"| node_summary
node_legacy_calls -->|"reads calls"| node_legacy_deconvolution
node_legacy_database -->|"loads definitions"| node_legacy_deconvolution
node_legacy_deconvolution -->|"writes reports"| node_legacy_reports

click node_manifest_generator "https://github.com/yazbraimah/nywws/blob/main/scripts/make_bam_json_samples.py"
click node_sample_manifest "https://github.com/yazbraimah/nywws/blob/main/samples_bam.json"
click node_configuration "https://github.com/yazbraimah/nywws/blob/main/config.yml"
click node_workflow "https://github.com/yazbraimah/nywws/blob/main/Snakefile"
click node_demix_parser "https://github.com/yazbraimah/nywws/blob/main/scripts/parse_demix.py"
click node_summary "https://github.com/yazbraimah/nywws/blob/main/scripts/results_summary_outputs.R"
click node_reference_assets "https://github.com/yazbraimah/nywws/tree/main/reference"
click node_legacy_deconvolution "https://github.com/yazbraimah/nywws/blob/main/deprecated/scripts/deconvolveVariants.py"

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_bam_samples,node_manifest_generator,node_sample_manifest,node_configuration,node_user toneBlue
class node_workflow,node_freyja,node_reference_assets toneAmber
class node_variant_results,node_demix_parser,node_summary toneMint
class node_legacy_calls,node_legacy_database,node_legacy_deconvolution,node_legacy_reports toneRose
```

## Components

### Inputs and configuration

- **BAM samples**
- [Manifest generator](https://github.com/yazbraimah/nywws/blob/main/scripts/make_bam_json_samples.py): `scripts/make_bam_json_samples.py`
- [BAM manifest](https://github.com/yazbraimah/nywws/blob/main/samples_bam.json): `samples_bam.json`
- [Pipeline config](https://github.com/yazbraimah/nywws/blob/main/config.yml): `config.yml`

### Variant surveillance

- [Snakemake workflow](https://github.com/yazbraimah/nywws/blob/main/Snakefile): `Snakefile`
- **Freyja analysis**
- [Reference assets](https://github.com/yazbraimah/nywws/tree/main/reference): `reference`

### Results handling

- **Demix results**
- [Demix parser](https://github.com/yazbraimah/nywws/blob/main/scripts/parse_demix.py): `scripts/parse_demix.py`
- [Results summary](https://github.com/yazbraimah/nywws/blob/main/scripts/results_summary_outputs.R): `scripts/results_summary_outputs.R`

### Deprecated analysis

- **Variant calls**
- **Variant definitions**
- [Mutation deconvolution](https://github.com/yazbraimah/nywws/blob/main/deprecated/scripts/deconvolveVariants.py): `deprecated/scripts/deconvolveVariants.py`
- **Legacy reports**

### Other components

- **Pipeline user**

## Connections

- Pipeline user → BAM samples: provides BAMs (evidence: `README.md`)
- Pipeline user → Manifest generator: runs generator (evidence: `README.md`)
- Manifest generator → BAM manifest: writes manifest (evidence: `scripts/make_bam_json_samples.py`)
- Pipeline user → Pipeline config: configures paths (evidence: `README.md`)
- Pipeline user → Snakemake workflow: runs pipeline (evidence: `README.md`)
- Snakemake workflow → Freyja analysis: uses for quantification (evidence: `README.md`)
- Snakemake workflow → BAM manifest: reads samples
- Snakemake workflow → Pipeline config: reads settings
- Snakemake workflow → Reference assets: may use references
- Freyja analysis → Demix results: produces results
- Pipeline user → Demix parser: parses results (evidence: `scripts/parse_demix.py`)
- Demix results → Demix parser: reads demix file (evidence: `scripts/parse_demix.py`)
- Pipeline user → Results summary: generates summary
- Variant calls → Mutation deconvolution: reads calls (evidence: `deprecated/scripts/deconvolveVariants.py`)
- Variant definitions → Mutation deconvolution: loads definitions (evidence: `deprecated/scripts/deconvolveVariants.py`)
- Mutation deconvolution → Legacy reports: writes reports (evidence: `deprecated/scripts/deconvolveVariants.py`)
