{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example Workflow with spatialproteomics\n", "Welcome to spatialproteomics! In this notebook, we will go through an example workflow by looking at the following steps:\n", "\n", "1. Reading in a highly multiplexed image and creating a spatialproteomics object\n", "\n", "2. Performing basic image processing steps to boost the signal-to-noise ratio\n", "\n", "3. Performing cell segmentation using _cellpose_\n", "\n", "4. Quantifying protein expression per cell\n", "\n", "5. Predicting cell types with a simple argmax technique\n", "\n", "6. Plotting the results\n", "\n", "
\n",
"
\n",
"
<xarray.Dataset> Size: 3MB\n",
"Dimensions: (channels: 5, y: 500, x: 500)\n",
"Coordinates:\n",
" * channels (channels) <U5 100B 'DAPI' 'CD4' 'CD8' 'FOXP3' 'BCL6'\n",
" * y (y) int64 4kB 0 1 2 3 4 5 6 7 ... 492 493 494 495 496 497 498 499\n",
" * x (x) int64 4kB 0 1 2 3 4 5 6 7 ... 492 493 494 495 496 497 498 499\n",
"Data variables:\n",
" _image (channels, y, x) uint16 2MB 10816 12359 14504 10965 ... 129 149 59<xarray.Dataset> Size: 3MB\n",
"Dimensions: (channels: 5, y: 500, x: 500, cells: 2267, features: 2)\n",
"Coordinates:\n",
" * channels (channels) <U5 100B 'DAPI' 'CD4' 'CD8' 'FOXP3' 'BCL6'\n",
" * y (y) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499\n",
" * x (x) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499\n",
" * cells (cells) int64 18kB 1 2 3 4 5 6 ... 2263 2264 2265 2266 2267\n",
" * features (features) <U10 80B 'centroid-0' 'centroid-1'\n",
"Data variables:\n",
" _image (channels, y, x) uint16 2MB 0 9602 9690 5351 4892 ... 0 0 0 0\n",
" _segmentation (y, x) uint16 500kB 0 1 1 1 1 1 0 2 2 2 ... 0 0 0 0 0 0 0 0 0\n",
" _obs (cells, features) float64 36kB 2.743 2.771 ... 497.9 149.0<xarray.Dataset> Size: 3MB\n",
"Dimensions: (channels: 5, y: 500, x: 500, cells: 2249, features: 2)\n",
"Coordinates:\n",
" * channels (channels) <U5 100B 'DAPI' 'CD4' 'CD8' 'FOXP3' 'BCL6'\n",
" * y (y) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499\n",
" * x (x) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499\n",
" * cells (cells) int64 18kB 1 2 3 4 5 6 ... 2245 2246 2247 2248 2249\n",
" * features (features) <U10 80B 'centroid-0' 'centroid-1'\n",
"Data variables:\n",
" _image (channels, y, x) uint16 2MB 0 9602 9690 5351 4892 ... 0 0 0 0\n",
" _segmentation (y, x) uint16 500kB 1 1 1 1 1 1 1 2 2 2 ... 0 0 0 0 0 0 0 0 0\n",
" _obs (cells, features) float64 36kB 2.615 2.641 ... 495.9 261.6\n",
" _intensity (cells, channels) float64 90kB 7.84 4.588 ... 0.8559 1.653<xarray.Dataset> Size: 3MB\n",
"Dimensions: (labels: 4, la_props: 2, channels: 5, y: 500, x: 500,\n",
" cells: 2249, features: 3)\n",
"Coordinates:\n",
" * labels (labels) int64 32B 1 2 3 4\n",
" * la_props (la_props) <U6 48B '_color' '_name'\n",
" * channels (channels) <U5 100B 'DAPI' 'CD4' 'CD8' 'FOXP3' 'BCL6'\n",
" * y (y) int64 4kB 0 1 2 3 4 5 6 ... 493 494 495 496 497 498 499\n",
" * x (x) int64 4kB 0 1 2 3 4 5 6 ... 493 494 495 496 497 498 499\n",
" * cells (cells) int64 18kB 1 2 3 4 5 6 ... 2245 2246 2247 2248 2249\n",
" * features (features) <U10 120B '_labels' 'centroid-0' 'centroid-1'\n",
"Data variables:\n",
" _la_properties (labels, la_props) object 64B '#000035' 'T_fh' ... 'T_tox'\n",
" _image (channels, y, x) uint16 2MB 0 9602 9690 5351 ... 0 0 0 0\n",
" _segmentation (y, x) uint16 500kB 1 1 1 1 1 1 1 2 2 ... 0 0 0 0 0 0 0 0 0\n",
" _obs (cells, features) float64 54kB 4.0 2.615 ... 495.9 261.6\n",
" _intensity (cells, channels) float64 90kB 7.84 4.588 ... 0.8559 1.653"
],
"text/plain": [
"