# genome/sciclone architecture

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

- Interactive diagram: https://gitdiagram.com/genome/sciclone
- Repository: https://github.com/genome/sciclone

## Overview

##### Project type and purpose
- This is an R/Bioconductor package (sciClone) for inferring the subclonal architecture of tumors from Variant Allele Frequency (VAF) and copy-number data. It provides core clustering algorithms, object definitions, I/O routines, and plotting functions.

##### File structure
- Top level: DESCRIPTION, NAMESPACE, README.md, LICENSE (R package metadata)
- R/: implementation code
- clustering.R – core clustering algorithms
- object.R – S4 class (“scObject”) and data‐model definitions
- plots.R – wrappers for 1D/2D/3D plotting (ggplot2, rgl, etc.)
- sciClone.R – user‐facing functions (sciClone(), writeCluster*, sc.plot*)
- zzz.R – package load hooks
- man/: documentation pages matching each exported function/class
- debian/: packaging scripts for Debian/Ubuntu
- README.md: high-level usage, dependencies, examples

##### README for additional insights
- Inputs: VAF tables, copy-number calls, optional region filters
- Outputs: cluster summary tables, PDF plots (1D/2D), animated GIFs (3D)
- Dependencies: IRanges, rgl, ggplot2, RColorBrewer, methods, NORMT3, etc.
- User interface: R functions installed via devtools or R CMD INSTALL

##### Elements
- Clear labels: “Input Reader”, “scObject Model”, “Clustering Engine”, “Plotting Module”, “Output Writer”

##### Detailed yet focused breakdown
- “sciClone()” as the central orchestrator
- Dependency cloud around the plotting layer and clustering layer
- Call out the S4 class as the “in-memory” data carrier

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "sciClone Package"
        sciCloneFunc["sciClone() Entry\n(R/sciClone.R)"]:::core
        PackageHooks["Package Hooks\n(R/zzz.R)"]:::core
        RawData["Raw Data\n(VAF & CN files)"]:::io
        InputReader["Input Reader\n(R/sciClone.R)"]:::core
        scObject["scObject Model\n(R/object.R)"]:::core
        Clustering["Clustering Engine\n(R/clustering.R)"]:::core
        OutputWriter["Output Writers\n(R/sciClone.R)"]:::core
        Plotting["Visualization Module\n(R/plots.R)"]:::core
        ResultsTables["Cluster Tables\n(Tables)"]:::io
        ResultsPlots["Plots & GIFs\n(PDF, GIF)"]:::io
    end

    subgraph "Dependencies"
        IRanges["IRanges"]:::ext
        ggplot2["ggplot2"]:::ext
        rgl["rgl"]:::ext
        RColorBrewer["RColorBrewer"]:::ext
    end

    Metadata["Metadata & Deployment\n(DESCRIPTION, NAMESPACE, man/, debian/)"]:::meta
    Documentation["Documentation\n(README.md)"]:::meta

    %% Data flow
    sciCloneFunc --> InputReader
    sciCloneFunc --> PackageHooks
    InputReader --> scObject
    scObject --> Clustering
    Clustering --> scObject
    Clustering --> OutputWriter
    Clustering --> Plotting
    OutputWriter --> ResultsTables
    Plotting --> ResultsPlots

    %% Dependencies usage
    Clustering --> IRanges
    Plotting --> ggplot2
    Plotting --> rgl
    Plotting --> RColorBrewer

    %% Misc
    sciCloneFunc --> Metadata
    sciCloneFunc --> Documentation

    %% Click Events
    click sciCloneFunc "https://github.com/genome/sciclone/blob/master/R/sciClone.R"
    click InputReader "https://github.com/genome/sciclone/blob/master/R/sciClone.R"
    click scObject "https://github.com/genome/sciclone/blob/master/R/object.R"
    click Clustering "https://github.com/genome/sciclone/blob/master/R/clustering.R"
    click OutputWriter "https://github.com/genome/sciclone/blob/master/R/sciClone.R"
    click Plotting "https://github.com/genome/sciclone/blob/master/R/plots.R"
    click PackageHooks "https://github.com/genome/sciclone/blob/master/R/zzz.R"
    click Documentation "https://github.com/genome/sciclone/blob/master/README.md"
    click Metadata "https://github.com/genome/sciclone/tree/master/man/"

    %% Styles
    classDef core fill:#AED6F1,stroke:#2980B9,color:#1B4F72
    classDef ext fill:#ABEBC6,stroke:#27AE60,color:#145A32
    classDef io fill:#F9E79F,stroke:#B7950B,color:#7D6608
    classDef meta fill:#F5B7B1,stroke:#C0392B,color:#641E16
```
