MarcElosua/SPOTlight

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

WuyangFF95 opened this issue · 1 comments

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!

Duplicated here - #91 (comment)