# uclahs-cds/package-cancerevolutionvisualization architecture

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

- Interactive diagram: https://gitdiagram.com/uclahs-cds/package-cancerevolutionvisualization
- Repository: https://github.com/uclahs-cds/package-cancerevolutionvisualization

## Overview

##### Main Components
- Documentation and User Guides:
- README and MAN pages: Outline how the package is used and provide reference documentation.
- Vignettes: Detailed user guides and illustrative examples (UserGuide.Rmd and ManuscriptFigures.Rmd) that show how to utilize the package.
- Data Resources: The data folder contains pre-supplied datasets (e.g., GRCh37.rda, SNV.rda) that are probably used for testing or examples, showing the expected input types.
- Testing Suite: The tests directory (with testthat scripts and example datasets) comprises unit tests that ensure the functions work as expected.
- Build and Configuration Files: Files like DESCRIPTION, NAMESPACE, .Rbuildignore, metadata.yaml, and GitHub workflows under .github/workflows are instrumental for package configuration, building, and continuous integration.

##### Relationships and Interactions
- The core functions (in the R/ directory) form the computational engine. Other components like documentation and vignettes rely on these for describing functionality.
- The tests directory validates the behavior of core functions and demonstrates usage with various datasets.
- Data files serve as sample input to both the core functions and testing scripts.
- Build configurations (in DESCRIPTION, NAMESPACE, etc.) integrate the package with R’s package management system and continuous integration environments.

##### Architectural Patterns and Design Principles
- Modular Design: Functions are split into dedicated files for specific tasks (e.g., handling text, adjusting tree layouts, scaling branch lengths).
- Separation of Concerns: Visualization components, data handling, and test validation are clearly isolated in distinct folders.
- Reusability: By having standalone functions each with documentation, the package promotes reusability and clarity.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data & Input Layer
    DataResources["Data Resources (data, vignettes/data)"]:::data

    %% Core Processing Layer
    subgraph "Core Processing Layer"
        subgraph "Tree Layout Engine"
            adjustTree["adjust.tree.R"]:::core
            createTree["create.phylogenetic.tree.R"]:::core
        end
        subgraph "Generic Core Functions"
            addNodes["add.nodes.R"]:::core
        end
    end

    %% Testing & Validation Layer
    TestingSuite["Testing Suite (tests)"]:::test

    %% Documentation & User Guidance Layer
    Documentation["Documentation (README, man)"]:::documentation
    Vignettes["Vignettes (User Guides)"]:::documentation

    %% Build & Integration Layer
    subgraph "Build & Integration Layer"
        PConfig["Package Config Files"]:::ci
        CIWorkflows["CI Workflows"]:::ci
    end

    %% Data ingestion from Data Resources to Core Processing functions
    DataResources -->|"data_ingestion"| adjustTree
    DataResources -->|"data_ingestion"| createTree
    DataResources -->|"data_ingestion"| addNodes

    %% Core Processing functions are validated by the Testing Suite
    adjustTree -->|"tested_by"| TestingSuite
    createTree -->|"tested_by"| TestingSuite
    addNodes -->|"tested_by"| TestingSuite

    %% Core Processing functions are described in Documentation & Vignettes
    adjustTree -->|"documented_in"| Documentation
    createTree -->|"documented_in"| Documentation
    addNodes -->|"documented_in"| Documentation

    adjustTree -->|"documented_in"| Vignettes
    createTree -->|"documented_in"| Vignettes
    addNodes -->|"documented_in"| Vignettes

    %% Build & Integration components orchestrate the system
    PConfig -->|"configures"| adjustTree
    PConfig -->|"configures"| TestingSuite
    PConfig -->|"configures"| Documentation
    CIWorkflows -->|"configures"| TestingSuite
    CIWorkflows -->|"configures"| Vignettes

    %% Click Events for Core Functionality files
    click adjustTree "https://github.com/uclahs-cds/package-cancerevolutionvisualization/blob/main/R/adjust.tree.R"
    click createTree "https://github.com/uclahs-cds/package-cancerevolutionvisualization/blob/main/R/create.phylogenetic.tree.R"
    click addNodes "https://github.com/uclahs-cds/package-cancerevolutionvisualization/blob/main/R/add.nodes.R"

    %% Click Events for Data Resources and Testing Suite
    click DataResources "https://github.com/uclahs-cds/package-cancerevolutionvisualization/tree/main/data/"
    click TestingSuite "https://github.com/uclahs-cds/package-cancerevolutionvisualization/tree/main/tests/"

    %% Click Events for Documentation & User Guides
    click Documentation "https://github.com/uclahs-cds/package-cancerevolutionvisualization/blob/main/README.md"
    click Vignettes "https://github.com/uclahs-cds/package-cancerevolutionvisualization/blob/main/vignettes/UserGuide.Rmd"

    %% Click Events for Build & Integration components
    click PConfig "https://github.com/uclahs-cds/package-cancerevolutionvisualization/tree/main/DESCRIPTION"
    click CIWorkflows "https://github.com/uclahs-cds/package-cancerevolutionvisualization/tree/main/.github/workflows/"

    %% Styles
    classDef core fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef documentation fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef test fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef ci fill:#DDA0DD,stroke:#000,stroke-width:2px;
```
