welch-lab / liger

R package for integrating and analyzing multiple single-cell datasets
GNU General Public License v3.0
392 stars 78 forks source link

Query on building shared factor neighborhood graph #311

Open yuzhong1997 opened 6 months ago

yuzhong1997 commented 6 months ago

Hi,

Thanks for your excellent software! I just have questions on your workflow after I checked all your codes on Github:

  1. Based on your workflow (https://welch-lab.github.io/liger/reference/quantileNorm.html), you said "This process builds a shared factor neighborhood graph to jointly cluster cells, then quantile normalizes corresponding clusters." by running quantileNorm command. But actually, it seems like .quantileNorm.HList function (line 1444 in integration.R file) only cluster cells across datasets independently as clusters <- **lapply**(Hs, function(H) clusterAssign[rownames(H)]). And those cell factor loadings normalized given a reference afterwards.

  2. It seems like shared factor neighborhood graph really occurs when running runCluster as snn <- ComputeSNN(knn$nn.idx, prune = prune), which is based on previous normalized cell factor loadings.

I'm not sure if I understand here correctly or not. Appreciate it if any helps here.

Yu

mvfki commented 6 months ago

Hi Yu,

I think you're right with point 2.

For point 1, briefly, what happens in quantileNorm() is that we label cells by the max factor loading (e.g. cluster 1 if factor 1 loads the most for a cell), and then align the factor loadings of cells assigned to the same "cluster". There is a step of NN searching where the graph is used to refine the previously described cluster voting before aligning cells with quantile normalization. So here the graph is indeed used for clustering cells, but this clustering is not the primary purpose of the whole thing, i.e. it is not what users usually look for when they want clustering labels for downstream analysis. Hope this explains, and I'll try to update the documentation in future versions so it causes less confusion.

Thanks, Yichen

yuzhong1997 commented 6 months ago

Hi,

Thanks for your quick response! Yeah, I'm totaly clear about quantileNorm, but just confused when the first glance on documentation. Thanks again.

Yu