Sarah Patterson
Sarah Patterson

Reputation: 1

Can't get sc.read_10x_mtx to read my data

I have a (hopefully) quick question for you this morning. Whenever I use the sc.read_10x_mtx (and below is my text block) I get the following error.

adata = sc.read_10x_mtx(
    'filtered_feature_bc_matrix_folder/',
    var_names='gene_symbols',
    cache=True)

TypeError                                 Traceback (most recent call last)
Cell In[11], line 1
----> 1 adata = sc.read_10x_mtx(
      2     'filtered_feature_bc_matrix_folder/',
      3     var_names='gene_symbols',
      4     cache=True)

File ~/anaconda3/lib/python3.10/site-packages/scanpy/readwrite.py:491, in read_10x_mtx(path, var_names, make_unique, cache, cache_compression, gex_only, prefix)
    489 prefix = "" if prefix is None else prefix
    490 is_legacy = (path / f"{prefix}genes.tsv").is_file()
--> 491 adata = _read_10x_mtx(
    492     path,
    493     var_names=var_names,
    494     make_unique=make_unique,
    495     cache=cache,
    496     cache_compression=cache_compression,
    497     prefix=prefix,
    498     is_legacy=is_legacy,
    499 )
    500 if is_legacy or not gex_only:
    501     return adata

File ~/anaconda3/lib/python3.10/site-packages/scanpy/readwrite.py:533, in _read_10x_mtx(path, var_names, make_unique, cache, cache_compression, prefix, is_legacy)
    531 var_names_idx = pd.Index(genes[1].values)
    532 if make_unique:
--> 533     var_names_idx = anndata.utils.make_index_unique(var_names_idx)
    534 adata.var_names = var_names_idx
    535 adata.var["gene_ids"] = genes[0].values

File ~/anaconda3/lib/python3.10/site-packages/anndata/utils.py:250, in make_index_unique(index, join)
    248 while True:
    249     counter[v] += 1
--> 250     tentative_new_name = v + join + str(counter[v])
    251     if tentative_new_name not in values_set:
    252         values_set.add(tentative_new_name)

TypeError: unsupported operand type(s) for +: 'float' and 'str'

Just hopeful for any advice! Thank you very much. 

Using sc.read_10x_mtx and having my data properly import from 10x matrix software

Upvotes: 0

Views: 387

Answers (0)

Related Questions