Skip to content

Commit aab474c

Browse files
authored
Add JUMP image data compatibility and example notebook (#18)
* add testing data * add additional orig images * add exception messages for #15 * add imagecodecs; jupyterlab deps * shift to mask focus for current outlines * update to outline method; tests; outline image nms * add docs; slight modifications; example notebook * linting
1 parent 44a9b8a commit aab474c

17 files changed

+1871
-19
lines changed

docs/src/examples.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Examples
2+
3+
```{toctree}
4+
---
5+
caption: "List of examples"
6+
maxdepth: 2
7+
glob:
8+
---
9+
examples/*
10+
```

docs/src/examples/cytodataframe_at_a_glance.ipynb

+532
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# ---
2+
# jupyter:
3+
# jupytext:
4+
# text_representation:
5+
# extension: .py
6+
# format_name: light
7+
# format_version: '1.5'
8+
# jupytext_version: 1.16.4
9+
# kernelspec:
10+
# display_name: Python 3 (ipykernel)
11+
# language: python
12+
# name: python3
13+
# ---
14+
15+
# # CytoDataFrame at a Glance
16+
#
17+
# This notebook demonstrates various capabilities of
18+
# [CytoDataFrame](https://github.com/WayScience/CytoDataFrame) using examples.
19+
#
20+
# CytoDataFrame is intended to provide you a Pandas-like
21+
# DataFrame experience which is enhanced with single-cell
22+
# visual information which can be viewed directly in a Jupyter notebook.
23+
24+
# +
25+
from cytodataframe.frame import CytoDataFrame
26+
27+
# create paths for use with CytoDataFrames below
28+
jump_data_path = "../../../tests/data/cytotable/JUMP_plate_BR00117006"
29+
nf1_cellpainting_path = "../../../tests/data/cytotable/NF1_cellpainting_data_shrunken/"
30+
nuclear_speckles_path = "../../../tests/data/cytotable/nuclear_speckles"
31+
# -
32+
# %%time
33+
# view JUMP plate BR00117006 with images
34+
CytoDataFrame(
35+
data=f"{jump_data_path}/BR00117006_shrunken.parquet",
36+
data_context_dir=f"{jump_data_path}/images/orig",
37+
)[
38+
[
39+
"Metadata_ImageNumber",
40+
"Cells_Number_Object_Number",
41+
"Image_FileName_OrigAGP",
42+
"Image_FileName_OrigDNA",
43+
"Image_FileName_OrigRNA",
44+
]
45+
][:3]
46+
47+
# %%time
48+
# view JUMP plate BR00117006 with images and overlaid outlines for segmentation
49+
CytoDataFrame(
50+
data=f"{jump_data_path}/BR00117006_shrunken.parquet",
51+
data_context_dir=f"{jump_data_path}/images/orig",
52+
data_outline_context_dir=f"{jump_data_path}/images/outlines",
53+
)[
54+
[
55+
"Metadata_ImageNumber",
56+
"Cells_Number_Object_Number",
57+
"Image_FileName_OrigAGP",
58+
"Image_FileName_OrigDNA",
59+
"Image_FileName_OrigRNA",
60+
]
61+
][:3]
62+
63+
64+
# %%time
65+
# view NF1 Cell Painting data with images
66+
CytoDataFrame(
67+
data=f"{nf1_cellpainting_path}/Plate_2_with_image_data_shrunken.parquet",
68+
data_context_dir=f"{nf1_cellpainting_path}/Plate_2_images",
69+
)[
70+
[
71+
"Metadata_ImageNumber",
72+
"Metadata_Cells_Number_Object_Number",
73+
"Image_FileName_GFP",
74+
"Image_FileName_RFP",
75+
"Image_FileName_DAPI",
76+
]
77+
][:3]
78+
79+
# %%time
80+
# view NF1 Cell Painting data with images and overlaid outlines from masks
81+
CytoDataFrame(
82+
data=f"{nf1_cellpainting_path}/Plate_2_with_image_data_shrunken.parquet",
83+
data_context_dir=f"{nf1_cellpainting_path}/Plate_2_images",
84+
data_mask_context_dir=f"{nf1_cellpainting_path}/Plate_2_masks",
85+
)[
86+
[
87+
"Metadata_ImageNumber",
88+
"Metadata_Cells_Number_Object_Number",
89+
"Image_FileName_GFP",
90+
"Image_FileName_RFP",
91+
"Image_FileName_DAPI",
92+
]
93+
][:3]
94+
95+
# %%time
96+
# view nuclear speckles data with images and overlaid outlines from masks
97+
CytoDataFrame(
98+
data=f"{nuclear_speckles_path}/test_slide1_converted.parquet",
99+
data_context_dir=f"{nuclear_speckles_path}/images/plate1",
100+
data_mask_context_dir=f"{nuclear_speckles_path}/masks/plate1",
101+
)[
102+
[
103+
"Metadata_ImageNumber",
104+
"Nuclei_Number_Object_Number",
105+
"Image_FileName_A647",
106+
"Image_FileName_DAPI",
107+
"Image_FileName_GOLD",
108+
]
109+
][:3]

docs/src/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ relative-images:
1212
caption: 'Contents:'
1313
maxdepth: 3
1414
---
15+
examples
1516
python-api
1617
presentations
1718
contributing

media/coverage-badge.svg

+1-1
Loading

0 commit comments

Comments
 (0)