Skip to content

Add new method: CellMapper #31

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Marius1311
Copy link

@Marius1311 Marius1311 commented Jul 18, 2025

Describe your changes

This adds CellMapper as a new denoising method, see https://github.com/quadbio/cellmapper

Checklist before requesting a review

  • I have performed a self-review of my code

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI Tests succeed and look good!

Copy link

@LuckyMD LuckyMD 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 code-wise from my side, but it's unclear to me how this compares to knn-smoothing.

Would need a review from @wes-lewis and/or @rcannood or @scottgigante to confirm though, as I'm not as familiar with the structure in this task.

@wes-lewis
Copy link
Contributor

wes-lewis commented Jul 28, 2025

[To address what @LuckyMD mentioned] This is quite different from the already implemented knn_smoothing approach. knn_smoothing sounds as though it would be a very general approach, but the original code from Yanai Lab uses quite specific methodology. Considering this, it should be different enough to be included. I'll describe differences a bit, as they are more specific than what is covered in the viash description (may be useful to update the description to ensure differences are accurately reflected)

knn_smoothing specifics:

  • Normalizations: median normalization, Freeman Tukey transform)
  • Iteratively increasing neighborhood size: Progressively increasing k_step up to k = k
  • Iterative neighborhood updates: In each iteration, a new matrix smoothed matrix X is calculated where the expression vector for a given cell i is replaced by the sum of the raw (unsmoothed) expression values over all of its neighbors (neighbors calculated via normalizing and calling euclidian distance on either the smoothed matrix from the previous iteration, or the raw/unsmoothed expression values on the first iteration). This summation is not weighted (e.g. by the euclidian distances or a kernel), which differs from CellMapper.
  • Output: After summing unnormalized expression values over neighbors in the final step, there is no integrated normalization step (resulting output is relatively inflated, by on average k*X[:,i] )

These aspects all differ from the choices used in CellMapper, which continues to update expression values iteratively and weights neighborhood members according to a user-defined kernel. CellMapper smoothing is more analogous to diffusion methods and less to the knn_smooth approach.

I do not see any issue with the code, other than the few typos pointed our by me and @LuckyMD. I'm happy to merge as soon as these are fixed.

@Marius1311
Copy link
Author

Thanks for the review @LuckyMD @wes-lewis , I fixed the typos and extended the description in the config file, should be ready now.

@Marius1311
Copy link
Author

FYI I added myself as a contributor in the _viash.yaml

Copy link
Member

@rcannood rcannood left a comment

Choose a reason for hiding this comment

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

LGTM as far as I'm concerned! @wes-lewis @LuckyMD What about you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants