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

Initial commit of phenotype by neighbour analysis #988

Merged
merged 23 commits into from
May 23, 2023
Merged

Conversation

khoulahan
Copy link
Contributor

@khoulahan khoulahan commented May 8, 2023

What is the purpose of this PR?
Closes #941.
How is the phenotype of a cell impact by its neighboring cells? Addressing this question requires characterizing the neighbors of a cell. What is the average distance of the cell in question to cancer cells? Immune cells? Fibroblasts? Do these distances inform on the phenotype of the cell in question? The goal of this function is to provide per cell measurements of the median distance to the N nearest cells of each cell cluster.

How did you implement your changes

The end result is a cell by cell cluster matrix populated with the median distance to the N nearest cells of each cell cluster. The analysis is split into two functions:

  1. All cells vs one cell cluster:
  • For all cells of a specified cell cluster, calculates median distance to nearest N neighbours of all other cell types
  • Takes four required inputs: distance matrix, cell table, cell cluster, N nearest neighbors
  1. All cells vs all cell clusters
  • Wrapper function that calls function 1 for all cell clusters
  • Takes three required inputs: distance matrix, cell table, N nearest neighbours

Results

  • Cells with closest average distance to Mono_mac cells
Screenshot 2023-05-18 at 11 44 13 AM
  • Cells with farthest average distance to Mono_mac cells
Screenshot 2023-05-18 at 11 44 32 AM

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.

Thanks @khoulahan! I'll let you know once we've got some results

@camisowers camisowers mentioned this pull request May 11, 2023
3 tasks
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@srivarra srivarra added the enhancement New feature or request label May 18, 2023
Copy link
Contributor

@srivarra srivarra 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, just some stylistic stuff.

src/ark/analysis/cell_neighborhood_stats.py Show resolved Hide resolved
src/ark/analysis/cell_neighborhood_stats.py Outdated Show resolved Hide resolved
src/ark/analysis/cell_neighborhood_stats.py Show resolved Hide resolved
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.

Just a few minor comments.

src/ark/analysis/cell_neighborhood_stats.py Show resolved Hide resolved
src/ark/analysis/cell_neighborhood_stats.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.

Looks good, see below

src/ark/analysis/cell_neighborhood_stats.py Show resolved Hide resolved
src/ark/analysis/cell_neighborhood_stats.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.

Looks good

@ngreenwald ngreenwald merged commit d547efb into main May 23, 2023
@ngreenwald ngreenwald deleted the neighbour-phenotype branch May 23, 2023 22:49
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.

Calculate cell by cell cluster matrix with median distance to N nearest cells of cell cluster
5 participants