This vignette gives a rough overview of using EmbedSOM for actual cytometry data; in this case on a bone marrow dataset from Bendall et al., available at Flowrepository-FR-FCM-ZY9R. We show how to get data into embedding, and how to choose different landmark-generating functions to highlight different aspects of data.

After you download the FCS file from the FlowRepository link above, you can read it as such:

After that, we simplify it a bit by converting it to a matrix, transform it, and see how much cells and parameters there is:

`## [1] 236187 13`

First, you need to run the SOM algorithm to obtain a “map” of the cellular space:

```
set.seed(1)
time <- system.time(
map <- EmbedSOM::SOM(data, xdim=32, ydim=32, batch=T, parallel=T, rlen=20)
)
```

The parameters set the SOM size (20 times 20 is usually enough, but let’s see some detail), choose the parallelizable batch-SOM training, and add a bit of extra epochs above the default 10 (which is recommended if training larger SOMs). We also measured the required time, which is, in seconds:

```
## elapsed
## 10.018
```

After we have the map, we can project the cells onto that:

```
## elapsed
## 2.532
```

`e`

is now a 2-column matrix with coordinates of individual cells. You may as well plot it manually:

EmbedSOM provides its own function to ease various cell-plotting tasks, named (expectably) `PlotEmbed`

. By default, it plots density:

Plotting of various cell-related data is supported, including the marker expressions (e.g. the CD19 here, to identify the B cells):

We will mix a slightly more comprehensive coloring of the cells to use later: