angelolab / ark-analysis

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

Don't generate duplicate `cluster_id` columns if `generate_and_save_cluster_masks` run twice #1110

Closed alex-l-kong closed 4 months ago

alex-l-kong commented 5 months ago

What is the purpose of this PR?

Closes #1099. Addresses an issue in the merging of gui_map and cluster_map in generate_and_save_cluster_masks where if an existing cluster_id already exists in gui_map, multiple cluster_id columns with variable suffixes get created.

How did you implement your changes

We use the .drop method in pandas with errors="ignore" to drop the cluster_id column, but only if it exists. This will prevent merging issues.