so I transformed it to h5ad with below commend:
SaveH5Seurat(seu_scratch_p56, filename = “seu_scratch_p56.h5Seurat”)
Convert(“seu_scratch_p56.h5Seurat”, dest = “h5ad”)
now I uploaded this h5ad file on Mapmycell
I got error : Mapping Failed
Use log files for troubleshooting MapMyCells issues. Post them in the community forums for further assistance.
Mapping algorithm failed because of application errors.
Please confirm that your input data is in cell (rows) by gene (columns) format.
Run ID: 1716906071516-d79e81b5-b84d-4e21-a70f-4b49c71bfcbb
It looks like the full text of your error message is
The ‘X’ field in this h5ad file lacks the ‘encoding-type’ metadata field. That field is necessary for this software to determine if this data is stored as a sparse or dense matrix. Please see the anndata specification here On-disk format — anndata 0.1.dev50+g77581cc documentation
This means that your H5AD file is missing some metadata that is a part of the AnnData specification. I suspect that, for whatever reason, the Convert function you are invoking is not writing that metadata out to the output h5ad file.
I’ve consulted with some R users on our team. They recommend you write out the H5AD file directly following the example here. Specifically, you will need to do something like
library(anndata) # Load library
# (First, extra count matrix from Seurat object and ensure it has row and column names.)
genes <- colnames(counts)
samples <- rownames(counts)
sparse_counts <- as(counts, "dgCMatrix") # Convert to sparse matrix, if not already
countAD <- AnnData(X = sparse_counts, # Create the anndata object
var = data.frame(genes=genes,row.names=genes),
obs = data.frame(samples=samples,row.names=samples))
write_h5ad(countAD, "counts.h5ad", compression='gzip') # Write it out as h5ad
python311.dll module error (python311.dll - The specified module could not be found.) happened
i am wondering as I am using R not Python… but why it caused this?
thanks a lot
anndata is a python library. Running it in R means using the R reticulate library to call python from R so that you have access to anndata’s functionality. The error message you quoted makes it sound (to me) like python did not get installed on your system.
How did you install anndata in your R environment?
Here is the documentation I usually consult on running anndata from R. It gives a few pointers about making sure everything is installed correctly. Is this what you followed (more or less)?
still same error… do you have any other way for me to change CSV file to H5ad file to upload to your mapmycell? I have gene in column/ cell in row in CSV form
Error in py_get_attr_impl(x, name, silent) :
AttributeError: ‘module’ object has no attribute ‘remap_output_streams’
In addition: Warning message:
In py_initialize(config$python, config$libpython, config$pythonhome, :
Python 2 reached EOL on January 1, 2020. Python 2 compatability be removed in an upcoming reticulate release.
Sorry. I did not realize you were comfortable using Python.
Can you regenerate your Jupyter notebook error, but grab a screenshot that includes the entire pink window? You clipped off the important part of the error message, unfortunately.
The cell-by-gene array which you store as result has strings in the first column. It should just be the numerical values. The NaN values in that matrix aren’t ideal, either. Is this log-normalized data?
I’m also concerned that you created your anndata.AnnData object here
without specifying the obs or var dataframes. obs is a dataframe that identifies each cell (row) in your cell-by-gene matrix. var is a dataframe that identifies each gene (column) in your cell-by-gene matrix. It may be illuminating to look at the second “in Python” examle on this page (I know I already pointed you to this page, but the first example starts from a more complicated data model than I think you are working with). Here is the part of that page that does the simplest creation of obs and var.
DimPlot(dataSeurat, reduction = “umap”, group.by=“subclass_name”, label=TRUE) + NoLegend()
I tried this and it showed the error :
Error in [.data.frame(data, , group) : undefined columns selected
In addition: Warning message:
The following requested variables were not found: subclass_name
This is just a guess, but there are 4-5 lines at the top of the file that you downloaded which are just metadata. These are marked with a # at the front, so you will probably need to tell Seurat to ignore lines that start with # (or open the CSV and delete those lines).
hi Deanel, it is not about # command uncommand things… I think
in my dataseurat I do not have subclass_name
so after mapping
I have mapping data from MAP MYCELL
and as your tutorial (MapMyCells Use Case: Single Nucleus RNA-seq from Human MTG - brain-map.org) suggested I go through
especially, → #7 To visualize the mapping results, we need both the mapping results and the original query cellxgene matrix for comparison. If this is not already read in, you can read it in from the anndata object uploaded to MapMyCells.
### Since the query data corresponds to dataQC above, we will call it dataQC again
dataQC_h5ad <- read_h5ad('Hodge2019.h5ad')
dataQC <- t(as.matrix(dataQC_h5ad$X))
rownames(dataQC) <- rownames(dataQC_h5ad$var)
colnames(dataQC) <- rownames(dataQC_h5ad$obs)
here as my R did not work with anndata anyway i just used my seuratObj (original one)
The X matrix is a convention in h5ad files. Specifically, in an h5ad file
X is the cell-by-gene expression matrix (just an array of floats or integers where each row is a cell and each column is a gene)
obs is a dataframe containing the metadata for each cell. Each row in this dataframe corresponds to a row in X.
var is a dataframe containing the metadata for each gene. Eachrow in this dataframe corresponds to a column in X.
I’m not sure we have any visualization tutorials written in python, for better or worse.
MapMyCells should have given you a CSV file in which each row is a cell in your dataset and each column is either a cell type assignment or a quality metric for a cell type assignment (see documentation here). I’d recommend comparing that CSV file to your original dataset using whatever data analysis tools you are most comfortable with.