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

Append cell meta cluster labels to cell table #567

Merged
merged 13 commits into from
May 28, 2022
Merged

Conversation

alex-l-kong
Copy link
Contributor

@alex-l-kong alex-l-kong commented May 26, 2022

What is the purpose of this PR?

Closes #551 and closes #523. The cell table is a requirement for several downstream analysis scripts, not just pixel clustering. To ensure analysis can be performed based on the cell meta cluster labels, these will need to be appended to the cell table as well.

How did you implement your changes

A function add_consensus_labels_cell_table will run this appending process, with the call in example_cell_clustering.ipynb placed at the end of the notebook. The original cell_table_name will be overwritten with the same data including the 'cell_meta_cluster_rename' column in cell_consensus_name (simply 'cell_meta_cluster' in the cell table).

Users will be able to save multiple times and can also re-run the cell SOM training with the newly-saved cell table if desired.

Additionally, we now allow more flexible locations for the cell table. Initially, it was forced to be in base_dir. Now, we default the location to segmentation_dir, with options to change the root. Note that the updated cell table will be saved in the same root directory as the original cell table.

@alex-l-kong alex-l-kong self-assigned this May 26, 2022
@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

@cliu72 cliu72 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@cliu72
Copy link
Contributor

cliu72 commented May 27, 2022

Sorry I already approved the changes, but I just thought of a possible use case that might cause an error with this implementation. For very small cells (or weird cells), it's possible they're not included in the cell clustering (if there are no pixel clusters in there). In that case, the cell table and the cell clustering output wouldn't have the same entries. It would probably best to have those say "Unassigned" or something like that in the metacluster column in the cell table.

ark/phenotyping/som_utils.py Outdated Show resolved Hide resolved
ark/phenotyping/som_utils.py Show resolved Hide resolved
ark/phenotyping/som_utils.py Outdated Show resolved Hide resolved
@ngreenwald ngreenwald merged commit b76780a into master May 28, 2022
@ngreenwald ngreenwald deleted the cell_label_add branch May 28, 2022 16:41
@srivarra srivarra added the enhancement New feature or request label Jun 15, 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.

Update cell table with cluster IDs Defaults for location of cell_table
4 participants