chris-mcginnis-ucsf / DoubletFinder

R package for detecting doublets in single-cell RNA sequencing data
413 stars 109 forks source link

paramSweep error: $ operator not defined for this S4 class #181

Open yasamanrezvani opened 11 months ago

yasamanrezvani commented 11 months ago

Hi,

Running the following command promt an error.

sweep.res.list <- paramSweep(S.O.tmp, PCs = 1:20, sct = FALSE)

Error: $ operator not defined for this S4 class

I have installed the package through the following command: install_github("chris-mcginnis-ucsf/DoubletFinder")

Do you know what causes the error?

Thanks,

jiajiachen123 commented 10 months ago

Did you solve this issue?

yasamanrezvani commented 10 months ago

No, I am waiting for the authors' response. Do you have the same issue?

jiajiachen123 commented 10 months ago

No, I am waiting for the authors' response. Do you have the same issue? Yes, I have the same issue. Following is my package version. package.version("Doubletfinder") [1] "2.0.4" package.version("Seurat") [1] "4.4.0"

yasamanrezvani commented 10 months ago

You can update the function paramSweep() by changing

seu@assays$RNA$counts

to

seu@assays$RNA@counts

in the source code and use the function. However, I believe this is a temporal fix and the authors should push the updated code.

lzmcboy commented 10 months ago

I also had this problem. I forked the repository and fixed it. just like @yasamanrezvani said, only need change "$counts" to "@counts". Before Author fixed it, you can install DoubletFinder from my fork. use this code: remotes::install_github('lzmcboy/DoubletFinder_204_fix')

lzmcboy commented 10 months ago

You can update the function paramSweep() by changing

seu@assays$RNA$counts

to

seu@assays$RNA@counts

in the source code and use the function. However, I believe this is a temporal fix and the authors should push the updated code.

I found two files have this error, paramSweep and doubletFinder. I fixed them all.

sheridar commented 10 months ago

The issue is that DoubletFinder was updated to be compatible with Seurat v5, which modified how counts are stored in the object. So seu@assays$RNA@counts no longer works with v5.

A better way for the DoubletFinder functions to fetch counts from the object is to use the accessor function Seurat::GetAssayData(). Seurat::GetAssayData(seu, "counts") should work with Seurat v3, v4, v5 since this function is updated with each new release of Seurat.

HuangJipen commented 9 months ago

Hi, I I have installed the package through the following command and the problem has been resolved. remotes::install_github('lzmcboy/DoubletFinder_204_fix')

But there were a new error: sweep.res.list_kidney <- paramSweep(Sug_virgin, PCs = 1:30, sct = F) [1] "Creating artificial doublets for pN = 5%" [1] "Creating Seurat object..." [1] "Normalizing Seurat object..." Error in NormalizeData.default(object = GetAssayData(object = object, : trying to get slot "params" from an object of a basic class ("NULL") with no slots

Do you know what causes the error? Thanks

Evenlyeven commented 9 months ago

Had the same issues with Seurat 4.3. It works when I switch to V5. Not a good solution, but at least it works.

jmartin77777 commented 8 months ago

I also had this problem. I forked the repository and fixed it. just like @yasamanrezvani said, only need change "$counts" to "@CountS". Before Author fixed it, you can install DoubletFinder from my fork. use this code: remotes::install_github('lzmcboy/DoubletFinder_204_fix')

This is very helpful! Thank you for making that fix!

zhongguozhiwang commented 8 months ago

I also had this problem. I forked the repository and fixed it. just like @yasamanrezvani said, only need change "$counts" to "@CountS". Before Author fixed it, you can install DoubletFinder from my fork. use this code: remotes::install_github('lzmcboy/DoubletFinder_204_fix')

After running remotes::install_github('lzmcboy/DoubletFinder_204_fix'), I still get an error: Error in seu@assays$RNA$counts : $ operator not defined for this S4 class.

z-bluesky commented 8 months ago

Had the same issues with Seurat 4.3. It works when I switch to V5. Not a good solution, but at least it works. I also updated Seurat to version 5.0 and reinstalled the DoubletFinder R package, and it was able to continue running. remotes::install_github("chris-mcginnis-ucsf/DoubletFinder")

zmx13531902995 commented 7 months ago

When I update to V5, I meet some new problem and I prefer to use V4.

lzmcboy commented 6 months ago

Hi, I I have installed the package through the following command and the problem has been resolved. remotes::install_github('lzmcboy/DoubletFinder_204_fix')

But there were a new error: sweep.res.list_kidney <- paramSweep(Sug_virgin, PCs = 1:30, sct = F) [1] "Creating artificial doublets for pN = 5%" [1] "Creating Seurat object..." [1] "Normalizing Seurat object..." Error in NormalizeData.default(object = GetAssayData(object = object, : trying to get slot "params" from an object of a basic class ("NULL") with no slots

Do you know what causes the error? Thanks

My guess is that because I only modified the SCT method, this problem may occur if Log normalization is used. I'll check the code later and see how to modify it.

VivianQM commented 4 months ago

Hi, I I have installed the package through the following command and the problem has been resolved. remotes::install_github('lzmcboy/DoubletFinder_204_fix') But there were a new error: sweep.res.list_kidney <- paramSweep(Sug_virgin, PCs = 1:30, sct = F) [1] "Creating artificial doublets for pN = 5%" [1] "Creating Seurat object..." [1] "Normalizing Seurat object..." Error in NormalizeData.default(object = GetAssayData(object = object, : trying to get slot "params" from an object of a basic class ("NULL") with no slots Do you know what causes the error? Thanks

My guess is that because I only modified the SCT method, this problem may occur if Log normalization is used. I'll check the code later and see how to modify it.

Hi! I also have this bug remained but I am using SCT method...

abdkxk commented 2 months ago

Hi, I I have installed the package through the following command and the problem has been resolved. remotes::install_github('lzmcboy/DoubletFinder_204_fix') But there were a new error: sweep.res.list_kidney <- paramSweep(Sug_virgin, PCs = 1:30, sct = F) [1] "Creating artificial doublets for pN = 5%" [1] "Creating Seurat object..." [1] "Normalizing Seurat object..." Error in NormalizeData.default(object = GetAssayData(object = object, : trying to get slot "params" from an object of a basic class ("NULL") with no slots Do you know what causes the error? Thanks

My guess is that because I only modified the SCT method, this problem may occur if Log normalization is used. I'll check the code later and see how to modify it.

Hi! I also have this bug remained but I am using SCT method...

Me too......

abdkxk commented 2 months ago

Hi, I I have installed the package through the following command and the problem has been resolved. remotes::install_github('lzmcboy/DoubletFinder_204_fix') But there were a new error: sweep.res.list_kidney <- paramSweep(Sug_virgin, PCs = 1:30, sct = F) [1] "Creating artificial doublets for pN = 5%" [1] "Creating Seurat object..." [1] "Normalizing Seurat object..." Error in NormalizeData.default(object = GetAssayData(object = object, : trying to get slot "params" from an object of a basic class ("NULL") with no slots Do you know what causes the error? Thanks

My guess is that because I only modified the SCT method, this problem may occur if Log normalization is used. I'll check the code later and see how to modify it.

Hi! I also have this bug remained but I am using SCT method...

Me too......

I have solved this problem. I think it's because the parameter ‘sct’ was not set correctly to T. :)

MaxMeieran commented 1 month ago

I fixed the package ,add the sct remotes::install_github('MaxMeieran/DoubletFinder')