{ "cells": [ { "cell_type": "markdown", "id": "7092d951-fcb8-4ee9-8537-0779e053c211", "metadata": {}, "source": [ "# CytoDataFrame at a Glance\n", "\n", "This notebook demonstrates various capabilities of\n", "[CytoDataFrame](https://github.com/cytomining/CytoDataFrame) using examples.\n", "\n", "CytoDataFrame is intended to provide you a Pandas-like\n", "DataFrame experience which is enhanced with single-cell\n", "visual information which can be viewed directly in a Jupyter notebook." ] }, { "cell_type": "code", "execution_count": 1, "id": "99e3f0b6-7737-4f4c-819f-6cf8cd9a71fe", "metadata": { "lines_to_next_cell": 0 }, "outputs": [], "source": [ "import pathlib\n", "import warnings\n", "\n", "import pandas as pd\n", "\n", "from cytodataframe.frame import CytoDataFrame\n", "\n", "# filter warnings from skimage about imageio\n", "warnings.filterwarnings(\n", " \"ignore\",\n", " message=r\"The plugin infrastructure.*\",\n", " category=FutureWarning,\n", ")\n", "\n", "# create paths for use with CytoDataFrames below\n", "jump_data_path = \"../../../tests/data/cytotable/JUMP_plate_BR00117006\"\n", "nf1_cellpainting_path = \"../../../tests/data/cytotable/NF1_cellpainting_data_shrunken/\"\n", "nuclear_speckles_path = \"../../../tests/data/cytotable/nuclear_speckles\"\n", "pediatric_cancer_atlas_path = (\n", " \"../../../tests/data/cytotable/pediatric_cancer_atlas_profiling\"\n", ")" ] }, { "cell_type": "code", "execution_count": 2, "id": "1e219072-c9de-4fef-8916-0218c09fac14", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 983 ms, sys: 695 ms, total: 1.68 s\n", "Wall time: 543 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "4b2003628f1d47e0b57aacacbb182f6f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberCells_Number_Object_NumberImage_FileName_OrigAGPImage_FileName_OrigDNAImage_FileName_OrigRNA
011
112
213
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view JUMP plate BR00117006 with images\n", "CytoDataFrame(\n", " data=f\"{jump_data_path}/BR00117006_shrunken.parquet\",\n", " data_context_dir=f\"{jump_data_path}/images/orig\",\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Cells_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " \"Image_FileName_OrigRNA\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 3, "id": "da4c0c27-eed4-4302-883e-3136946dd532", "metadata": { "lines_to_next_cell": 2 }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 928 ms, sys: 655 ms, total: 1.58 s\n", "Wall time: 499 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "399c2f55e57f4ebd9b964ff92924c4e8", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberCells_Number_Object_NumberImage_FileName_OrigAGPImage_FileName_OrigDNAImage_FileName_OrigRNA
011
112
213
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view JUMP plate BR00117006 with images and overlaid outlines for segmentation\n", "CytoDataFrame(\n", " data=f\"{jump_data_path}/BR00117006_shrunken.parquet\",\n", " data_context_dir=f\"{jump_data_path}/images/orig\",\n", " data_outline_context_dir=f\"{jump_data_path}/images/outlines\",\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Cells_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " \"Image_FileName_OrigRNA\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 4, "id": "89f1348c-e150-4aa9-810a-a4ac8bfb1759", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 931 ms, sys: 673 ms, total: 1.6 s\n", "Wall time: 487 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "62b80d9eeb624f4a897f841b564cedda", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberCells_Number_Object_NumberImage_FileName_OrigAGPImage_FileName_OrigDNAImage_FileName_OrigRNA
011
112
213
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view JUMP plate BR00117006 with images and overlaid outlines for segmentation\n", "# and changing the color to something besides the default (default is green).\n", "CytoDataFrame(\n", " data=f\"{jump_data_path}/BR00117006_shrunken.parquet\",\n", " data_context_dir=f\"{jump_data_path}/images/orig\",\n", " data_outline_context_dir=f\"{jump_data_path}/images/outlines\",\n", " display_options={\"outline_color\": (200, 100, 255)},\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Cells_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " \"Image_FileName_OrigRNA\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 5, "id": "1db0449b-fa2f-4c1e-95ee-08b59a2c3b09", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 944 ms, sys: 691 ms, total: 1.64 s\n", "Wall time: 489 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "00c33678ea604a64b5804dd5d537632e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberCells_Number_Object_NumberImage_FileName_OrigAGPImage_FileName_OrigDNAImage_FileName_OrigRNA
011
112
213
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view JUMP plate BR00117006 with images and overlaid outlines for segmentation\n", "# and removing the optional red center dot.\n", "CytoDataFrame(\n", " data=f\"{jump_data_path}/BR00117006_shrunken.parquet\",\n", " data_context_dir=f\"{jump_data_path}/images/orig\",\n", " data_outline_context_dir=f\"{jump_data_path}/images/outlines\",\n", " display_options={\"center_dot\": False},\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Cells_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " \"Image_FileName_OrigRNA\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 6, "id": "c0b2b0a9-1b77-4e0d-8a69-410174d0a713", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 922 ms, sys: 686 ms, total: 1.61 s\n", "Wall time: 470 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "22736707bdfd401881861c17f200b7b2", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberCells_Number_Object_NumberImage_FileName_OrigAGPImage_FileName_OrigDNAImage_FileName_OrigRNA
011
112
213
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view JUMP plate BR00117006 with images and change the display width\n", "CytoDataFrame(\n", " data=f\"{jump_data_path}/BR00117006_shrunken.parquet\",\n", " data_context_dir=f\"{jump_data_path}/images/orig\",\n", " data_outline_context_dir=f\"{jump_data_path}/images/outlines\",\n", " display_options={\"width\": \"100\"},\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Cells_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " \"Image_FileName_OrigRNA\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 7, "id": "d5c44618-4a16-4bb8-a42a-0043a358937e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 939 ms, sys: 675 ms, total: 1.61 s\n", "Wall time: 500 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "db4fd67a3bee42d8a064ce123a83500a", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
01234
Metadata_ImageNumber11111
Cells_Number_Object_Number12345
Image_FileName_OrigAGP
Image_FileName_OrigDNA
Image_FileName_OrigRNA
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view JUMP plate BR00117006 with images, change the display height and width\n", "# and also transpose for a different view of things.\n", "CytoDataFrame(\n", " data=f\"{jump_data_path}/BR00117006_shrunken.parquet\",\n", " data_context_dir=f\"{jump_data_path}/images/orig\",\n", " data_outline_context_dir=f\"{jump_data_path}/images/outlines\",\n", " display_options={\"width\": \"200px\", \"height\": \"auto\"},\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Cells_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " \"Image_FileName_OrigRNA\",\n", " ]\n", "][:5].T" ] }, { "cell_type": "code", "execution_count": 8, "id": "365f68d0-3b66-4fb8-a381-8712dc43188c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 297 ms, sys: 199 ms, total: 496 ms\n", "Wall time: 173 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "646d0d0222624a1a8733b79153319175", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberMetadata_Cells_Number_Object_NumberImage_FileName_GFPImage_FileName_RFPImage_FileName_DAPI
353314
156411317
1275945
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view NF1 Cell Painting data with images\n", "CytoDataFrame(\n", " data=f\"{nf1_cellpainting_path}/Plate_2_with_image_data_shrunken.parquet\",\n", " data_context_dir=f\"{nf1_cellpainting_path}/Plate_2_images\",\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Metadata_Cells_Number_Object_Number\",\n", " \"Image_FileName_GFP\",\n", " \"Image_FileName_RFP\",\n", " \"Image_FileName_DAPI\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 9, "id": "de89c992-ea92-4565-b03b-3b27ae46d28c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 263 ms, sys: 186 ms, total: 450 ms\n", "Wall time: 143 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ec7ed824e35a4a26a88165a524f26361", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberMetadata_Cells_Number_Object_NumberImage_FileName_GFPImage_FileName_RFPImage_FileName_DAPI
353314
156411317
1275945
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view NF1 Cell Painting data with images and overlaid outlines from masks\n", "CytoDataFrame(\n", " data=f\"{nf1_cellpainting_path}/Plate_2_with_image_data_shrunken.parquet\",\n", " data_context_dir=f\"{nf1_cellpainting_path}/Plate_2_images\",\n", " data_mask_context_dir=f\"{nf1_cellpainting_path}/Plate_2_masks\",\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Metadata_Cells_Number_Object_Number\",\n", " \"Image_FileName_GFP\",\n", " \"Image_FileName_RFP\",\n", " \"Image_FileName_DAPI\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 10, "id": "49fc2952-eb69-4ed9-bd91-c29843ddbebd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 294 ms, sys: 182 ms, total: 476 ms\n", "Wall time: 174 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e0f4b50b93bb4c389f67ac3ef60a08b0", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberMetadata_Cells_Number_Object_NumberImage_FileName_GFPImage_FileName_RFPImage_FileName_DAPI
353314
156411317
1275945
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# add active paths on the local system to show how CytoDataFrame\n", "# may be used without specifying a context directory for images.\n", "# Note: normally these paths are local to the system where the\n", "# profile data was generated, which often is not the same as the\n", "# system which will be used to analyze the data.\n", "parquet_path = f\"{nf1_cellpainting_path}/Plate_2_with_image_data_shrunken.parquet\"\n", "nf1_dataset_with_modified_image_paths = pd.read_parquet(path=parquet_path)\n", "nf1_dataset_with_modified_image_paths.loc[\n", " :, [\"Image_PathName_DAPI\", \"Image_PathName_GFP\", \"Image_PathName_RFP\"]\n", "] = f\"{pathlib.Path(parquet_path).parent}/Plate_2_images\"\n", "\n", "# view NF1 Cell Painting data with images and overlaid outlines from masks\n", "CytoDataFrame(\n", " # note: we can read directly from an existing Pandas DataFrame\n", " data=nf1_dataset_with_modified_image_paths,\n", " data_mask_context_dir=f\"{nf1_cellpainting_path}/Plate_2_masks\",\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Metadata_Cells_Number_Object_Number\",\n", " \"Image_FileName_GFP\",\n", " \"Image_FileName_RFP\",\n", " \"Image_FileName_DAPI\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 11, "id": "5a5304db-7dac-4f45-aa55-dd3f50299c60", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 81.6 ms, sys: 18.9 ms, total: 101 ms\n", "Wall time: 68.6 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8cf2530208254caf933acc79f070f636", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberNuclei_Number_Object_NumberImage_FileName_A647Image_FileName_DAPIImage_FileName_GOLD
011slide1_A1_M10_CH1_Z09_illumcorrect.tiffslide1_A1_M10_CH2_Z09_illumcorrect.tiff
112slide1_A1_M10_CH1_Z09_illumcorrect.tiffslide1_A1_M10_CH2_Z09_illumcorrect.tiff
213slide1_A1_M10_CH1_Z09_illumcorrect.tiffslide1_A1_M10_CH2_Z09_illumcorrect.tiff
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view nuclear speckles data with images and overlaid outlines from masks\n", "CytoDataFrame(\n", " data=f\"{nuclear_speckles_path}/test_slide1_converted.parquet\",\n", " data_context_dir=f\"{nuclear_speckles_path}/images/plate1\",\n", " data_mask_context_dir=f\"{nuclear_speckles_path}/masks/plate1\",\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Nuclei_Number_Object_Number\",\n", " \"Image_FileName_A647\",\n", " \"Image_FileName_DAPI\",\n", " \"Image_FileName_GOLD\",\n", " ]\n", "][:3]" ] }, { "cell_type": "code", "execution_count": 12, "id": "4c9af999-c9a2-4408-aa16-9437d08013ae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 401 ms, sys: 291 ms, total: 692 ms\n", "Wall time: 212 ms\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "f27eedd7885b4beeac5a952c4b9f6ab9", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(IntSlider(value=50, continuous_update=False, description='Image adjustment:', style=SliderStyle…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Metadata_ImageNumberMetadata_Nuclei_Number_Object_NumberImage_FileName_OrigAGPImage_FileName_OrigDNA
033
134
236
337
438
\n", "
\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "# view ALSF pediatric cancer atlas plate BR00143976 with images\n", "CytoDataFrame(\n", " data=f\"{pediatric_cancer_atlas_path}/BR00143976_shrunken.parquet\",\n", " data_context_dir=f\"{pediatric_cancer_atlas_path}/images/orig\",\n", " data_outline_context_dir=f\"{pediatric_cancer_atlas_path}/images/outlines\",\n", " segmentation_file_regex={\n", " r\"CellsOutlines_BR(\\d+)_C(\\d{2})_\\d+\\.tiff\": r\".*ch3.*\\.tiff\",\n", " r\"NucleiOutlines_BR(\\d+)_C(\\d{2})_\\d+\\.tiff\": r\".*ch5.*\\.tiff\",\n", " },\n", ")[\n", " [\n", " \"Metadata_ImageNumber\",\n", " \"Metadata_Nuclei_Number_Object_Number\",\n", " \"Image_FileName_OrigAGP\",\n", " \"Image_FileName_OrigDNA\",\n", " ]\n", "]" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.12.9" } }, "nbformat": 4, "nbformat_minor": 5 }