Teichlab / cellphonedb

MIT License
340 stars 105 forks source link

Need help retrieving meta file from Seurat object #199

Closed xihuiyin closed 3 years ago

xihuiyin commented 4 years ago

Hi, I am trying to retrieve the metadata file using the code from the website, but it isn't working: meta_data <- cbind(rownames(data_object@meta.data), data_object@meta.data[,’cluster’, drop=F]) ##### cluster is the user’s specific cluster column write.table(meta_data, ‘cellphonedb_meta.txt’, sep=’\t’, quote=F, row.names=F)

I get the error Error in [.data.frame(dataneg@meta.data, , "Mac", drop = F) : undefined columns selected. Does anyone have a working version of the code? Thanks!

gloriafight commented 3 years ago

If your file is made by seurat_v3, you can try it: meta_data <- cbind(rownames(seuratObj@meta.data), seuratObj@meta.data[,"seurat_clusters"]) Because the colnames is different.