This is a test version of Biostars. For the public version, visit https://www.biostars.org.
problem with importing mtx file in scanpy

Hi All,

I try to import an mtx file (with features and barcode) as scanpy objects: adata= sc.read_10x_mtx(data_dir, var_names='gene_symbols', cache=True)

however, an error occurs:

(path)/envs/sc/lib/python3.11/site-packages/anndata/_core/anndata.py:1908: UserWarning: Variable names are not unique. To make them unique, call `.var_names_make_unique`.
  utils.warn_names_duplicates("var")

I used to use exactly the same script and it work before, until I run on a new (conda) envs and new version of scanpy. I try scanpy 1.9.6, 1.9.5, 1.9.4 already but it still run into the same problems.

Anyone have the same issue before?

scanpy scrnaseq

1 answer

It tells you that you have duplicates in gene names, which is normal because gene names are a mess and there indeed are overlaps. My recommendation is to use either Ensembl gene ID (ENSG...) or geneID_geneName, like ENSG000(...)_Gapdh since this guarantees uniqueness.

hey ATpoint,

Thank for your response, but I think it is actually the problem with anndata as I use exactly same mtx file and script, just re-run on a new conda environments.

I actually downgrade to anndata 0.8.0 and now it works. So I think it is the problem with lastest version!

Log in to answer this question.