# jianglab/helicon architecture

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

- Interactive diagram: https://gitdiagram.com/jianglab/helicon
- Repository: https://github.com/jianglab/helicon

## Overview

##### Main components of Helicon
- Command-Line Interface (CLI): The entry point of the tool (invoked via “helicon --help”) which dispatches different analysis commands.
- Commands Modules: Under the src/helicon/commands directory, each file (e.g., cryosparc.py, ctfSimulation.py, denovo3D.py, etc.) encapsulates a specific tool’s logic. Some commands work as a CLI-only tool while others may launch a process or web interface.
- Shared Libraries: The src/helicon/lib directory contains utility functions and analysis routines (e.g., analysis, dataset, filters, io, transforms, and shiny) that are consumed by the commands and web apps.
- Web Applications: Located in src/helicon/webApps, these subdirectories (e.g., denovo3D and whereIsMyClass) each include an app.py and compute.py. They define interactive interfaces that likely build on the core library functionality.

##### Relationships and interactions
- The CLI component routes user commands to the appropriate command module.
- Each command module uses the shared libraries for processing data (e.g., handling input/output, analysis, transformations).
- Some command modules may directly trigger or open a web application interface (or use compute modules) to perform more interactive processes.
- WebApps also rely on the same libraries to obtain consistency with the command-line implementations.

##### Architectural patterns and design principles
- Modular Design: The clear separation into commands, shared libraries, and web applications indicates modular decomposition. This pattern improves maintainability since each module has a specific responsibility.
- Reuse and DRY Principles: The lib folder abstracts common functionalities that are shared across various tools, ensuring that code is reusable and centralizing logic.
- Integration with External Systems: For instance, the cryosparc command shows an integration pattern where Helicon interacts with an external CryoSPARC server for image analysis tasks.

##### Relevant technologies and frameworks
- Python as the primary programming language.
- CLI frameworks/libraries (possibly using standard libraries or third-party tools) to parse commands and options.
- Web frameworks for the web apps (the layout – with app.py and compute.py – suggests a lightweight Python web framework like Flask or a similar microframework).
- Dependency management via pyproject.toml and installation via pip.

##### Final advice
- Clarity by grouping closely related files into higher-level components (e.g., grouping all the command-line tools together, all web apps together, and centralizing shared functionality).

## Diagram (Mermaid)

```mermaid
graph TD
    %% CLI Launcher
    CLI_Launcher["CLI Launcher"]:::cli
    click CLI_Launcher "https://github.com/jianglab/helicon/blob/main/src/helicon/helicon.py"

    %% Command Modules Subgraph
    subgraph "Command Modules"
        cryosparc["cryosparc.py"]:::command
        click cryosparc "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/cryosparc.py"
        ctfSimulation["ctfSimulation.py"]:::command
        click ctfSimulation "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/ctfSimulation.py"
        denovo3D["denovo3D.py"]:::command
        click denovo3D "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/denovo3D.py"
        denovo3DBatch["denovo3DBatch.py"]:::command
        click denovo3DBatch "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/denovo3DBatch.py"
        helicalLattice["helicalLattice.py"]:::command
        click helicalLattice "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/helicalLattice.py"
        helicalPitch["helicalPitch.py"]:::command
        click helicalPitch "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/helicalPitch.py"
        helicalProjection["helicalProjection.py"]:::command
        click helicalProjection "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/helicalProjection.py"
        hi3d["hi3d.py"]:::command
        click hi3d "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/hi3d.py"
        hill["hill.py"]:::command
        click hill "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/hill.py"
        images2star["images2star.py"]:::command
        click images2star "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/images2star.py"
        map2seq["map2seq.py"]:::command
        click map2seq "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/map2seq.py"
        procart["procart.py"]:::command
        click procart "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/procart.py"
        whereIsMyClassCmd["whereIsMyClass.py"]:::command
        click whereIsMyClassCmd "https://github.com/jianglab/helicon/blob/main/src/helicon/commands/whereIsMyClass.py"
    end

    %% Web Applications Subgraph
    subgraph "Web Applications"
        denovo3D_WebApp["denovo3D WebApp"]:::web
        click denovo3D_WebApp "https://github.com/jianglab/helicon/tree/main/src/helicon/webApps/denovo3D"
        whereIsMyClass_WebApp["whereIsMyClass WebApp"]:::web
        click whereIsMyClass_WebApp "https://github.com/jianglab/helicon/tree/main/src/helicon/webApps/whereIsMyClass"
    end

    %% Shared Libraries Subgraph
    subgraph "Shared Libraries"
        analysis["analysis.py"]:::lib
        click analysis "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/analysis.py"
        dataset["dataset.py"]:::lib
        click dataset "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/dataset.py"
        filters["filters.py"]:::lib
        click filters "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/filters.py"
        io["io.py"]:::lib
        click io "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/io.py"
        shiny["shiny.py"]:::lib
        click shiny "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/shiny.py"
        transforms["transforms.py"]:::lib
        click transforms "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/transforms.py"
        util["util.py"]:::lib
        click util "https://github.com/jianglab/helicon/blob/main/src/helicon/lib/util.py"
    end

    %% External Integration
    cryosparcServer["CryoSPARC Server"]:::external

    %% Relationships from CLI Launcher to Command Modules
    CLI_Launcher --> cryosparc
    CLI_Launcher --> ctfSimulation
    CLI_Launcher --> denovo3D
    CLI_Launcher --> denovo3DBatch
    CLI_Launcher --> helicalLattice
    CLI_Launcher --> helicalPitch
    CLI_Launcher --> helicalProjection
    CLI_Launcher --> hi3d
    CLI_Launcher --> hill
    CLI_Launcher --> images2star
    CLI_Launcher --> map2seq
    CLI_Launcher --> procart
    CLI_Launcher --> whereIsMyClassCmd

    %% Command Modules use Shared Libraries (representative connection to analysis.py)
    cryosparc -->|"uses"| analysis
    ctfSimulation -->|"uses"| analysis
    denovo3D -->|"uses"| analysis
    denovo3DBatch -->|"uses"| analysis
    helicalLattice -->|"uses"| analysis
    helicalPitch -->|"uses"| analysis
    helicalProjection -->|"uses"| analysis
    hi3d -->|"uses"| analysis
    hill -->|"uses"| analysis
    images2star -->|"uses"| analysis
    map2seq -->|"uses"| analysis
    procart -->|"uses"| analysis
    whereIsMyClassCmd -->|"uses"| analysis

    %% Web Applications use Shared Libraries
    denovo3D_WebApp -->|"uses"| analysis
    whereIsMyClass_WebApp -->|"uses"| analysis

    %% Command Modules trigger Web Applications
    denovo3D -->|"launches"| denovo3D_WebApp
    whereIsMyClassCmd -->|"launches"| whereIsMyClass_WebApp

    %% External Integration from cryosparc command
    cryosparc -->|"calls"| cryosparcServer

    %% Style Classes
    classDef cli fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef command fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef lib fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef web fill:#ffffcc,stroke:#999900,stroke-width:2px;
    classDef external fill:#ffebcc,stroke:#ff6600,stroke-width:2px;
```
