Closed cliu72 closed 4 months ago
The cluster_id
should be the same values for both columns (not affected by the fov subset used), so I think it would be really easy to just not re-generate the column if it already exists.
@camisowers agreed. I can add a fix for that.
Describe the bug This is a pretty niche problem, but hopefully this fix is straight forward. When I run the "4.4: Generate cell phenotype maps" section of the cell clustering notebook more than once, I get this error:
KeyError: "['cluster_id'] not in index"
. The use case for this is if a user wants to look at ['fov1','fov2'] first and runs the rest of the notebook withsubset_cell_fovs = ['fov1','fov2']
, then decides they want to look at other fovs, so changessubset_cell_fovs
and tries to run the rest of the notebook again.I think this error is because in![image](https://github.com/angelolab/ark-analysis/assets/11382352/e8e7af30-ec23-4026-aba3-13f0ef27f1b6)
generate_and_save_cell_cluster_masks
, acluster_id
column is added to the mapping csv. However, if this function is run multiple times, because thecluster_id
column already exists, the columns are not merged properly:Expected behavior Should be allowed to change
subset_cell_fovs
and re-run the rest of the notebook without issue.To Reproduce Run the example dataset in notebook 3 all the way through. Go back to the start of section 4.4, change![image](https://github.com/angelolab/ark-analysis/assets/11382352/c3631ed5-10cf-40f4-9c28-e95b355a0f74)
subset_cell_fovs
to something else (ex. ['fov3','fov4']) and run the rest of the notebook. After doing this, I got this error in the last cell: