# sml-compbio/oncomark architecture

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

- Interactive diagram: https://gitdiagram.com/sml-compbio/oncomark
- Repository: https://github.com/sml-compbio/oncomark

## Overview

##### Main Components
- Core Library (OncoMark Package): This includes files such as oncomark.py, hallmark_feature.txt, hallmark_model.keras, and hallmark_scaler.joblib within the OncoMark directory. This is the central component implementing the deep learning prediction logic.
- Data Preprocessing & Model Training: Under the src directory you have several notebooks (e.g., Model_Train_Data_Prep.ipynb, Model_Train_and_Int_Val.ipynb, etc.) which indicate that there is a data preparation and training pipeline. These components reflect the model training, validation, and data handling stages.
- Web Server Interface: The webserver directory contains its own copy of key model assets (e.g., OncoMark.py, mlm.py, ulm.py, plotting.py) plus sample data (collectri_df.csv, progeny_df.csv) and a README for the web server. This component is responsible for exposing the OncoMark functionality via a web interface.
- Testing/Validation: The test directory contains test notebooks and sample test data to ensure model accuracy and integration.
- Documentation & Deployment Artifacts: The docs folder, Workflow.md, and configuration files (mkdocs.yml, readthedocs.yaml, setup.py, requirements.txt) form the supportive components necessary for documentation and deployment.

##### Detail the Relationships and Data Flows
- Data Flow: Start with the user-provided transcriptomics data (from tumor biopsies) entering the system. In the Python API, data is processed, passed to the ML model (loaded from keras and scaled using joblib), and then predictions are returned.
- Web Server Interaction: For the web interface, show how the web server accepts data requests, passes them to the core prediction library, and returns predictions for visualization or further analysis.
- Testing: Incorporate the model testing pipeline showing how automated tests (with notebooks and CSV sample data in the test folder) validate the outputs.

