MarcElosua / SPOTlight

Spatial Transcriptomics Capture Location Deconvolution
https://marcelosua.github.io/SPOTlight
GNU General Public License v3.0
164 stars 25 forks source link

Error from `.extract_counts()` when calling `SeuratObject::GetAssayData()` v5.0.1 #110

Closed WuyangFF95 closed 10 months ago

WuyangFF95 commented 11 months ago

Dear @MarcElosua.

In the line 10 of SPOTlight:::.extract_counts(), you called function

x <- as.matrix(SeuratObject::GetAssayData(x, slot, assay))

However the v5.0.1 version of SeuratObject::GetAssayData() has deprecated the selection of specific slot. Instead, they had the syntax below, layer replaces slot:

## S3 method for class 'Seurat'
GetAssayData(object, assay = NULL, layer = NULL, slot = deprecated(), ...)

This will break the function call of SPOTlight::SPOTlight() with the following error.

Error in SeuratObject::GetAssayData(x, slot, assay) : 
  `assay` must be one of "RNA" or "SCT", not "scale.data".

In addition, SeuratObject uses LayerData() to supercede GetAssayData(). Thus the best replacement would be:

  1. Check version of SeuratObject.
  2. If >5.0.1, call x <- as.matrix(SeuratObject::LayerData(x, layer = slot, assay = assay)); otherwise, call x <- as.matrix(SeuratObject::GetAssayData(x, slot = slot, assay = assay))

Can you help me to fix this issue? Thanks!

MarcElosua commented 10 months ago

Duplicated here - https://github.com/MarcElosua/SPOTlight/issues/91#issuecomment-1883312449