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

ReadH5AD function replaces categories with numbers in meta.data #2911

Closed
elimereu opened this issue Apr 26, 2020 · 2 comments
Closed

ReadH5AD function replaces categories with numbers in meta.data #2911

elimereu opened this issue Apr 26, 2020 · 2 comments

Comments

@elimereu
Copy link

Hi,
I have a problem when I use the function ReadH5AD. It seems that categories are replaced by numbers. In my case for example in the meta.data there is the column cell_type in which cell type labels were replaced by numbers. Is there any way to solve this? The data are at the following link: https://cellgeni.cog.sanger.ac.uk/gutcellatlas/Colon_cell_atlas.h5ad .

Thank you in advance for you help!

Elisabetta

@mojaveazure
Copy link
Member

Hi,

We are transitioning our support for AnnData/H5AD files to SeuratDisk, our new package for interfacing Seurat objects with single-cell HDF5-based file formats. We would very much like it if you could give this a shot for reading in your data.

You can install SeuratDisk with the following:

if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}
remotes::install_github("mojaveazure/seurat-disk")

A tutorial on how to read in AnnData/H5AD files via the h5Seurat intermediate can be found here. Greater detail about the new Convert mechanism can be found here

If you come across any bugs in reading in your HDF5 files, please post them in mojaveazure/seurat-disk#1. Please note, there are some stipulations about the format of your AnnData/H5AD posted in mojaveazure/seurat-disk#1 (comment)

@colinmcgovern
Copy link

The categories are turned into numbers after conversion, because they are a vector of factors instead of a vector of characters. If you're new to R, this may confuse you at first. My solution is to convert all of the factor vectors in the meta data over to character vectors, assuming pmbc is a Seurat object:

i <- sapply([email protected], is.factor)
[email protected][i] <- lapply([email protected][i], as.character)

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

No branches or pull requests

3 participants