# vandan-revanur/pychemprojections architecture

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

- Interactive diagram: https://gitdiagram.com/vandan-revanur/pychemprojections
- Repository: https://github.com/vandan-revanur/pychemprojections

## Overview

##### Project type and purpose
- pychemprojections is an open-source Python library (not a web app or microservice) whose sole purpose is to take a SMILES string and render one of three 2D chemical projections (Fischer, Newman, WedgeDash).
- It provides both a programmatic API (via python imports) and a CLI entry point (`__main__.py`) for each projection.

##### File structure
- Top-level:
- `.github/workflows/` – CI pipelines (lint, test, stats).
- `examples/` – Jupyter notebooks demonstrating library usage.
- `pyproject.toml` – build configuration.
- Core package `pychemprojections/` with these subpackages:
- `fischer/`, `newman/`, `wedgedash/`
– each has:
– `__main__.py` (CLI entry),
– `stringmanipulation.py` (SMILES parsing & transformation),
– `visualization.py` (final plotting logic),
– extra helpers (`multiplechiral.py`, `bondoperations.py`, etc.).
- `utils/`
– `logger_utils.py` (logging setup),
– `rdkit_utils.py` (calls into RDKit for chemical graph ops),
– `smiles_manipulation_utils.py` (shared SMILES routines).

##### Extract insights from the README
- Confirms it’s purely a visualization library.
- Mentions external dependency on RDKit (for underlying molecule handling) and a styling policy (Black).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Input
    SMILES["SMILES String"]:::input

    %% CLI/API Layer
    subgraph "CLI/API Entry Points"
        direction TB
        FischerCLI["Fischer CLI/API"]:::cli
        NewmanCLI["Newman CLI/API"]:::cli
        WedgeDashCLI["WedgeDash CLI/API"]:::cli
    end

    %% Fischer Module
    subgraph "Fischer Projection Module" 
        direction TB
        FParser["Fischer SMILES Parser"]:::projection
        FDraw["Fischer Drawing Classes"]:::projection
        FMulti["Multiple Chiral Helper"]:::projection
        FSingle["Single Chiral Helper"]:::projection
        FVis["Fischer Visualization"]:::projection
    end

    %% Newman Module
    subgraph "Newman Projection Module"
        direction TB
        NParser["Newman SMILES Parser"]:::projection
        NDraw["Newman Drawing Classes"]:::projection
        NElem["Drawing Elements Helper"]:::projection
        NVis["Newman Visualization"]:::projection
    end

    %% WedgeDash Module
    subgraph "WedgeDash Projection Module"
        direction TB
        WBond["Bond Operations Helper"]:::projection
        WVis["WedgeDash Visualization"]:::projection
    end

    %% Shared Utilities
    subgraph "Shared Utilities"
        direction TB
        Logger["Logger Utility"]:::utils
        RDKitUtil["RDKit Utility"]:::utils
        SMILESUtil["SMILES Manipulation Utility"]:::utils
    end

    %% External Dependency
    RDKit["RDKit Library"]:::external

    %% Output
    Output["2D Projection Image/Notebook Output"]:::output

    %% Connections
    SMILES --> FischerCLI
    SMILES --> NewmanCLI
    SMILES --> WedgeDashCLI

    FischerCLI --> FParser
    NewmanCLI --> NParser
    WedgeDashCLI --> WBond

    FParser --> RDKitUtil
    NParser --> RDKitUtil
    WBond --> RDKitUtil

    FParser --> FMulti
    FParser --> FSingle
    FParser --> FDraw

    NParser --> NDraw
    NParser --> NElem

    FDraw --> FVis
    FMulti --> FVis
    FSingle --> FVis

    NDraw --> NVis
    NElem --> NVis

    WBond --> WVis

    FVis --> Output
    NVis --> Output
    WVis --> Output

    %% Shared Utils connections
    Logger --> FParser
    Logger --> FDraw
    Logger --> FVis
    Logger --> NParser
    Logger --> NDraw
    Logger --> NVis
    Logger --> WBond
    Logger --> WVis
    SMILESUtil --> FParser
    SMILESUtil --> NParser

    %% RDKit library interactions
    RDKit --> RDKitUtil

    %% Click Events
    click FischerCLI "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/fischer/__main__.py"
    click FParser "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/fischer/stringmanipulation.py"
    click FDraw "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/fischer/drawingclasses.py"
    click FMulti "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/fischer/multiplechiral.py"
    click FSingle "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/fischer/singlechiral.py"
    click FVis "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/fischer/visualization.py"

    click NewmanCLI "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/newman/__main__.py"
    click NParser "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/newman/stringmanipulation.py"
    click NDraw "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/newman/drawingclasses.py"
    click NElem "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/newman/drawingelements.py"
    click NVis "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/newman/visualization.py"

    click WedgeDashCLI "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/wedgedash/__main__.py"
    click WBond "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/wedgedash/bondoperations.py"
    click WVis "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/wedgedash/visualization.py"

    click Logger "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/utils/logger_utils.py"
    click RDKitUtil "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/utils/rdkit_utils.py"
    click SMILESUtil "https://github.com/vandan-revanur/pychemprojections/blob/master/pychemprojections/utils/smiles_manipulation_utils.py"

    classDef input fill:#f0f8ff,stroke:#333,stroke-width:1px
    classDef cli fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef projection fill:#add8e6,stroke:#333,stroke-width:1px
    classDef utils fill:#90ee90,stroke:#333,stroke-width:1px
    classDef external fill:#ffa500,stroke:#333,stroke-width:1px
    classDef output fill:#ffffe0,stroke:#333,stroke-width:1px
```
