farrellja / URD

URD - Reconstruction of Branching Developmental Trajectories
GNU General Public License v3.0
115 stars 41 forks source link

n_pcs is needed to be specified in calcDM #76

Open mimi3421 opened 2 years ago

mimi3421 commented 2 years ago

A warning code shows when I run the codes in URD: Quick Start after calcDM and the following plotDimArray function returns an odd ploting result.

axial <- calcDM(axial, knn = 100, sigma=16)
plotDimArray(axial, reduction.use = "dm", dims.to.plot = 1:8, outer.title = "Diffusion Map (Sigma 16, 100 NNs): Stage", label="stage", plot.title="", legend=F)

[1] "Using provided global sigma 16" Warning message: In DiffusionMap(data.use, sigma = sigma.use, k = knn, n_eigs = dcs.store, : You have 15659 genes. Consider passing e.g. n_pcs = 50 to speed up computation.

Rplot01

It seems that the calcDM is passing a normalized data matrix to DiffusionMap which is not properly scaled. When I add n_pcs=50 in the parameter of DiffusionMap the results turns to be simillar to the Quick Start guide.

diffusion-map.R - https://github.com/farrellja/URD/blob/master/R/diffusion-map.R

# Calculate the diffusion map
#dm <- DiffusionMap(data.use, sigma=sigma.use, k=knn, n_eigs = dcs.store, density_norm = density.norm, distance=distance[1]) # the original line 110
dm <- DiffusionMap(data.use, sigma=sigma.use, k=knn, n_eigs = dcs.store, density_norm = density.norm, distance=distance[1], n_pcs=50)  # the change I made

Rplot