MarioniLab / scran

Clone of the Bioconductor repository for the scran package.
https://bioconductor.org/packages/devel/bioc/html/scran.html
40 stars 22 forks source link

fastMNN correction vector calculation #43

Closed whitleyo closed 5 years ago

whitleyo commented 5 years ago

Hi,

Haven't quite delved into the source code yet, but in the documentation for the fastMNN function, it says for argument ndist:

A numeric scalar specifying the threshold beyond which neighbours are to be ignored when computing correction vectors. Each threshold is defined in terms of the number of median distances.

I'm wondering how cells with all neighbors exceeding this threshold have their correction vectors calculated, since those neighbors are to be ignored, if I understand correctly.

In the original paper (doi: 10.1038/nbt.4091) for MNN correction, it was stated that correction vectors for all cells would be a weighted average of the MNN vectors.

Thanks for any help you're able to give.

LTLA commented 5 years ago

A cell can't have all neighbors exceeding the threshold, because the threshold for each cell is defined in terms of the number of median distances from its neighbors. So - at least for any ndist > 1 - a cell must have at least one neighbor. (Specifically, at least one neighbor involved in a MNN pair; we don't consider uninvolved neighbors during the search at this step.)

LTLA commented 5 years ago

Also, I should point out that fastMNN now lives in https://github.com/LTLA/batchelor.

LTLA commented 5 years ago

This seems resolved, so closing. Feel free to reopen if something is unclear.