# lineardesignsoftware/lineardesign architecture

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

- Interactive diagram: https://gitdiagram.com/lineardesignsoftware/lineardesign
- Repository: https://github.com/lineardesignsoftware/lineardesign

## Overview

##### Main Application/Executable
- That this component interacts with the command-line interface (CLI) by accepting input (via STDIN or a file) and handling command-line options (like –lambda, –codonusage, and –verbose).

##### Input Handling
- Subcomponents such as the CLI interface that takes in sequences (entered directly or piped from a FASTA file) and the parser that interprets these sequences.
- You might label parts of this node with “Input Parsing” and link it to the core algorithm.

##### Core Algorithm and Parsing Modules
- “Algorithm Core” or “mRNA Design Engine” which, based on the file tree, is implemented in files like “linear_design.cpp”, “beam_cky_parser.cc/h”, and possibly others in the src directory.
- That the core algorithm uses the “Beam CKY Parser” (as seen in beam_cky_parser.cc/h) that likely handles sequence alignment or structural prediction, and integrates the dynamic programming or beam search strategy.

##### Utility and Helper Libraries
- A component labelled “Utils & Helpers” that represents the files in the “src/Utils” directory. This includes general constants, network functionality (if applicable), codon parsing (codon.h), and common utility functions.
- That both the Core Algorithm and Input Handling modules depend on these utilities.

##### External Data and Configurations
- An “External Data Module” that handles the Codon Usage Frequency Tables (the CSV files for human and yeast). This module is accessed based on CLI options (for example, via –codonusage) and is used to override the default human codon frequency.
- To show that this module interacts with the core algorithm to influence the design output.

##### Output Formatter
- A node that handles formatting of the mRNA sequence, secondary structure, free energy, and CAI results.

##### Build and Deployment

In terms of diagramming details:

For this project, which is a highly algorithmic tool rather than a multi-layered application, aim to capture every nontrivial component – from parsing and input handling through to the core optimization algorithm and helper utilities – while keeping the flow clear. Emphasize detail and clarity over high abstraction by showing distinct modules (even if there are several utility functions) so that every major step (i.e., sequence parsing, algorithmic core processing, codon-usage integration, and output formatting) is visible.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime Execution Subgraph
    subgraph "Runtime Execution"
        LD["lineardesign (Executable)"]:::maincomponent
        subgraph "Input Handling"
            CLI["CLI Input Parser"]:::input
        end
        subgraph "Algorithm Core"
            Engine["mRNA Design Engine"]:::core
            BCKY_cc["Beam CKY Parser (cc)"]:::core
            BCKY_h["Beam CKY Parser (h)"]:::core
        end
        subgraph "Utilities"
            Utils["Utils & Helpers"]:::util
        end
        subgraph "External Data"
            CSV_H["Human Codon Usage CSV"]:::external
            CSV_Y["Yeast Codon Usage CSV"]:::external
        end
        OF["Output Formatter"]:::output
    end

    %% Build and Deployment (Auxiliary)
    Build["Build/Compile"]:::build

    %% Data Flow Connections
    LD -->|"start"| CLI
    CLI -->|"parseInput"| Engine
    CLI -->|"uses"| Utils
    Engine -->|"dependsOn"| Utils
    Engine -->|"calls"| BCKY_cc
    Engine -->|"calls"| BCKY_h
    Engine -->|"integrates"| CSV_H
    Engine -->|"integrates"| CSV_Y
    Engine -->|"formats"| OF
    OF -->|"displayResults"| LD

    %% Build is auxiliary and connected as note (dotted arrow)
    LD ---|"builtWith"| Build

    %% Click Events
    click LD "https://github.com/lineardesignsoftware/lineardesign/blob/main/src/linear_design.cpp"
    click CLI "https://github.com/lineardesignsoftware/lineardesign/blob/main/src/linear_design.cpp"
    click Engine "https://github.com/lineardesignsoftware/lineardesign/blob/main/src/linear_design.cpp"
    click BCKY_cc "https://github.com/lineardesignsoftware/lineardesign/blob/main/src/beam_cky_parser.cc"
    click BCKY_h "https://github.com/lineardesignsoftware/lineardesign/blob/main/src/beam_cky_parser.h"
    click Utils "https://github.com/lineardesignsoftware/lineardesign/tree/main/src/Utils"
    click CSV_H "https://github.com/lineardesignsoftware/lineardesign/blob/main/codon_usage_freq_table_human.csv"
    click CSV_Y "https://github.com/lineardesignsoftware/lineardesign/blob/main/codon_usage_freq_table_yeast.csv"
    click OF "https://github.com/lineardesignsoftware/lineardesign/blob/main/src/linear_design.cpp"
    click Build "https://github.com/lineardesignsoftware/lineardesign/tree/main/Makefile"

    %% Styles
    classDef maincomponent fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef input fill:#D5F5E3,stroke:#145A32,stroke-width:2px;
    classDef core fill:#F9E79F,stroke:#7D6608,stroke-width:2px;
    classDef util fill:#FAD7A0,stroke:#9A7D0A,stroke-width:2px;
    classDef external fill:#E8DAEF,stroke:#4A235A,stroke-width:2px;
    classDef output fill:#D6EAF8,stroke:#1A5276,stroke-width:2px;
    classDef build fill:#F5CBA7,stroke:#873600,stroke-width:2px;
```
