bipvan
bipvan

Reputation: 97

Getting error " no method or default for coercing “patchwork” to “dgCMatrix” in scRNA analysis, using seurat, normalization step

I have a scRNA dataset with 10 healthy controls and 17 patients. I am doing the comparative analysis. I did the following:

  1. Created 10 seurat objects for 10 healthy controls and merged them to create one (healthy)
  2. Created 17 seurat objects for 17 patients and merged them to create one (patients)
  3. Created a list of the two objects: data <- list (healthy, patients)
  4. Normalize the data:
      data <- lapply(data, function(x) {
           x <- NormalizeData(x)
           x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
          })
    
I am getting the following error:

Error in as(object = data, Class = "dgCMatrix") : no method or default for coercing “patchwork” to “dgCMatrix” 


Please help

Upvotes: 1

Views: 164

Answers (1)

Luca Mannino
Luca Mannino

Reputation: 56

After some trial and error I was able to reproduce your same error running this line of code before your lapply function:

data <- list(p1 + p2 , p2)

Where p1 and p2 are ggplot objects.

It looks to me that in your data list you don't have Seurat objects. You should check for any mistakes in the code that you have used to generate your list of seurat objects.

I hope this helps :)

Upvotes: 0

Related Questions