graph-nucls / README.md
ogutsevda's picture
Update README.md
b0d5488 verified
---
license: cc-by-nc-sa-4.0
task_categories:
- graph-ml
tags:
- histopathology
- node-classification
- breast-cancer
- pytorch-geometric
pretty_name: Graph-NuCLS
size_categories:
- 1K<n<10K
---
# Graph-NuCLS: A Cell-Graph Dataset for Nucleus Classification from NuCLS
<p align="center">
<img src="animation.gif" alt="Graph-NuCLS teaser – cell-graph construction from a histopathology patch" width="600"/>
</p>
**Graph-NuCLS** is a node-level classification dataset derived from the [NuCLS](https://sites.google.com/view/nucls/home) dataset with "main" labels. Each tissue patch is converted into a **cell-graph** where nodes represent detected cell nuclei and edges encode spatial proximity. The task is predicting the cell type of each nucleus across 7 classes. Note that node features describe cell morphology, texture, and color intensity whereas edge features are Euclidean distance in micrometers.
This dataset is part of the paper [GrapHist: Graph Self-Supervised Learning for Histopathology](https://arxiv.org/pdf/2603.00143).
> ⚠️ **Edge Weight Note**: While the architecture in GrapHist supports both positive and negative edge weights, by default edge features represent Euclidean distances—meaning farther nodes have larger, positive values. This can be counterintuitive for many graph neural network models. We recommend experimenting with edge weights, such as using their inverse (e.g., `1/distance`) or negative distance (e.g., `-distance`), to better capture proximity and benefit learning.
## Dataset Summary
| Property | Value |
|---|---|
| **# Patches** | 1,694 |
| **Avg # Nodes** | 30.76 |
| **Avg # Edges** | 78.62 |
| **# Classes** | 7 |
## Node Classes
| Label ID | Class Name |
|---|---|
| 0 | Lymphocyte |
| 1 | Macrophage |
| 2 | Non-TIL / Non-MQ Stromal |
| 3 | Other Nucleus |
| 4 | Plasma Cell |
| 5 | Tumor (Mitotic) |
| 6 | Tumor (Non-Mitotic) |
## Data Structure
```
graph-nucls/
├── README.md
├── animation.gif
├── data/
│ ├── {SLIDE_ID}_id-5ea4...left-11371_top-54469_bottom-54761_right-11671.pt
│ └── ...
└── splits/
├── fold_1_train.csv
├── fold_1_test.csv
├── ...
└── fold_5_test.csv
```
Each `.pt` file is a PyTorch Geometric `Data` object with the following attributes:
| Attribute | Shape | Description |
|---|---|---|
| `x` | `[num_nodes, 96]` | Node feature matrix |
| `edge_index` | `[2, num_edges]` | Graph connectivity in COO format |
| `edge_attr` | `[num_edges, 1]` | Edge features |
| `labels` | `[num_nodes]` | Per-node class label |
| `sample_id` | `str` | Unique patch identifier |
### `splits/fold_N_{train|test}.csv`
Each fold CSV maps slides to their hospital and split assignment:
```
slide_name,hospital,type,fold
TCGA-E2-A14N-DX1,E2,train,1
TCGA-C8-A131-DX1,C8,train,1
...
```
To assign graph files to a fold split, match the `SLIDE_ID` prefix in the filename against the `slide_name` column.
---
## Quick Start
```python
import torch
from torch_geometric.data import Data
# Load a single graph
graph = torch.load("data/TCGA-A1-A0SP-DX1_id-5ea4095addda5f8398977ebc_left-11371_top-54469_bottom-54761_right-11671.pt", weights_only=False)
print(graph)
# Data(x=[26, 96], edge_index=[2, 63], edge_attr=[63, 1], sample_id='...', labels=[26])
print(f"Nodes: {graph.x.shape[0]}, Edges: {graph.edge_index.shape[1]}")
print(f"Node labels: {graph.labels}")
```
---
## Citation
If you use this dataset, please cite both our work, and the original NuCLS dataset:
**GrapHist (this dataset):**
```bibtex
@misc{ogut2026graphist,
title={GrapHist: Graph Self-Supervised Learning for Histopathology},
author={Sevda Öğüt and Cédric Vincent-Cuaz and Natalia Dubljevic and Carlos Hurtado and Vaishnavi Subramanian and Pascal Frossard and Dorina Thanou},
year={2026},
eprint={2603.00143},
url={https://arxiv.org/abs/2603.00143},
}
```
**NuCLS (source annotations):**
```bibtex
@article{amgad2022nucls,
title={NuCLS: A scalable crowdsourcing approach and dataset for nucleus classification and segmentation in breast cancer},
author={Amgad, Mohamed and Atteya, Lamees A and Hussein, Hagar and Mohammed, Kareem Hosny and Hafiz, Ehab and Elsebaie, Maha AT and Alhusseiny, Ahmed M and AlMoslemany, Mohamed Atef and Elmatboly, Abdelmagid M and Pappalardo, Philip A and others},
journal={GigaScience},
volume={11},
pages={giac037},
year={2022},
publisher={Oxford University Press}
}
```
---
## License
This dataset is released under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license.