This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Could not view/find meta.data and Error merging three seurat object

Dear Fellow,

I created three seurat object and attempted to merge them using the following codes

NML_I<- CreateAssayObject(counts= NML_I, project= "NML_I", min.cells = 3, min.features = 200)
NML_II<- CreateAssayObject(counts= NML_II, project= "NML_II", min.cells = 3, min.features = 200)
NML_III<- CreateAssayObject(counts= NML_III, project= "NML_III", min.cells = 3, min.features = 200)

1. Once I tried to view the metadata using the following command

View(NML_I@meta.data)

I got error saying

Error in is.data.frame(x) : 
  no slot of name "meta.data" for this object of class "Assay"

It worked in someone's video tutorial on youtube, but not work in my practice.

2. Once I attempted to merge the three objects, I got the following errors

MergedNML <- merge(NML_I, y = c(NML_II, NML_III),
                   add.cell.ids = ls()[1:3],
                   project = 'MergedNML')

Warning: The following arguments are not used: project
Error in fixupDN.if.valid(value, x@Dim) : 
  length of Dimnames[[2]] (1) is not equal to Dim[2] (3669)

I tried another code

MergedNML <- merge(NML_I, y = list(NML_II, NML_III),
                   add.cell.ids = ("1", "2", "3"),
                   project = 'MergedNML')

I still get error

Warning: The following arguments are not used: project
Error in fixupDN.if.valid(value, x@Dim) : 
  length of Dimnames[[2]] (1) is not equal to Dim[2] (3669)

Understand I should ask in seurat forum, but I believe some experts here may have some thought of why I got error. appreciate all your help.

Regards,
Synat

seurat single-cell

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.
code_formatting

You used the quote option (the button with the double quotes symbol on it). That option is for quoting a source verbatim, not formatting code as used with/in a program.

1 answer

Please use CreateSeuratObject instead of CreateAssayObject

NML_I<- CreateSeuratObject(counts= NML_I, project= "NML_I", min.cells = 3, min.features = 200)
...and the same for the rest

Log in to answer this question.