angelolab / ark-analysis

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

Mass plotting notebook #1052

Closed srivarra closed 11 months ago

srivarra commented 12 months ago

If you haven't already, please read through our contributing guidelines before opening your PR

What is the purpose of this PR?

Adds a notebook that demonstrates how to generate plots for a cohort. Adds functionality to plot a continuous variable.

For cluster mask plots, adds the ability to erode the segmentation mask boundaries to improve the readability of cells.

How did you implement your changes

Added a notebook which allows the user to plot cluster masks and continuous variables for a cohort.

Remaining issues

May have accidentally ran a formatter in the plot_utils.py file.

This branch needs to be first merged into #1030. Then that will be merged into main.

Sample Plots

fov7_colored_mask

fov7_cluster_mask

review-notebook-app[bot] commented 12 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

srivarra commented 12 months ago

Not sure why the other checks (testing, building) are not being displayed. They are running here: https://github.com/angelolab/ark-analysis/actions/runs/6030848048?pr=1030

srivarra commented 12 months ago

@camisowers

  1. There seems to be some visualizations missing from the two LDA and the fiber segmentation notebooks.

Yeah I see they got cut off.

  1. Also the multicolored borders on the example plot you posted can be removed by setting interpolation=None. (plot_neighborhood_cluster_result has multiple colors per cell #967) I see it's included for the non-continuous plotting, but is it working when saving the images?

Ah, it has to be the string "none" not the value None /:

review-notebook-app[bot] commented 12 months ago

View / edit / reply to this conversation on ReviewNB

camisowers commented on 2023-09-01T00:27:55Z ----------------------------------------------------------------

Okay I've been exploring why the fiber segmentation looks like trash here when nothing has been changed. Turns out when scikit-image was bumped to >=0.20 in ark, the filtering function is pretty different based on the changes in this PR (https://github.com/scikit-image/scikit-image/pull/6446/files#diff-2117607a4aeb575b634d39cbb4a619bcb0c9a3fec80255bea8bd417b7ca4ba43). This is mostly a note for me to think about what to do. 🥺


camisowers commented 11 months ago

Looks great! One change about the documentation, and a clarification about the gradient plotting. I think it should be possible to add it to the clustermap coloring function you already have, but if it's easier/cleaner to have it separated, that's fine too

I think @camisowers already has code somewhere that colors the fiber segmentation objects by alignment score; you can use that as a guide.

https://github.com/angelolab/ark-analysis/blob/e5d0fd97156f7a096025898abf3bcd5c5c71296b/src/ark/segmentation/fiber_segmentation.py#L572

This function colors the fiber mask by any stat column in the table. Can easily be tweaked to work generally for any specified mask type.

review-notebook-app[bot] commented 11 months ago

View / edit / reply to this conversation on ReviewNB

ngreenwald commented on 2023-09-14T18:11:03Z ----------------------------------------------------------------

We should clear this output


review-notebook-app[bot] commented 11 months ago

View / edit / reply to this conversation on ReviewNB

ngreenwald commented on 2023-09-14T18:11:06Z ----------------------------------------------------------------

Does the example dataset cell table have multiple different clustering columns? Or just one? If it has multiple, we should use the one that has broader cell type definitions, so there are fewer different clusters


srivarra commented on 2023-09-14T18:45:07Z ----------------------------------------------------------------

I believe there is only one metacluster column.