angelolab / ark-analysis

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

2 identicle pixel cluster names causes error when running train_cell_som #972

Closed HPiyadasa closed 1 year ago

HPiyadasa commented 1 year ago

Describe the bug When 2 pixel meta clusters are assigned the same name they are considered as 2 separate metaclusters. However in cell clustering notebook, these two pixel metaclusters are considered to be the same. This results in an error when running train_cell_som function

image

Expected behavior Generate a warning message when assigning a duplicate pixel metacluster name in the GUI or a warning when running the apply_pixel_meta_cluster_remapping after renaming the metaclusters in the GUI.

@alex-l-kong @cliu72

alex-l-kong commented 1 year ago

Probably best to add this functionality to the GUI if possible to save the user a bunch of trouble.

@HPiyadasa leaving this as low priority since I don't think this issue will come up frequently. Is there a reason you had to assign a duplicate metacluster name?

HPiyadasa commented 1 year ago

I would suggest for now include a warning in the text description mentioning to users that duplicate names should be avoided.

alex-l-kong commented 1 year ago

@HPiyadasa sounds good. I'll see if we can get that functionality easily included in the GUI as well. If not, we'll just leave it in the documentation.

cliu72 commented 1 year ago

I think it'd be good to have an error message if you have duplicate pixel cluster names - this came up in another issue by someone outside the lab as well: https://github.com/angelolab/ark-analysis/issues/986

I think implementation can be super simple - just add a check at the beginning of the cell clustering notebook. If there are duplicates, just show an error message that says "Duplicate pixel cluster names are not allowed. Please go back to the pixel clustering notebook" - or something like that.

alex-l-kong commented 1 year ago

I think it'd be good to have an error message if you have duplicate pixel cluster names - this came up in another issue by someone outside the lab as well: #986

I think implementation can be super simple - just add a check at the beginning of the cell clustering notebook. If there are duplicates, just show an error message that says "Duplicate pixel cluster names are not allowed. Please go back to the pixel clustering notebook" - or something like that.

I agree this would work, I was just thinking it'd be a bit easier on the user to have it error out in the pixel notebook directly as opposed to having to wait until the cell clustering notebook.

It's going to be too cumbersome to implement this in the GUI, but might be easier to put this check in apply_pixel_meta_cluster_remapping and apply_cell_meta_cluster_remapping. @cliu72 what do you think?

cliu72 commented 1 year ago

@alex-l-kong Yeah, I think having a check in the remapping functions is a great idea. No need to try to implement this in the GUI, that sounds hard.