dynverse / anndata

Annotated multivariate observation data in R
https://anndata.dynverse.org
Other
43 stars 4 forks source link

Cannot retrieve matrix and metadata after reading a h5ad data with read_h5ad #30

Open joonlee3 opened 3 months ago

joonlee3 commented 3 months ago

Hi,

I was trying to convert a h5ad file (anndata) to a Seurat object. It seems that read_h5ad read my h5ad file in R.

> COPD.anndata <- read_h5ad("COPD.h5ad") > COPD.anndata

AnnData object with n_obs × n_vars = 918486 × 5101
    obs: 'cell_id', 'transcript_counts', 'control_probe_counts', 'genomic_control_counts', 'control_codeword_counts', 'unassigned_codeword_counts', 'deprecated_codeword_counts', 'total_counts', 'cell_area', 'nucleus_area', 'nucleus_count', 'z_level', 'cell_labels', 'nucleus_ratio', 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'log1p_total_counts', 'pct_counts_in_top_10_genes', 'pct_counts_in_top_25_genes', 'pct_counts_in_top_50_genes', 'pct_counts_in_top_100_genes'
    var: 'gene_ids', 'feature_types', 'genome'
    uns: 'spatialdata_attrs'
    obsm: 'spatial'

However, when I retrieved matrix data and metadata in the object, I've got the following errors

> COPD.anndata$X

Error in as.integer(as_r_value(x$indices)) : `
  cannot coerce type 'environment' to vector of type 'integer'

> COPD.anndata$obs

Error in py_convert_pandas_df(x) : `
  INTEGER() can only be applied to a 'integer', not a 'environment'

Please let me know if there is any solution. Thank you.

Best, Joon

rcannood commented 1 week ago

Hi @joonlee3 !

Could you send me the COPD.h5ad or create a minimal reproducible example?

Thanks!

Robrecht