File size: 4,663 Bytes
4dfbcae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b0d5488
4dfbcae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57a7ef9
4dfbcae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b0d5488
 
 
 
 
 
4dfbcae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
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.