meiosis97 / Sincast

This is the very first Sincast version!
8 stars 2 forks source link

Error running sincastImp #1

Open mksakuma opened 4 months ago

mksakuma commented 4 months ago

I am trying to project a reference single-cell sequencing datasets onto a sorted cells microarray reference datasets. I subsetted the genes of the sc experiments to those available in the microarray datasets (~7000 genes). The bulk reference is built nicely, but I get an error at the imputation step, as follows.

query <- sincastImp(query, col.by = 'cluster') Now perform PCA Finish PCA Now construct affinity matrix Calcualting distance Scaling distance Calculating band width Laplacian normalization Finish construct affinity matrix Now impute Diffusing Scaling Finish impute Sparsity after imputation is 0.01 Error in cluster::pam(x[, 3:4], k = 1) : Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2

The projection nonetheless works but the cells from the sc datasets have much smaller coordinates and mostly do not overlap with the bulk cells.

The datasets in use are: For bulk reference cells: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE24759 For single cell reference: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE245108 with annotation https://github.com/nsalomonis/Human-Bone-Marrow-Titration-Atlas/blob/main/scTriangulate/WNN/GSE245108_Level3M-titrated-cell-annotation.txt.gz

meiosis97 commented 4 months ago

Hi, thank you for using Sincast.

Most likely the error is due to one of your cluster contains only one cell. This can be fixed simply by setting

query <- sincastImp(query, col.by = 'cluster', vis.dc = FALSE)

The projection still works because the project function looks for the raw data to project if the imputed data is not present. This explains why your query cells are on much smaller coordinates.

Try either

query <- sincastImp(query, col.by = 'cluster', vis.dc = FALSE)
query <- postScale(query)
query <- project(reference, query)

or

query <- sincastImp(query, col.by = 'cluster', vis.dc = FALSE)
query <- project(reference, query, assay = 'SincastImpData')
mksakuma commented 4 months ago

Thank you very much for the suggestions, the error disappeared! (The coordinates are still a bit smaller, but insightful enough)