Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post clustering functionality #658

Merged
merged 14 commits into from
Aug 26, 2022
Merged

Post clustering functionality #658

merged 14 commits into from
Aug 26, 2022

Conversation

ngreenwald
Copy link
Member

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

What is the purpose of this PR?
Adds in logic to annotate the cell table following pixel clustering, as well as detailed instructions for how to use Mantis.

How did you implement your changes
A notebook with two parts. The first allows the user to select subsets of cells, give them new names, and then create a mantis directory to examine them. The second allows the user to identify specific thresholds for functional markers.

Remaining issues
For people who haven't used Mantis, is this clear enough guidance for what they need to do? Are there places where the bare code in the notebook is going to lead to problems? Given that the user is directly manipulating the pandas df there are some inelegant lines still in there, but I couldn't think of a way to avoid it that wasn't super over-engineered.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly small comments.


`cell_segmentation`: This file contains the predicted segmentation for each cell in the image, and allows mantis to identify individual cells.

`population_pixel_mask`: This file maps the individual pixel clusters generated by Pixie in the [pixel clustering notebook](link) to the image data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the link to the pixel clustering notebook.

Comment on lines 61 to 65
# generate unique numeric value for each population
unique_pops = small_table[pop_col].unique()
small_table['pop_vals'] = small_table[pop_col].replace(to_replace=unique_pops,
value=list(
range(1, len(unique_pops) + 1)))
Copy link
Contributor

@alex-l-kong alex-l-kong Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# generate unique numeric value for each population
unique_pops = small_table[pop_col].unique()
small_table['pop_vals'] = small_table[pop_col].replace(to_replace=unique_pops,
value=list(
range(1, len(unique_pops) + 1)))
small_table['pop_vals'] = pd.factorize(small_table[pop_col].tolist())[0] + 1



def create_mantis_project(cell_table, fovs, seg_dir, pop_col, mask_dir, image_dir, mantis_dir):
"""Creates masks with the updated cell labels"""
Copy link
Contributor

@alex-l-kong alex-l-kong Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a more descriptive docstring defining the Args.

@@ -0,0 +1,395 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an example visualization for this one?


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed

@@ -0,0 +1,395 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming these links are being added in later?


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're in the PR

@ngreenwald
Copy link
Member Author

@cliu72 @efrancis28 let me know if this makes sense for a post-clustering workflow, any other changes, etc

@cliu72
Copy link
Contributor

cliu72 commented Aug 22, 2022

This looks good to me.

@srivarra srivarra mentioned this pull request Aug 25, 2022
5 tasks
@ngreenwald ngreenwald merged commit 15b9a20 into main Aug 26, 2022
@ngreenwald ngreenwald deleted the post_clustering branch August 26, 2022 15:01
@srivarra srivarra added the enhancement New feature or request label Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants