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

Mixing score #836

Merged
merged 66 commits into from
Feb 17, 2023
Merged

Mixing score #836

merged 66 commits into from
Feb 17, 2023

Conversation

camisowers
Copy link
Contributor

@camisowers camisowers commented Nov 17, 2022

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

What is the purpose of this PR?
Closes #756 and closes #793.
Closes #906.

How did you implement your changes
Detailed in design doc.
In addition to adding cell cluster column name to neighborhood matrix, I also added a mixing arg (default False) which indicates whether to drop cells with no nearby neighbors from the table.
(It was doing this automatically, but we would want to keep these cells in the table to determine if FOVs are cold by summing the reference cells.)

Remaining issues

  • test against Leeat's data
  • test against Noah's data
  • check cells with no cluster assignment stay in table
  • check 50 vs 100 radius
  • check count vs frequency

@camisowers camisowers added the enhancement New feature or request label Nov 17, 2022
@camisowers camisowers self-assigned this Nov 17, 2022
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@camisowers
Copy link
Contributor Author

Testing against Leeat's data and using the calculation detailed here, we see our results below on the left. There only are two misclassifications seen; however while we visualize the raw scores, her data seems to have some type of normalizing, but it is not mentioned in her paper.
Screen Shot 2022-11-30 at 11 47 12 AM

If we were to consider a "percent mixing score" which I noticed she explored in her code, we see a more similar representation of the mixing scores but with now an additional misclassification. All three are borderline cases though and don't raise too much concern.
Screen Shot 2022-11-30 at 11 47 37 AM

Differences between the two calculations:
Screen Shot 2022-11-30 at 11 58 22 AM

Adjusting the radius for creating neighborhood matrices seems to slightly change the order of the FOV mixing scores, but there doesn't seem to be any drastic changes. This would mostly affect the borderline cases and determining a threshold.
Screen Shot 2022-11-30 at 12 30 04 PM

@camisowers camisowers marked this pull request as ready for review November 30, 2022 22:05
templates/Mixing_Score.ipynb Outdated Show resolved Hide resolved
templates/Mixing_Score.ipynb Outdated Show resolved Hide resolved
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

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

Looks great, see comments on the notebook

ark/analysis/spatial_analysis.py Outdated Show resolved Hide resolved
@camisowers
Copy link
Contributor Author

Notebook now generates a simple plot

Screen Shot 2022-12-01 at 3 50 50 PM

Copy link
Member

@ngreenwald ngreenwald 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! Now that we've worked out the logic for dropping rare cells, same question as before: do we need to separate the different spatial analyses?

ark/analysis/spatial_analysis.py Outdated Show resolved Hide resolved
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

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

Everything else looks good

@ngreenwald ngreenwald merged commit d3a10be into main Feb 17, 2023
@ngreenwald ngreenwald deleted the mixing_score branch February 17, 2023 21:34
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
2 participants