# cfsan-biostatistics/ww_simulations architecture

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

- Interactive diagram: https://gitdiagram.com/cfsan-biostatistics/ww_simulations
- Repository: https://github.com/cfsan-biostatistics/ww_simulations

## Overview

##### Project Type Analysis
This is a specialized bioinformatics pipeline/workflow tool consisting of multiple Python scripts that work together to generate and process simulated genomic datasets.

##### Main Components

A. Input Components:
- Accessions file (accessions.txt)
- Reference sequences (five_sequences.fasta)
- Primer information (neb_vss1a_primer.tsv)

B. Processing Scripts:
- Primary scripts:
- generate_replicates.py
- generate_simulated_datasets.py
- Supporting scripts:
- bed_to_primers.py
- coverage_results_processing.py
- fq_to_replicate_composition_info.py
- results_parsing.py

C. External Dependencies:
- ART (read simulator)
- in_silico_pcr.pl

**[Input Data] → [Processing Pipeline] → [Output Data]**

**[accessions.txt] →[generate_replicates.py] → [replicate_X.tsv] →**
**[five_sequences.fasta]─┐**
**[neb_vss1a_primer.tsv]─┼→[generate_simulated_datasets.py]→[simulated reads]**
**[replicate_X.tsv]──────┘**

##### Key Elements to Highlight

a) Data Flow:
- How accessions.txt feeds into generate_replicates.py
- How the output of generate_replicates.py becomes input for generate_simulated_datasets.py
- Integration points with external tools (ART and in_silico_pcr.pl)

b) Processing Steps:
- Read coverage simulation step using ART

##### Additional Recommendations

- Annotations for key parameters (e.g., -n for number of replicates, -f for fold coverage)
- Version information for critical dependencies (Python 3.8.1)

##### Technical Details

- Mathematical relationship between variant composition and amplicon multiplication
- Where coverage fold parameters affect the pipeline
- Points where quality control or validation might occur

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph Inputs
        A1[accessions.txt]:::input
        A2[five_sequences.fasta]:::input
        A3[neb_vss1a_primer.tsv]:::input
    end

    subgraph "Primary Processing"
        B1[generate_replicates.py]:::primary
        B2[generate_simulated_datasets.py]:::primary
    end

    subgraph "Supporting Scripts"
        C1[bed_to_primers.py]:::support
        C2[coverage_results_processing.py]:::support
        C3[fq_to_replicate_composition_info.py]:::support
        C4[results_parsing.py]:::support
    end

    subgraph "External Tools"
        D1[ART Read Simulator]:::external
        D2[in_silico_pcr.pl]:::external
    end

    subgraph "Configuration"
        E1[requirements.txt]:::config
        E2[README.md]:::config
        E3[.gitignore]:::config
    end

    subgraph "Outputs"
        F1[replicate_X.tsv]:::output
        F2[simulated_reads]:::output
    end

    %% Main workflow connections
    A1 --> B1
    B1 --> F1
    F1 --> B2
    A2 --> B2
    A3 --> B2
    B2 --> F2

    %% External tool connections
    B2 -.-> D1
    B2 -.-> D2
    D1 --> F2

    %% Supporting script connections
    C1 -.-> B2
    C2 -.-> B2
    C3 -.-> B2
    C4 -.-> B2

    %% Click events
    click A1 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/accessions.txt"
    click A2 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/five_sequences.fasta"
    click A3 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/neb_vss1a_primer.tsv"
    click B1 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/generate_replicates.py"
    click B2 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/generate_simulated_datasets.py"
    click C1 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/bed_to_primers.py"
    click C2 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/coverage_results_processing.py"
    click C3 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/fq_to_replicate_composition_info.py"
    click C4 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/results_parsing.py"
    click E1 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/requirements.txt"
    click E2 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/README.md"
    click E3 "https://github.com/CFSAN-Biostatistics/ww_simulations/blob/master/.gitignore"

    %% Styling
    classDef input fill:#90EE90,stroke:#333,stroke-width:2px
    classDef primary fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef support fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px
    classDef output fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef config fill:#F0E68C,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Input Files]:::input
        L2[Primary Scripts]:::primary
        L3[Supporting Scripts]:::support
        L4[External Tools]:::external
        L5[Output Files]:::output
        L6[Configuration]:::config
    end
```
