Nanostring-Biostats / SpatialDecon

The SpatialDecon library implements the SpatialDecon algorithm for mixed cell deconvolution in spatial gene expression datasets. (This algorithm also works in bulk expression profiling data.)
MIT License
33 stars 8 forks source link

Unsuccessful convergence #33

Closed aelhossiny closed 2 years ago

aelhossiny commented 2 years ago

Hi, so I am using matched samples that I am using to construct a custom cell profile matrix and integrate it with my GeoMx spatial data. I am using the raw counts of the single cell data with setting normalize = TRUE in the create_profile_matrix() function, and using Q3-normalized counts for the GeoMx data. runspatialdecon() runs and gives me results, but it gives me the following warning

Warning message:
In lognlm.fit3(X = X, y = Y, par = par0, lik = lik, opt = opt, offset = offset,  :
  Unsuccessful convergence

Yet, the results are reproducible everytime I run it! Also, I set maxit = 100000, but I still getting the same warning!

Any thoughts or help about that? Thank you!

maddygriz commented 2 years ago

Hi @aelhossiny,

First. Are you running SpatialDecon using a GeomxSet object? If not, you should use the spatialdecon() function instead. That might be the issue, just pulling data from the incorrect spot. I think an error would have happened saying the incorrect format was used but just incase.

Second. How closely related are your profiles? If you have 2 identical profiles, the algorithm can not differentiate between the 2 which would cause that convergence error.

cors <- cor(profileMatrix) summary(cors[lower.tri(cors)])

Maddy

aelhossiny commented 2 years ago

hi @maddygriz Yes, I am using my GeoMxSet object. I get the same warning when I run spatialdecon() on the normalized count matrix extracted using assayDataElement() function

I guess your second point is the reason for this, so this the summary for the correlation matrix

    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
0.007072 0.111733 0.491090 0.474100 0.781453 0.993867 

Also see the heatmap below (numbers indicate different clusters)

correlation_of_sc_profiles

I re-ran the clustering while decreasing the resolution of the louvain clustering algorithm so I'd have less clusters and it works better now!

Thank you so much! That was so helpful!