Skip to content

Commit 907161f

Browse files
committed
docs
1 parent 6d39cdb commit 907161f

10 files changed

Lines changed: 173 additions & 10 deletions

docs/index.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@
33

44
---
55

6+
cite paper
7+
8+
## Installation
9+
10+
Cytovanni can be installed directly from pypi:
11+
```bash
12+
pip install cytovanni[all]
13+
```
14+
15+
It requires a pytorch installation, preferrably on a machine with a GPU and CUDA for the GPU speedup. For the Sinkhorn divergence, we also require geomloss.
16+
17+
As setting up a working CUDA installation can be tiresome, we strongly suggest [using an apptainer container as a Jupyter kernel](tutorials/container) to run the package, which otherwise only requires installed Nvidia drivers.
18+
619
## Tutorials
20+
We provide a set of tutorials on how to use Cytovanni. First, a [cytometer configuration](tutorials/configuration/index) needs to be set up.
21+
We then provide example workflows using either [only the rainbow calibration and marker normalization](tutorials/integration_fixed-spectra/index), or our [full pipeline](tutorials/integration_variable-spectra/index) including inferred dye spectra for every batch.
22+
23+
24+
725

8-
---
926

1027
```{toctree}
1128
:hidden:
1229
:maxdepth: 2
1330
14-
Configuration <tutorials/cytometer_config>
15-
Fixed Spectra <tutorials/integration_fixed-spectra/index>
16-
Inferred Spectra <tutorials/integration_variable-spectra/index>
31+
Container <tutorials/container>
32+
Configuration <tutorials/configuration/index>
33+
Fixed Spectra Workflow <tutorials/integration_fixed-spectra/index>
34+
Inferred Spectra Workflow <tutorials/integration_variable-spectra/index>
1735
```

