error in (function (classes, fdef, mtable) unable to find an inherited method for function logNormCounts for signature Seurat
2
0
Entering edit mode
mathai.c • 0
@mathaic-22456
Last seen 5.1 years ago
library(SingleR)
hpca.se <- HumanPrimaryCellAtlasData()
hpca.se
library(scRNAseq)
hESCs <- LaMannoBrainData('human-es')
hESCs <- hESCs[,1:100]

# Restrict to common genes between test and reference data:
library(scater)
common <- intersect(rownames( hESCs ), rownames( hpca.se ))
hpca.se <- hpca.se[common,]
hESCs <- hESCs[common,]
hESCs <- logNormCounts(hESCs)

Error in (function (classes, fdef, mtable)  :    unable to find an inherited method for function ‘logNormCounts’ for signature ‘"Seurat"’

Can someone help me why im getting this error?

seurat singleR • 4.3k views
ADD COMMENT
0
Entering edit mode

I added formatting to your post so that it is readable. Also note that you are asking a question rather than providing a tutorial.

ADD REPLY
0
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 6 hours ago
The city by the bay

Usually it's good form to format your post correctly with, y'know, new lines and stuff.

Moreover, Seurat is not a Bioconductor package, and none of the packages you show use Seurat. I am confident in saying that none of the code as shown above will generate a Seurat object at any point.

I will conclude by identifying the code as originating from the SingleR vignette, though you haven't copy-and-pasted it correctly or completely, e.g., rownameshpca.se).

ADD COMMENT
0
Entering edit mode

in the case of row nameshpcs.se) I did put the brackets, somehow its not displayed in this

ADD REPLY
0
Entering edit mode
Marco • 0
@5ff5ef6c
Last seen 18 months ago
Italy

If you are using the "scuttle" package in R, the error message suggests that there is no inherited method for the function logNormCounts for the "Seurat" object.

In the "scuttle" package, the logNormCounts function is not directly applied to a "Seurat" object. Instead, it is used with a "SingleCellExperiment" object.

To resolve the error, you need to convert your "Seurat" object to a "SingleCellExperiment" object. You can do this by using the as.SingleCellExperiment function from the "scuttle" package. Here's an example of how to perform the conversion and apply the logNormCounts function:

library(scuttle)
# Assuming you already have a Seurat object called 'seurat'
# Convert Seurat object to SingleCellExperiment object
sce <- as.SingleCellExperiment(seurat)

# Apply log-normalization using logNormCounts function
sce <- logNormCounts(sce)

# If you want to convert the normalized data back to Seurat object
seurat_normalized <- CreateSeuratObject(counts = assays(sce)$logNormCounts)
ADD COMMENT

Login before adding your answer.

Traffic: 523 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6