##### Architectural Patterns and Technologies
- Multi-layer Architecture: Represent a clear separation of concerns:
- Input Layer – where data is ingested.
- Business Logic Layer – the core prediction functions (the OncoMark API and model components).
- Presentation Layer – the web server component serving a user interface.
- That the project uses a multi-task learning (deep learning) approach as part of its neural network design. The core components (using keras for the model and joblib for scaling) are central to this design.
- Use of notebooks for exploratory data analysis, model training, and validation. These act as a developmental and experimental interface.
- Integration of external libraries/frameworks (such as keras, joblib, and any web server framework employed in the webserver folder) as well as configuration for documentation deployment (mkdocs, readthedocs).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Input Layer
    subgraph "Input Layer"
        D1("User Transcriptomics Data"):::input
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        subgraph "Data Preprocessing & Model Training"
            DPP1("Model_Train_Data_Prep.ipynb"):::dataprep
            DPP2("Model_Train_and_Int_Val.ipynb"):::dataprep
            DPP3("Model_Val_Ext_Syn_Data.ipynb"):::dataprep
            DPP4("Model_Val_Normal_Cancer.ipynb"):::dataprep
        end
        subgraph "Core Prediction Engine"
            C1("oncomark.py"):::prediction
            C2("hallmark_feature.txt"):::prediction
            C3("hallmark_model.keras"):::prediction
            C4("hallmark_scaler.joblib"):::prediction
        end
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        subgraph "Web Server Interface"
            W1("OncoMark.py"):::web
            W2("mlm.py"):::web
            W3("ulm.py"):::web
            W4("plotting.py"):::web
            W5("collectri_df.csv"):::web
            W6("progeny_df.csv"):::web
        end
    end

    %% Support Components
    subgraph "Support"
        subgraph "Testing & Validation"
            T1("model_test_code.ipynb"):::testing
            T2("model_test_data.csv"):::testing
        end
        subgraph "Documentation & Deployment"
            Doc1("docs/index.md"):::docs
            Doc2("docs/installation.md"):::docs
            Doc3("docs/usage.md"):::docs
            Doc4("docs/dataset.md"):::docs
            Doc5("Workflow.md"):::docs
            Doc6("mkdocs.yml"):::docs
            Doc7("readthedocs.yaml"):::docs
            Doc8("setup.py"):::docs
            Doc9("requirements.txt"):::docs
        end
    end

    %% Data Flow Arrows
    D1 -->|"input"| DPP1
    D1 -->|"input"| W1
    DPP1 -->|"preprocess"| C1
    DPP2 -->|"preprocess"| C1
    DPP3 -->|"preprocess"| C1
    DPP4 -->|"preprocess"| C1
    C1 -->|"predict"| W1
    T1 -->|"test"| C1
    T2 -->|"test"| C1

    %% Click Events for Core Prediction Engine
    click C1 "https://github.com/sml-compbio/oncomark/blob/main/OncoMark/oncomark.py"
    click C2 "https://github.com/sml-compbio/oncomark/blob/main/OncoMark/hallmark_feature.txt"
    click C3 "https://github.com/sml-compbio/oncomark/blob/main/OncoMark/hallmark_model.keras"
    click C4 "https://github.com/sml-compbio/oncomark/blob/main/OncoMark/hallmark_scaler.joblib"

    %% Click Events for Data Preprocessing & Model Training
    click DPP1 "https://github.com/sml-compbio/oncomark/blob/main/src/Model_Train_Data_Prep.ipynb"
    click DPP2 "https://github.com/sml-compbio/oncomark/blob/main/src/Model_Train_and_Int_Val.ipynb"
    click DPP3 "https://github.com/sml-compbio/oncomark/blob/main/src/Model_Val_Ext_Syn_Data.ipynb"
    click DPP4 "https://github.com/sml-compbio/oncomark/blob/main/src/Model_Val_Normal_Cancer.ipynb"

    %% Click Events for Web Server Interface
    click W1 "https://github.com/sml-compbio/oncomark/blob/main/webserver/OncoMark.py"
    click W2 "https://github.com/sml-compbio/oncomark/blob/main/webserver/mlm.py"
    click W3 "https://github.com/sml-compbio/oncomark/blob/main/webserver/ulm.py"
    click W4 "https://github.com/sml-compbio/oncomark/blob/main/webserver/plotting.py"
    click W5 "https://github.com/sml-compbio/oncomark/blob/main/webserver/collectri_df.csv"
    click W6 "https://github.com/sml-compbio/oncomark/blob/main/webserver/progeny_df.csv"

    %% Click Events for Testing/Validation
    click T1 "https://github.com/sml-compbio/oncomark/blob/main/test/model_test_code.ipynb"
    click T2 "https://github.com/sml-compbio/oncomark/blob/main/test/model_test_data.csv"

    %% Click Events for Documentation & Deployment
    click Doc1 "https://github.com/sml-compbio/oncomark/blob/main/docs/index.md"
    click Doc2 "https://github.com/sml-compbio/oncomark/blob/main/docs/installation.md"
    click Doc3 "https://github.com/sml-compbio/oncomark/blob/main/docs/usage.md"
    click Doc4 "https://github.com/sml-compbio/oncomark/blob/main/docs/dataset.md"
    click Doc5 "https://github.com/sml-compbio/oncomark/blob/main/Workflow.md"
    click Doc6 "https://github.com/sml-compbio/oncomark/blob/main/mkdocs.yml"
    click Doc7 "https://github.com/sml-compbio/oncomark/blob/main/readthedocs.yaml"
    click Doc8 "https://github.com/sml-compbio/oncomark/blob/main/setup.py"
    click Doc9 "https://github.com/sml-compbio/oncomark/blob/main/requirements.txt"

    %% Styles
    classDef input fill:#FFA07A,stroke:#8B0000,stroke-width:2px;
    classDef dataprep fill:#FFD700,stroke:#B8860B,stroke-width:2px;
    classDef prediction fill:#87CEEB,stroke:#4682B4,stroke-width:2px;
    classDef web fill:#98FB98,stroke:#2E8B57,stroke-width:2px;
    classDef testing fill:#D8BFD8,stroke:#8A2BE2,stroke-width:2px;
    classDef docs fill:#E6E6FA,stroke:#4B0082,stroke-width:2px;
```
