Skip to content

trangle1302/2D_shapespace

Repository files navigation

Pipeline to process shape modes

pilot: U2OS cell lines small subsets (private images, manual segmentation and annotations): cells (1776 images) HPA (public images, automatic segmentation): 297108 cells (23272 images)

Steps for the pipelines:

s0 - segmentation

Either manual segmentation, or segmentation by any DL model (in this case HPACellSegmentator for inference; training code is currently in private repo). I've also provided here example of training and segmenting dataset by the popular cellpose v2.0 (credits to their starter notebook, I only wrapped them in a more comprehensible/concise manner). The training set for this part is only 9 images/FOVs.

s1 - process image masks of multiple cells to single cell masks of cell and nucleus, and into .npy

Folder: segmentation

Removing cells where nucleus touching the borders. Cells where cell segmentation touching the bordered are still kept (maybe do a percentage rules to remove them in the future).

python s1_get_single_cell_shapes.py

s2 - get FFT coeficients for individua cell and nucleus shapes

Folder: coefficients

  • Alignment and center: major axis, nuclei-cell centroid vector, major axis + nuclei centroid (mass) alignment
  • Calculate FFT of x,y of the nucleus and cell segmentation (equally spaced sample along the shapes): fast fourier coefficients, elliptical fourier discriptors, wavelet
  • Save result of multiprocessing pool
python s2_calculate_fft.py

s3 - Calculate shape modes & map of single-organelle protein

Folder: shapemodes

Fit and transform PCA, calculate shapemodes (n_PCs with xx% variance) based on coefficients produced from s2.

python s3_calculate_shapemodes.py

s4 - Protein parameterization: Intepolate concentric rings in green channels and shape modes

Folder: warp

Protein parameterization based on concentric rings from nucleus centroid - nucleus membrane - cell membrane. Final shape for all proteins: (n_rings, n_points)

python s4_concentric_rings_intensity.py

OR Protein morphing on to shape based on thin-plate splines given landmarks: nucleus centroid, 32p in nucleus membrane, 32p cell membrane. Final shape for all proteins = shape of the average cell in that shapemode (bin).

python s4_protein_image_warp.py

s5 - Organelle distribution and relation with each other

python s5_organelle_heatmappy

Mislanchelous shell scripts:

  • Count number of lines in a text file:

  • Replace old_text with new_text in a big file

time sed -i 's|old_text|new_text|g' filename.xxx
time sed -i 's|/data/2D|\n/data/2D|g' shift_error_meta_fft128_2.txt

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages