# srini911/tcga-brca-subtype-classifier architecture

> Architecture diagram of the GitHub repository srini911/tcga-brca-subtype-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srini911/tcga-brca-subtype-classifier
- Repository: https://github.com/srini911/tcga-brca-subtype-classifier

## Overview

This repository is a reproducible research workflow for classifying breast tumors into four PAM50 subtypes from TCGA RNA-seq. Its principal path downloads cohort data, transforms and labels expression features, compares classifiers, and produces evaluation results. Two companion analyses inspect influential genes and subtype confusions, and test smaller gene panels. The graph follows the documented script order; source excerpts confirm the major data reads, model work, and result writes. Raw and processed data directories are generated and gitignored, so they are not shown as repository files.

Main entry points: [`src/01_download.py`](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/01_download.py) (Download cohort), [`src/04_interpret.py`](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/04_interpret.py) (Interpret models), [`src/05_gene_panel.py`](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/05_gene_panel.py) (Test gene panels), [`src/03_train_evaluate.py`](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/03_train_evaluate.py) (Train and evaluate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_download["Download cohort<br/>[01_download.py]"]
  node_preprocess["Prepare features<br/>[02_preprocess.py]"]
end

subgraph group_modeling["Model evaluation"]
  node_train["Train and evaluate"]
  node_metrics["Evaluation results<br/>[metrics.json]"]
end

subgraph group_analysis["Model analysis"]
  node_interpret["Interpret models<br/>[04_interpret.py]"]
  node_gene_panel["Test gene panels<br/>[05_gene_panel.py]"]
  node_panel_results["Gene panel results"]
  node_top_genes["Ranked gene results<br/>[top_genes.csv]"]
end

subgraph group_shared["Shared utilities"]
  node_config["Project settings<br/>[config.py]"]
  node_utils["Data and figure helpers<br/>[utils.py]"]
end

node_researcher(("Researcher"))
node_cbioportal{{"cBioPortal datahub"}}

node_researcher -->|"starts workflow"| node_download
node_download -->|"downloads cohort files"| node_cbioportal
node_download -->|"provides raw inputs"| node_preprocess
node_preprocess -->|"provides processed features"| node_train
node_researcher -->|"runs evaluation"| node_train
node_train -->|"writes metrics"| node_metrics
node_researcher -->|"runs interpretation"| node_interpret
node_interpret -->|"reads and updates"| node_metrics
node_interpret -->|"writes rankings"| node_top_genes
node_researcher -->|"runs panel experiment"| node_gene_panel
node_gene_panel -->|"writes top-50 list"| node_panel_results
node_download -->|"uses settings"| node_config
node_preprocess -->|"uses settings"| node_config
node_train -->|"uses settings"| node_config
node_interpret -->|"uses settings"| node_config
node_gene_panel -->|"uses settings"| node_config
node_download -->|"sets logging"| node_utils
node_preprocess -->|"sets logging"| node_utils
node_train -->|"loads data and saves figures"| node_utils
node_interpret -->|"loads data and saves figures"| node_utils
node_gene_panel -->|"loads data and saves figures"| node_utils
node_gene_panel -->|"writes panel metrics"| node_panel_results

click node_download "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/01_download.py"
click node_preprocess "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/02_preprocess.py"
click node_config "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/config.py"
click node_utils "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/utils.py"
click node_train "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/03_train_evaluate.py"
click node_metrics "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/results/metrics.json"
click node_interpret "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/04_interpret.py"
click node_gene_panel "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/05_gene_panel.py"
click node_panel_results "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/results/panel_top50_genes.csv"
click node_top_genes "https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/results/top_genes.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_download,node_preprocess toneBlue
class node_train,node_metrics toneAmber
class node_interpret,node_gene_panel,node_panel_results,node_top_genes toneMint
class node_config,node_utils toneRose
class node_researcher,node_cbioportal toneIndigo
```

## Components

### Data preparation

- [Download cohort](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/01_download.py): `src/01_download.py`
- [Prepare features](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/02_preprocess.py): `src/02_preprocess.py`

### Model evaluation

- [Train and evaluate](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/03_train_evaluate.py): `src/03_train_evaluate.py`
- [Evaluation results](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/results/metrics.json): `results/metrics.json`

### Model analysis

- [Interpret models](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/04_interpret.py): `src/04_interpret.py`
- [Test gene panels](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/05_gene_panel.py): `src/05_gene_panel.py`
- [Gene panel results](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/results/panel_top50_genes.csv): `results/panel_top50_genes.csv`
- [Ranked gene results](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/results/top_genes.csv): `results/top_genes.csv`

### Shared utilities

- [Project settings](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/config.py): `src/config.py`
- [Data and figure helpers](https://github.com/srini911/tcga-brca-subtype-classifier/blob/main/src/utils.py): `src/utils.py`

### Other components

- **Researcher**
- **cBioPortal datahub**

## Connections

- Researcher → Download cohort: starts workflow (evidence: `README.md`)
- Download cohort → cBioPortal datahub: downloads cohort files (evidence: `src/01_download.py`)
- Download cohort → Prepare features: provides raw inputs (evidence: `README.md`)
- Prepare features → Train and evaluate: provides processed features (evidence: `README.md`)
- Researcher → Train and evaluate: runs evaluation (evidence: `README.md`)
- Train and evaluate → Evaluation results: writes metrics (evidence: `src/03_train_evaluate.py`)
- Researcher → Interpret models: runs interpretation (evidence: `README.md`)
- Interpret models → Evaluation results: reads and updates (evidence: `src/04_interpret.py`)
- Interpret models → Ranked gene results: writes rankings (evidence: `src/04_interpret.py`)
- Researcher → Test gene panels: runs panel experiment (evidence: `README.md`)
- Test gene panels → Gene panel results: writes top-50 list (evidence: `src/05_gene_panel.py`)
- Download cohort → Project settings: uses settings (evidence: `src/01_download.py`)
- Prepare features → Project settings: uses settings (evidence: `src/02_preprocess.py`)
- Train and evaluate → Project settings: uses settings (evidence: `src/03_train_evaluate.py`)
- Interpret models → Project settings: uses settings (evidence: `src/04_interpret.py`)
- Test gene panels → Project settings: uses settings (evidence: `src/05_gene_panel.py`)
- Download cohort → Data and figure helpers: sets logging (evidence: `src/01_download.py`)
- Prepare features → Data and figure helpers: sets logging (evidence: `src/02_preprocess.py`)
- Train and evaluate → Data and figure helpers: loads data and saves figures (evidence: `src/03_train_evaluate.py`)
- Interpret models → Data and figure helpers: loads data and saves figures (evidence: `src/04_interpret.py`)
- Test gene panels → Data and figure helpers: loads data and saves figures (evidence: `src/05_gene_panel.py`)
- Test gene panels → Gene panel results: writes panel metrics (evidence: `src/05_gene_panel.py`)
