angelolab / ark-analysis

Integrated pipeline for multiplexed image analysis
https://ark-analysis.readthedocs.io/en/latest/
MIT License
71 stars 25 forks source link

In pixel clustering, if restarting `create_pixel_matrix`, not all FOVs are used to find the 99.9th percentile values #1016

Closed cliu72 closed 1 year ago

cliu72 commented 1 year ago

Describe the bug If the create_pixel_matrix function in the pixel clustering notebook crashes or is stopped before it finishes for whatever reason, there is code in place to ignore any FOVs that have already been processed (https://github.com/angelolab/ark-analysis/blob/0266b96c689e9118f3b77355fe08df8f9c17b52c/src/ark/phenotyping/pixie_preprocessing.py#LL245-L258). However, this causes a problem with generating the 99.9th percentile values because only the FOVs that were processed will be used to generate the 99.9th percentile values (ignoring all FOVs that have already been processed). The correct behavior is to use all FOVs to calculate the 99.9th percentile values.

Expected behavior Either re-calculate the 99.9th percentile values for FOVs that have already been processed at the start of the function, or save the 99.9th percentile values for each FOV as we go. Open to other suggestions as well.