NF02 · Morphology over time (LCI shape) ↔ motility & Cell Painting¶

Only centroid x/y has ever been persisted for LCI cells — no shape data exists anywhere yet. This notebook derives per-frame shape (area, perimeter, solidity, elongation, form factor) from the segmentation polygons already in 1.2GeoDataFrames/, joins it onto every live trajectory (not just ones reaching the final frame), and asks:

  1. Does a cell's shape (or how much its shape varies) relate to how it moves?
  2. For the subset linked to Cell Painting: does live, pre-fixation LCI shape predict the fixed CP AreaShape_*/RadialDistribution_* features — an independent check of nb06's speed↔polarization finding, using shape dynamics instead of a single fixed snapshot.
  3. Bonus: within a trajectory, does an elongation change precede a speed change?

1 · Derive shape-over-time (cached — ~4 min the first time)¶

301,928 (cell, frame) rows across 65 frames
area perimeter solidity elongation equivalent_diameter form_factor
count 301928.000000 301928.000000 301928.000000 301928.000000 301928.000000 301928.000000
mean 206.558891 56.411638 0.945292 1.332324 15.798082 0.781238
std 89.735143 13.415506 0.040029 0.352184 3.663276 0.101652
min 5.500000 8.828427 0.364754 1.000000 2.646284 0.098491
25% 144.500000 48.284271 0.937677 1.096774 13.564038 0.740559
50% 202.500000 56.526912 0.957014 1.225000 16.057117 0.809845
75% 261.500000 64.526912 0.968254 1.451613 18.246976 0.852309
max 1713.500000 248.693434 1.000000 30.000000 46.708628 0.947441
shape match rate: 100.0% of trajectory-frame rows
4,375 live trajectories with both shape and motility summaries
trajectory_id n_frames_x area_mean area_cv perimeter_mean perimeter_cv solidity_mean solidity_cv elongation_mean elongation_cv ... net_dx net_dy net_displacement path_length straightness mean_step heading_deg net_displacement_um path_length_um mean_step_um
0 0 59 184.673729 0.176340 55.217230 0.093445 0.955881 0.026780 1.320728 0.128906 ... 4.671155 0.805837 4.740154 74.397588 0.063714 1.282717 9.787951 15.405502 241.792160 4.168830
1 5 60 317.691667 0.196909 69.683935 0.119615 0.957042 0.017920 1.168780 0.103304 ... -6.292424 -2.622130 6.816903 72.387541 0.094172 1.226907 -157.377907 22.154935 235.259509 3.987449
2 6 60 205.116667 0.286487 55.841175 0.128143 0.948400 0.032452 1.191035 0.140578 ... 2.349297 2.219390 3.231855 95.627568 0.033796 1.620806 43.371275 10.503530 310.789596 5.267620
3 9 59 251.381356 0.153531 61.157815 0.080683 0.962682 0.018217 1.133443 0.116789 ... 14.269259 12.900966 19.236597 64.303581 0.299153 1.108682 42.117019 62.518941 208.986637 3.603218
4 10 60 245.833333 0.194863 63.438518 0.100784 0.932289 0.032329 1.204139 0.141231 ... -13.040122 4.101433 13.669913 113.388627 0.120558 1.921841 162.540379 44.427218 368.513038 6.245984

5 rows × 31 columns

2 · Shape vs. motility, all live trajectories¶

No description has been provided for this image
shape_feature metric rho p abs_rho
39 equivalent_diameter_cv mean_step_um 0.691881 0.000000e+00 0.691881
7 area_cv mean_step_um 0.685978 0.000000e+00 0.685978
15 perimeter_cv mean_step_um 0.660162 0.000000e+00 0.660162
19 solidity_mean mean_step_um -0.631515 0.000000e+00 0.631515
47 form_factor_cv mean_step_um 0.587182 0.000000e+00 0.587182
43 form_factor_mean mean_step_um -0.585962 0.000000e+00 0.585962
23 solidity_cv mean_step_um 0.585393 0.000000e+00 0.585393
1 area_mean path_length_um 0.517585 1.813623e-298 0.517585
33 equivalent_diameter_mean path_length_um 0.516012 2.321146e-296 0.516012
9 perimeter_mean path_length_um 0.483341 5.447381e-255 0.483341

3 · Does live shape predict fixed Cell Painting morphology?¶

Merge the per-trajectory LCI shape summary onto the CP-linked cells (linked_master.parquet, via trajectory_id) and correlate against CP AreaShape_*/RadialDistribution_* features (skipping Zernike) -- the same feature set nb06 used.

1,709 CP-linked cells with LCI shape summary | 160 CP features
Strongest live-shape <-> fixed-CP-morphology associations:
lci_shape_feature cp_feature rho p abs_rho
1624 form_factor_mean AreaShape_Solidity 0.291001 1.049560e-34 0.291001
664 solidity_mean AreaShape_Solidity 0.290343 1.503108e-34 0.290343
1719 form_factor_mean RadialDistribution_FracAtD_OrigRNA_4of4 -0.289058 3.020210e-34 0.289058
1717 form_factor_mean RadialDistribution_FracAtD_OrigRNA_2of4 0.284228 4.032442e-33 0.284228
666 solidity_mean Intensity_IntegratedIntensityEdge_OrigDNA -0.280051 3.639308e-32 0.280051
1626 form_factor_mean Intensity_IntegratedIntensityEdge_OrigDNA -0.278369 8.737078e-32 0.278369
1715 form_factor_mean RadialDistribution_FracAtD_OrigMito_4of4 -0.278136 9.856376e-32 0.278136
1711 form_factor_mean RadialDistribution_FracAtD_OrigER_4of4 -0.277532 1.347609e-31 0.277532
1709 form_factor_mean RadialDistribution_FracAtD_OrigER_2of4 0.273314 1.169232e-30 0.273314
759 solidity_mean RadialDistribution_FracAtD_OrigRNA_4of4 -0.273084 1.314270e-30 0.273084
755 solidity_mean RadialDistribution_FracAtD_OrigMito_4of4 -0.272382 1.875669e-30 0.272382
1713 form_factor_mean RadialDistribution_FracAtD_OrigMito_2of4 0.271219 3.371993e-30 0.271219
1716 form_factor_mean RadialDistribution_FracAtD_OrigRNA_1of4 0.270633 4.527236e-30 0.270633
751 solidity_mean RadialDistribution_FracAtD_OrigER_4of4 -0.270374 5.155394e-30 0.270374
1703 form_factor_mean RadialDistribution_FracAtD_OrigActin_Golgi_Mem... -0.269337 8.665112e-30 0.269337

Bonus · Does shape change lead speed change within a trajectory?¶

For each sufficiently long trajectory, cross-correlate z-scored elongation(t) against z-scored speed(t+lag). Averaged across trajectories: a peak at positive lag means elongation changes before speed changes (shape driving movement); negative lag would mean movement drives subsequent shape change.

No description has been provided for this image
lag mean_corr n_trajectories
0 -5 0.004037 3342
1 -4 0.010535 3342
2 -3 0.019873 3342
3 -2 0.020657 3342
4 -1 0.027931 3342
5 0 0.075066 3342
6 1 0.110679 3342
7 2 0.075741 3342
8 3 0.066730 3342
9 4 0.060803 3342
10 5 0.049613 3342

⭐ Key finding¶

(Corrected: an earlier pass accidentally included post-fixation frames -- lci_trajectories_to_frame59.parquet runs through frame_index 64 despite its name; now explicitly filtered to frame_index <= MOTILITY_LAST_FRAME. The correlations below got slightly *stronger after the fix, not weaker.)*

Shape variability over time is a much stronger correlate of speed than any fixed CP feature. Across 4,375 live trajectories, per-trajectory coefficient-of-variation of shape features correlates with mean_step_um far more strongly than nb06's CP-feature correlations (|ρ| ≈ 0.13-0.16): equivalent_diameter_cv ρ=+0.69, area_cv ρ=+0.69, perimeter_cv ρ=+0.66, solidity_mean ρ=-0.63 (all p≈0, n=4,375). Faster cells fluctuate in size/shape more and are less solid/convex — consistent with active protrusive activity (lamellipodia/filopodia) driving both movement and shape irregularity.

Cross-modality validation: live LCI solidity_mean/form_factor_mean correlate with the CP-measured AreaShape_Solidity itself (n=1,709 linked cells) — a sanity-check that our polygon-derived shape agrees with CellProfiler's own shape measurement despite being computed independently, pre- vs. post-fixation. The live shape summary also correlates with CP RadialDistribution_FracAtD organelle-distribution features, echoing nb06's speed↔polarization finding from the morphology side instead of speed.

Bonus — shape leads speed: the elongation→speed cross-correlation peaks at lag = +1 frame (mean corr 0.111, n=3,342 trajectories), decaying over the next few frames and much lower at negative lags — weak but consistent evidence that a cell's shape change (elongating) precedes its speed change, not the other way around, matching the biological expectation that polarization precedes movement.