{ "cells": [ { "cell_type": "markdown", "id": "c000", "metadata": {}, "source": [ "# Published profiles and JUMP\n", "\n", "An image-based profiling pipeline hands you a table: one row per well or per cell, a few thousand columns of\n", "CellProfiler measurements, and some metadata columns mixed in among them.\n", "{func}`~mantispy.io.read_profiles` turns one or many of those tables into an {class}`~anndata.AnnData`.\n", "It splits the measurements from the metadata and annotates what each feature name encodes.\n", "It handles what differs between real datasets: four spellings of the metadata prefix, missing-value\n", "sentinels, files with different columns, and metadata that only exists in the directory name." ] }, { "cell_type": "code", "execution_count": 1, "id": "c001", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T01:03:48.302930Z", "iopub.status.busy": "2026-10-21T01:03:48.302354Z", "iopub.status.idle": "2026-10-21T01:03:51.820220Z", "shell.execute_reply": "2026-10-21T01:03:51.818491Z" } }, "outputs": [], "source": [ "import mantispy as mt" ] }, { "cell_type": "markdown", "id": "c002", "metadata": {}, "source": [ "## A dataset\n", "\n", "{mod}`mantispy.ds` downloads whole accessions from the\n", "[Cell Painting Gallery](https://github.com/broadinstitute/cellpainting-gallery) {cite:p}`Weisbart_2024`, so there is something real to\n", "read.\n", "This one is kinase inhibitors at a range of doses, eight plates of it." ] }, { "cell_type": "code", "execution_count": 2, "id": "c003", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T01:03:51.824798Z", "iopub.status.busy": "2026-10-21T01:03:51.824300Z", "iopub.status.idle": "2026-10-21T01:03:52.153486Z", "shell.execute_reply": "2026-10-21T01:03:52.152331Z" } }, "outputs": [ { "data": { "text/plain": [ "AnnData object with n_obs × n_vars = 3072 × 5839\n", " obs: 'Metadata_plate_map_name', 'Metadata_broad_sample', 'Metadata_mg_per_ml', 'Metadata_mmoles_per_liter', 'Metadata_solvent', 'Metadata_Plate', 'Metadata_Well', 'Metadata_Site_Count', 'Metadata_Count_Cells', 'Metadata_Count_CellsIncludingEdges', 'Metadata_Count_Cytoplasm', 'Metadata_Count_Nuclei', 'Metadata_Count_NucleiIncludingEdges', 'Metadata_Object_Count', 'Metadata_Barcode', 'Metadata_Supplier', 'Metadata_Supplier_Catalog', 'Metadata_pert_type', 'Metadata_control_type', 'Metadata_Row', 'Metadata_Col', 'Metadata_CellCount', 'Metadata_SiteCount', 'Metadata_Control_Type', 'Metadata_Control', 'Metadata_Compound', 'Metadata_Concentration', 'Metadata_ConcentrationUnit', 'Metadata_MOA', 'Metadata_Perturbation', 'Metadata_Perturbation_Type'\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.pki()\n", "adata" ] }, { "cell_type": "markdown", "id": "c004", "metadata": {}, "source": [ "Numeric columns that parse as CellProfiler features became the feature matrix, and everything else became `obs`.\n", "Every metadata prefix is normalized to `Metadata_`, and the loader adds the columns an analysis looks for:\n", "`Metadata_Compound`, `Metadata_Concentration`, `Metadata_Control` and `Metadata_Perturbation`." ] }, { "cell_type": "code", "execution_count": 3, "id": "c005", "metadata": { "execution": { "iopub.execute_input": "2026-10-21T01:03:52.156399Z", "iopub.status.busy": "2026-10-21T01:03:52.156247Z", "iopub.status.idle": "2026-10-21T01:03:52.172915Z", "shell.execute_reply": "2026-10-21T01:03:52.171928Z" } }, "outputs": [ { "data": { "text/html": [ "
| \n", " | Metadata_plate_map_name | \n", "Metadata_broad_sample | \n", "Metadata_mg_per_ml | \n", "Metadata_mmoles_per_liter | \n", "Metadata_solvent | \n", "Metadata_Plate | \n", "Metadata_Well | \n", "Metadata_Site_Count | \n", "Metadata_Count_Cells | \n", "Metadata_Count_CellsIncludingEdges | \n", "... | \n", "Metadata_CellCount | \n", "Metadata_SiteCount | \n", "Metadata_Control_Type | \n", "Metadata_Control | \n", "Metadata_Compound | \n", "Metadata_Concentration | \n", "Metadata_ConcentrationUnit | \n", "Metadata_MOA | \n", "Metadata_Perturbation | \n", "Metadata_Perturbation_Type | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "C-7210-01-CMP-014 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "DMSO | \n", "BR00122970 | \n", "A01 | \n", "9 | \n", "1758 | \n", "1890 | \n", "... | \n", "1758.0 | \n", "9.0 | \n", "negcon | \n", "True | \n", "DMSO | \n", "NaN | \n", "mM | \n", "NaN | \n", "DMSO | \n", "compound | \n", "
| 1 | \n", "C-7210-01-CMP-014 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "DMSO | \n", "BR00122970 | \n", "A02 | \n", "9 | \n", "1941 | \n", "2137 | \n", "... | \n", "1941.0 | \n", "9.0 | \n", "negcon | \n", "True | \n", "DMSO | \n", "NaN | \n", "mM | \n", "NaN | \n", "DMSO | \n", "compound | \n", "
| 10 | \n", "C-7210-01-CMP-014 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "DMSO | \n", "BR00122970 | \n", "A11 | \n", "9 | \n", "2357 | \n", "2564 | \n", "... | \n", "2357.0 | \n", "9.0 | \n", "negcon | \n", "True | \n", "DMSO | \n", "NaN | \n", "mM | \n", "NaN | \n", "DMSO | \n", "compound | \n", "
| 100 | \n", "C-7210-01-CMP-014 | \n", "BRD-U00086680-001-01-9 | \n", "NaN | \n", "0.04 | \n", "DMSO | \n", "BR00122970 | \n", "E05 | \n", "9 | \n", "2001 | \n", "2172 | \n", "... | \n", "2001.0 | \n", "9.0 | \n", "treatment | \n", "False | \n", "BRD-U00086680-001-01-9 | \n", "0.04 | \n", "mM | \n", "ERK5 inhibitor | \n", "BRD-U00086680-001-01-9@0.04 | \n", "compound | \n", "
| 1000 | \n", "C-7210-01-CMP-014 | \n", "BRD-U00086676-001-01-9 | \n", "NaN | \n", "0.01 | \n", "DMSO | \n", "BR00122972 | \n", "J17 | \n", "9 | \n", "521 | \n", "557 | \n", "... | \n", "521.0 | \n", "9.0 | \n", "treatment | \n", "False | \n", "BRD-U00086676-001-01-9 | \n", "0.01 | \n", "mM | \n", "undisclosed target PROTAC | \n", "BRD-U00086676-001-01-9@0.01 | \n", "compound | \n", "
5 rows × 31 columns
\n", "