File size: 2,157 Bytes
2000e52
 
92aac2e
2000e52
92aac2e
 
 
 
 
 
 
10bbf96
92aac2e
 
 
10bbf96
92aac2e
 
 
 
10bbf96
 
 
 
 
 
 
 
 
 
92aac2e
d9f243a
 
92aac2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-nc-nd-4.0
pipeline_tag: tabular-classification
---
# Flowformer

Automatic detection of blast cells in ALL data using transformers. 

Official implementation of our work: *"Automated Identification of Cell Populations in Flow Cytometry Data with Transformers"*
by Matthias Wödlinger, Michael Reiter, Lisa Weijler, Margarita Maurer-Granofszky, Angela Schumich, Elisa O Sajaroff, Stefanie Groeneveld-Krentz, Jorge G Rossi, Leonid Karawajew, Richard Ratei and Michael Dworzak

## Load the model

Load the pretrained model from huggingface

```python
from transformers import AutoModel
flowformer = AutoModel.from_pretrained("matth/flowformer", trust_remote_code=True)
```

`trust_remote_code=True` is necessary because the model code uses a custom architecture.

## Usage

The model expects as input a pytorch tensor `x` with shape `batch_size x num_cells x num_markers`. 
The pretrained model is trained with the the markers: *TIME, FSC-A, FSC-W, SSC-A, CD20, CD10, CD45, CD34, CD19, CD38, SY41*. If you use different markers (or a different ordering of markers), you need to specify this by setting the `markers` kwarg in the model forward pass:

```python
output = flowformer(x, markers=["Marker1", "Marker2", "Marker3"])
```

For more information about model usage as well as hands-on examples check out this demo notebook from my colleague Florian Kowarsch: [https://github.com/CaRniFeXeR/python4FCM_Examples/blob/main/hyperflow2023.ipynb](https://github.com/CaRniFeXeR/python4FCM_Examples/blob/main/hyperflow2023.ipynb)

## Citation

If you use this project please consider citing our work

```
@article{wodlinger2022automated,
  title={Automated identification of cell populations in flow cytometry data with transformers},
  author={Wödlinger, Matthias and Reiter, Michael and Weijler, Lisa and Maurer-Granofszky, Margarita and Schumich, Angela and Sajaroff, Elisa O and Groeneveld-Krentz, Stefanie and Rossi, Jorge G and Karawajew, Leonid and Ratei, Richard and others},
  journal={Computers in Biology and Medicine},
  volume={144},
  pages={105314},
  year={2022},
  publisher={Elsevier}
}
```


---
license: cc-by-nc-nd-4.0
---