{ "cells": [ { "cell_type": "markdown", "id": "b6dec3da", "metadata": {}, "source": [ "# Neuronal Cell Painting\n", "\n", "{func}`~mantispy.ds.neuropainting` serves `cpg0038-tegtmeyer-neuropainting`, iPSC-derived neurons and astrocytes imaged at 20x and 63x. It is the example with no perturbation reagent: the design factor is genotype and donor, a control-versus-deletion contrast over patient and isogenic lines, rather than a compound or a guide. The object is well-level.\n", "\n", "**Use it if** your own experiment has no perturbation reagent and the contrast is a design factor (genotype, donor, cell type), so you group with an explicit `groupby=` rather than by a perturbation column. No tutorial is built on it." ] }, { "cell_type": "code", "execution_count": 1, "id": "58acd0b8", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T00:59:47.777796Z", "iopub.status.busy": "2026-10-21T00:59:47.777430Z", "iopub.status.idle": "2026-10-21T00:59:51.395880Z", "shell.execute_reply": "2026-10-21T00:59:51.394102Z" } }, "outputs": [], "source": [ "import mantispy as mt" ] }, { "cell_type": "code", "execution_count": 2, "id": "bd9703f6", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T00:59:51.400279Z", "iopub.status.busy": "2026-10-21T00:59:51.400013Z", "iopub.status.idle": "2026-10-21T00:59:51.549558Z", "shell.execute_reply": "2026-10-21T00:59:51.548425Z" } }, "outputs": [ { "data": { "text/plain": [ "AnnData object with n_obs × n_vars = 1691 × 204\n", " obs: 'Metadata_plate_map_name', 'Metadata_Plate', 'Metadata_Well', 'Metadata_Site_Count', 'Metadata_Object_Count', 'Metadata_Row', 'Metadata_Col', 'Metadata_CellCount', 'Metadata_SiteCount'\n", " var: 'object', 'feature_group', 'feature', 'channel', 'scale', 'angle', 'gray_levels', 'radial_bin', 'params', 'is_feature', 'feature_kind'\n", " uns: 'mantispy'\n", " layers: None (.X)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adata = mt.ds.neuropainting()\n", "adata" ] }, { "cell_type": "markdown", "id": "dfa056a7", "metadata": {}, "source": [ "## No `Metadata_Perturbation`\n", "\n", "Because the contrast is genotype and donor, and those columns are spelled differently on each plate, the per-plate column intersect keeps none of them, so no `Metadata_Perturbation` is set. Group with an explicit `groupby=` on the column an analysis needs. One plate barcode appears in more than one batch, so the observations are not indexed by plate and well either." ] }, { "cell_type": "code", "execution_count": 3, "id": "26106ff3", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T00:59:51.553149Z", "iopub.status.busy": "2026-10-21T00:59:51.552990Z", "iopub.status.idle": "2026-10-21T00:59:51.556978Z", "shell.execute_reply": "2026-10-21T00:59:51.555960Z" } }, "outputs": [ { "data": { "text/plain": [ "['Metadata_CellCount',\n", " 'Metadata_Col',\n", " 'Metadata_Object_Count',\n", " 'Metadata_Plate',\n", " 'Metadata_Row',\n", " 'Metadata_SiteCount',\n", " 'Metadata_Site_Count',\n", " 'Metadata_Well',\n", " 'Metadata_plate_map_name']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sorted(c for c in adata.obs.columns if c.startswith(\"Metadata_\"))" ] }, { "cell_type": "markdown", "id": "8079b342", "metadata": {}, "source": [ "## Cells per well by plate\n", "\n", "The plates differ in magnification and cell type, so cells per well spreads widely between them." ] }, { "cell_type": "code", "execution_count": 4, "id": "97e269d5", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T00:59:51.560135Z", "iopub.status.busy": "2026-10-21T00:59:51.559959Z", "iopub.status.idle": "2026-10-21T00:59:52.456369Z", "shell.execute_reply": "2026-10-21T00:59:52.455425Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "mt.pl.cell_counts(adata, groupby=\"Metadata_Plate\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.15" } }, "nbformat": 4, "nbformat_minor": 5 }