Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no applicable method for 'JoinLayers' applied to an object of class "c('Assay', 'KeyMixin') #296

Open
DLY-2021 opened this issue Jul 19, 2024 · 4 comments
Labels
question Further information is requested

Comments

@DLY-2021
Copy link

In Seurat V5 using hdWGCNA, I encountered the following issue: 'Error in UseMethod(generic = "JoinLayers", object = object) : no applicable method for 'JoinLayers' applied to an object of class "c('Assay', 'KeyMixin')"'. The code is: 'seurat_obj <- MetacellsByGroups(
seurat_obj = seurat_obj,
reduction = "harmony",
assay = 'SCT',
slot = 'counts')'

@DLY-2021 DLY-2021 added the question Further information is requested label Jul 19, 2024
@smorabit
Copy link
Owner

Hi,

Not sure what this "KeyMIxin" assay is, I haven't seen this before. It looks like this is an error thrown by Seurat rather than hdWGCNA itself, unfortunately we run into a lot of errors related to Seurat v5 since they decided to change the SeuratObject.

I am wondering if the code works when you use assay='RNA' instead of 'SCT'. If you have a reproducible example of this error it would be easier for me to look into it.

@professor-sagittarius
Copy link

professor-sagittarius commented Aug 5, 2024

Hi Sam,

I encountered the same error. Here's a reproducible example using the Seurat object in this .qs file

Notably, the error occurs with non-SCT data. I have successfully performed hdWGCNA on other similar datasets, but the error has only occurred with this one. The object in the .qs has been downsampled, but the error still occurs with the full dataset.

obj <- qs::qread("joinLayersError")

obj <- SetupForWGCNA(
    obj,
    gene_select = "fraction", # the gene selection approach
    group.by = "cell_type",
    fraction = 0.05 # fraction of cells that a gene needs to be expressed in order to be included
)

obj <- MetacellsByGroups(
    obj,
    group.by = c("cell_type"), # specify the columns in [email protected] to group by
    reduction = 'harmony', # select the dimensionality reduction to perform KNN on
    k = 25, # nearest-neighbors parameter
    max_shared = 10, # maximum number of shared cells between two metacells
    min_cells = 100, 
    ident.group = 'cell_type', # set the Idents of the metacell seurat object
    verbose=T
)

Error in UseMethod(generic = "JoinLayers", object = object) : 
  no applicable method for 'JoinLayers' applied to an object of class "c('Assay', 'KeyMixin')"

@connorclouddevine
Copy link

Hi all,

I found a workaround for this problem:

satijalab/seurat#7672 (comment)

I was loading RDS output from a pipeline and I suspect they may be v3 objects which are mysteriously incompatible with JoinLayers; I received the same error when running JoinLayers on a Seurat object. This block of code fixed the above error.

assay5 <- as(pbmc[["RNA"]], Class = "Assay5")
seurat5 <- CreateSeuratObject(assay5, meta.data = [email protected])

seurat5 <- JoinLayers(seurat5)

@Skye-lulu
Copy link

Hi all,
I solve this on my computer by downgrade the igraph version to 2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants