# jsxlei/chrombpnet-pytorch architecture

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

- Interactive diagram: https://gitdiagram.com/jsxlei/chrombpnet-pytorch
- Repository: https://github.com/jsxlei/chrombpnet-pytorch

## Overview

ChromBPNet Pytorch trains bias-factorized, base-resolution models of chromatin accessibility, then uses them for prediction, interpretation, and variant scoring. The main user workflow is CLI-driven: supply genomic regions, signal tracks, and a reference genome; train or load a checkpoint; produce predictions and evaluation, or calculate attributions. Variant scoring is a distinct analysis branch. The graph preserves the documented capabilities; some connections rely on README statements or source-index references because the sampled excerpts omit implementation details.

Main entry points: [`chrombpnet/main.py`](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/main.py) (Command workflows), [`chrombpnet/model_wrappers.py`](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/model_wrappers.py) (Training wrappers), [`chrombpnet/interpret.py`](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/interpret.py) (Attribution analysis), [`chrombpnet/snp_scoring.py`](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/snp_scoring.py) (Variant scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_cli["Command workflows<br/>[main.py]"]
  node_logger["Run logging<br/>[logger.py]"]
end

subgraph group_data["Genomic data"]
  node_config["Data configuration<br/>[data_config.py]"]
  node_regions["Sequence dataset<br/>[dataset.py]"]
  node_genome["Genome resources<br/>[genome.py]"]
  node_preprocess["Sequence utilities<br/>[data_utils.py]"]
  node_argparse["Argument parsing<br/>[parse_utils.py]"]
end

subgraph group_models["Modeling and evaluation"]
  node_bpnet["BPNet architecture<br/>[bpnet.py]"]
  node_chrombpnet["Bias-factorized model<br/>[chrombpnet.py]"]
  node_wrappers["Training wrappers<br/>[model_wrappers.py]"]
  node_metrics["Prediction evaluation<br/>[metrics.py]"]
  node_metric_utils["Metric calculations<br/>[metrics_utils.py]"]
end

subgraph group_analysis["Interpretation and variants"]
  node_interpret["Attribution analysis<br/>[interpret.py]"]
  node_snp_score["Variant scoring<br/>[snp_scoring.py]"]
  node_snp_utils["Variant processing<br/>[snp_utils.py]"]
  node_fold_summary["Fold summaries"]
end

node_user(("Researcher"))
node_inputs["Genomic inputs"]

node_user -->|"runs commands"| node_cli
node_inputs -->|"supplies data"| node_cli
node_cli -->|"configures data"| node_config
node_cli -->|"loads datasets"| node_regions
node_cli -->|"selects reference"| node_genome
node_cli -->|"loads model"| node_wrappers
node_cli -->|"evaluates predictions"| node_metrics
node_cli -->|"runs attribution"| node_interpret
node_cli -->|"creates logs"| node_logger
node_config -->|"builds arguments"| node_argparse
node_config -->|"selects datasets"| node_genome
node_regions -->|"uses settings"| node_config
node_regions -->|"processes sequences"| node_preprocess
node_chrombpnet -->|"builds from"| node_bpnet
node_wrappers -->|"wraps model"| node_chrombpnet
node_wrappers -->|"wraps model"| node_bpnet
node_metrics -->|"uses calculations"| node_metric_utils
node_metrics -->|"writes predictions"| node_preprocess
node_interpret -->|"attributes outputs"| node_wrappers
node_interpret -->|"loads regions"| node_preprocess
node_interpret -->|"uses reference"| node_genome
node_user -->|"scores variants"| node_snp_score
node_snp_score -->|"uses variant processing"| node_snp_utils
node_snp_score -->|"loads model"| node_wrappers
node_snp_score -->|"reads reference"| node_genome
node_fold_summary -->|"summarizes variants"| node_snp_utils
node_cli -->|"trains or predicts"| node_wrappers
node_cli -->|"interprets checkpoint"| node_interpret
node_cli -.->|"reports evaluation"| node_metrics

click node_cli "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/main.py"
click node_config "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/data_config.py"
click node_regions "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/dataset.py"
click node_genome "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/genome.py"
click node_preprocess "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/data_utils.py"
click node_argparse "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/parse_utils.py"
click node_bpnet "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/bpnet.py"
click node_chrombpnet "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/chrombpnet.py"
click node_wrappers "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/model_wrappers.py"
click node_metrics "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/metrics.py"
click node_metric_utils "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/metrics_utils.py"
click node_logger "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/logger.py"
click node_interpret "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/interpret.py"
click node_snp_score "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/snp_scoring.py"
click node_snp_utils "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/snp_utils.py"
click node_fold_summary "https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/variant_summary_across_folds.py"

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_cli,node_logger toneBlue
class node_config,node_regions,node_genome,node_preprocess,node_argparse toneAmber
class node_bpnet,node_chrombpnet,node_wrappers,node_metrics,node_metric_utils toneMint
class node_interpret,node_snp_score,node_snp_utils,node_fold_summary toneRose
class node_user,node_inputs toneIndigo
```

## Components

### CLI workflows

- [Command workflows](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/main.py): `chrombpnet/main.py`
- [Run logging](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/logger.py): `chrombpnet/logger.py`

### Genomic data

- [Data configuration](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/data_config.py): `chrombpnet/data_config.py`
- [Sequence dataset](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/dataset.py): `chrombpnet/dataset.py`
- [Genome resources](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/genome.py): `chrombpnet/genome.py`
- [Sequence utilities](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/data_utils.py): `chrombpnet/data_utils.py`
- [Argument parsing](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/parse_utils.py): `chrombpnet/parse_utils.py`

### Modeling and evaluation

- [BPNet architecture](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/bpnet.py): `chrombpnet/bpnet.py`
- [Bias-factorized model](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/chrombpnet.py): `chrombpnet/chrombpnet.py`
- [Training wrappers](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/model_wrappers.py): `chrombpnet/model_wrappers.py`
- [Prediction evaluation](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/metrics.py): `chrombpnet/metrics.py`
- [Metric calculations](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/metrics_utils.py): `chrombpnet/metrics_utils.py`

### Interpretation and variants

- [Attribution analysis](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/interpret.py): `chrombpnet/interpret.py`
- [Variant scoring](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/snp_scoring.py): `chrombpnet/snp_scoring.py`
- [Variant processing](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/snp_utils.py): `chrombpnet/snp_utils.py`
- [Fold summaries](https://github.com/jsxlei/chrombpnet-pytorch/blob/main/chrombpnet/variant_summary_across_folds.py): `chrombpnet/variant_summary_across_folds.py`

### Other components

- **Researcher**
- **Genomic inputs**

## Connections

- Researcher → Command workflows: runs commands (evidence: `README.md`)
- Genomic inputs → Command workflows: supplies data (evidence: `README.md`)
- Command workflows → Data configuration: configures data (evidence: `chrombpnet/main.py`)
- Command workflows → Sequence dataset: loads datasets (evidence: `chrombpnet/main.py`)
- Command workflows → Genome resources: selects reference (evidence: `chrombpnet/main.py`)
- Command workflows → Training wrappers: loads model (evidence: `chrombpnet/main.py`)
- Command workflows → Prediction evaluation: evaluates predictions (evidence: `chrombpnet/main.py`)
- Command workflows → Attribution analysis: runs attribution (evidence: `chrombpnet/main.py`)
- Command workflows → Run logging: creates logs (evidence: `chrombpnet/main.py`)
- Data configuration → Argument parsing: builds arguments (evidence: `chrombpnet/data_config.py`)
- Data configuration → Genome resources: selects datasets (evidence: `chrombpnet/data_config.py`)
- Sequence dataset → Data configuration: uses settings (evidence: `chrombpnet/dataset.py`)
- Sequence dataset → Sequence utilities: processes sequences (evidence: `chrombpnet/dataset.py`)
- Bias-factorized model → BPNet architecture: builds from (evidence: `chrombpnet/chrombpnet.py`)
- Training wrappers → Bias-factorized model: wraps model (evidence: `chrombpnet/model_wrappers.py`)
- Training wrappers → BPNet architecture: wraps model (evidence: `chrombpnet/model_wrappers.py`)
- Prediction evaluation → Metric calculations: uses calculations (evidence: `chrombpnet/metrics.py`)
- Prediction evaluation → Sequence utilities: writes predictions (evidence: `chrombpnet/metrics.py`)
- Attribution analysis → Training wrappers: attributes outputs (evidence: `chrombpnet/interpret.py`)
- Attribution analysis → Sequence utilities: loads regions (evidence: `chrombpnet/interpret.py`)
- Attribution analysis → Genome resources: uses reference (evidence: `chrombpnet/interpret.py`)
- Researcher → Variant scoring: scores variants (evidence: `README.md`)
- Variant scoring → Variant processing: uses variant processing (evidence: `chrombpnet/snp_scoring.py`)
- Variant scoring → Training wrappers: loads model (evidence: `chrombpnet/snp_scoring.py`)
- Variant scoring → Genome resources: reads reference (evidence: `chrombpnet/snp_scoring.py`)
- Fold summaries → Variant processing: summarizes variants (evidence: `chrombpnet/variant_summary_across_folds.py`)
- Command workflows → Training wrappers: trains or predicts (evidence: `README.md`)
- Command workflows → Attribution analysis: interprets checkpoint (evidence: `README.md`)
- Command workflows → Prediction evaluation: reports evaluation (evidence: `chrombpnet/main.py`)