docs/tutorials/cytometer_config.ipynb renamed to docs/tutorials/configuration/cytometer_config.ipynb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "c23c0b2a-5464-465a-8829-c1e4d67de1bc",
6+
"metadata": {},
7+
"source": [
8+
"# Configuration"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 1,
@@ -30,10 +38,11 @@
3038
"cell_type": "markdown",
3139
"id": "cd03f579-4ecb-4919-bb91-b1e54216513a",
3240
"metadata": {
41+
"jp-MarkdownHeadingCollapsed": true,
3342
"tags": []
3443
},
3544
"source": [
36-
"# TL;DR"
45+
"## TL;DR"
3746
]
3847
},
3948
{
@@ -252,10 +261,11 @@
252261
"cell_type": "markdown",
253262
"id": "c0b5f056-f934-4a2f-9c25-37937a651c58",
254263
"metadata": {
264+
"jp-MarkdownHeadingCollapsed": true,
255265
"tags": []
256266
},
257267
"source": [
258-
"# Full"
268+
"## All Options"
259269
]
260270
},
261271
{
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Cytometer Configuration
2+
3+
Flow Cytometers vary widely in how their channels are named etc., so we first require a [cytometer configuration](cytometer_config) to collect parameters like the fluorescence channel names.
4+
5+
```{toctree}
6+
:hidden:
7+
:maxdepth: 2
8+
9+
Configuration <cytometer_config>
10+
```

docs/tutorials/container.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Apptainer
2+
3+
## LLMs
4+
Claude code should be able to prepare the container and set up the kernel, if given the relevant information in `https://github.com/anders-biostat/Cytovanni/blob/main/llms.txt`.
5+
6+
## Build Container
7+
8+
The GitHub contains an apptainer definition file `Cytovanni/container/container.def`, from which the `.sif` file can be built using
9+
```bash
10+
apptainer build -F cytovanni-container.sif container.def
11+
```
12+
It is then possible to run scripts within this container, which contains all necessary dependencies for the package, as well as CUDA support as long as it is running on a machine with a CUDA-enabled graphics card.
13+
14+
Note however that the container is not writable, so if you need additional python packages you need to either modify container.def manually, or modify it through the shell with
15+
```bash
16+
sed '/ # custom packages/a\ uv pip install --system package1 package2' -i container.def
17+
```
18+
where package1 package2 should be replaced by whatever additional packages you need. Then rebuild the container to include the new packages.
19+
20+
21+
## Use Container as Jupyter Kernel
22+
Our preferred way is using this container as a Jupyter kernel.
23+
For this, you need to create a script `init_kernel.sh` containing
24+
```bash
25+
#!/bin/bash
26+
apptainer exec --nv /path/to/cytovanni-container.sif python -m ipykernel "$@"
27+
```
28+
`--nv` enables the container to access the graphics card, and `/path/to` should be replaced by the correct path structure.
29+
Apptainer automatically mounts the user directory; you can additionally mount other directories using `--bind`.
30+
You then need to create a custom Jupyter kernel file, first by creating the folder
31+
```bash
32+
mkdir -p ~/.local/share/jupyter/kernels/cytovanni-container
33+
cd ~/.local/share/jupyter/kernels/cytovanni-container
34+
```
35+
and then add a file `kernel.json` with
36+
```json
37+
{
38+
"argv": [
39+
"/path/to/init_kernel.sh",
40+
"-f",
41+
"{connection_file}"
42+
],
43+
"display_name": "Python (Cytovanni)",
44+
"language": "python"
45+
}
46+
```
47+
Copying `logo-64x64.png` into `~/.local/share/jupyter/kernels/cytovanni-container` will additionally add a nice icon in the Jupyter launcher.
48+
49+
This custom kernel can then be used just like any other Jupyter kernel.
50+
51+
## R
52+
We also provide `Rcontainer.def` to run CytoNorm. Compiling works the same way as above,
53+
```bash
54+
apptainer build -F cytovanni-R-container.sif Rcontainer.def
55+
```
56+
along with `kernel.json`
57+
```json
58+
{
59+
"argv": [
60+
"/path/to/init_R_kernel.sh",
61+
"-f",
62+
"{connection_file}"
63+
],
64+
"display_name": "R (Cytovanni)",
65+
"language": "R"
66+
}
67+
```
68+
69+
However, due to changes in the syntax, the `init_R_kernel.sh` needs to be a bit more complex:
70+
```bash
71+
#!/bin/bash
72+
for i in "$@"; do
73+
if [[ "$prev" == "-f" ]]; then
74+
CONN_FILE="$i"
75+
fi
76+
prev="$i"
77+
done
78+
apptainer exec /path/to/cytovanni-R-container.sif R --slave -e "IRkernel::main('${CONN_FILE}')"
79+
```

docs/tutorials/integration_fixed-spectra/integration_fixed-spectra-rainbow.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0a963b57-3a58-4416-873f-2791bccb77c3",
6+
"metadata": {},
7+
"source": [
8+
"# Rainbow Bead Calibration"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 1,

docs/tutorials/integration_fixed-spectra/integration_fixed-spectra-ref.ipynb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "e14f8ed4-3b23-44cd-b4ee-a9f9b10fb664",
6+
"metadata": {},
7+
"source": [
8+
"# Model & Standardisation"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 1,
@@ -1138,7 +1146,9 @@
11381146
{
11391147
"cell_type": "markdown",
11401148
"id": "56e68e96-9a16-4362-97df-7d3dc0c155b5",
1141-
"metadata": {},
1149+
"metadata": {
1150+
"jp-MarkdownHeadingCollapsed": true
1151+
},
11421152
"source": [
11431153
"## Export"
11441154
]

docs/tutorials/integration_variable-spectra/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Standardization with Inferred Dye Spectra
1+
# Standardisation with Inferred Dye Spectra
22

33
In this tutorial, we showcase our full pipeline, including inferring appropriate dye spectra for every batch.
44

docs/tutorials/integration_variable-spectra/integration_variable-spectra-dye.ipynb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "6a792ec8-5457-4e0d-a1a3-4e7cec436f53",
6+
"metadata": {},
7+
"source": [
8+
"# Dye Variability"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 3,
@@ -564,7 +572,9 @@
564572
{
565573
"cell_type": "markdown",
566574
"id": "3be0f5d7-c686-4d85-9801-a5d34e9b3eec",
567-
"metadata": {},
575+
"metadata": {
576+
"jp-MarkdownHeadingCollapsed": true
577+
},
568578
"source": [
569579
"## Correlated Variation"
570580
]
@@ -711,7 +721,9 @@
711721
{
712722
"cell_type": "markdown",
713723
"id": "abe97a5a-b35a-40c6-9927-b2251fe7a87e",
714-
"metadata": {},
724+
"metadata": {
725+
"jp-MarkdownHeadingCollapsed": true
726+
},
715727
"source": [
716728
"## Final Panel Embedding"
717729
]

docs/tutorials/integration_variable-spectra/integration_variable-spectra-model.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "1dd7acd7-fb09-4f78-aed2-dc4c3ec83303",
6+
"metadata": {},
7+
"source": [
8+
"# Full Model & Standardisation"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 1,

docs/tutorials/integration_variable-spectra/integration_variable-spectra-rainbow.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "d05f9cd9-3217-4cc9-ac44-568246eefd04",
6+
"metadata": {},
7+
"source": [
8+
"# Rainbow Bead Calibration"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 1,

0 commit comments

Comments
 (0)