Byung Chul Jung
Byung Chul Jung

Reputation: 1

making cache using cache=True does not work in Scanpy

`Hi, I my code does work if I use cache=False

WT = sc.read_10x_mtx('/Users/sandb/OneDrive/UCB/result/scRNAseq/1strun/WT', var_names='gene_symbols', cache=False)

but when I change chache=True

WT = sc.read_10x_mtx('/Users/sandb/OneDrive/UCB/result/scRNAseq/1strun/WT', var_names='gene_symbols', cache=True)

I have OS error. OSError Traceback (most recent call last)

OSError: Unable to create file (unable to open file: name = '-Users-sandb-OneDrive-UCB-result-scRNAseq-1strun-WT-matrix.h5ad', errno = 22, error message = 'Invalid argument', flags = 13, o_flags = 302

Is there anyway to fix it?

I could not fix for a week...

Thanks!

Upvotes: 0

Views: 116

Answers (1)

nobot
nobot

Reputation: 93

What I see is, it tries to create the file with the name: '-Users-sandb-OneDrive-UCB-result-scRNAseq-1strun-WT-matrix.h5ad' which starts with '-'. I don't know which os you are using and how the library creates files but, for instance, touch -my_file.txt wont work with bash. It will complain touch: invalid option because whatever comes after - is an option or argument.

All in all, this seems to be a bug you have hit. It appears Scanpy takes the path you give it, replaces all occurrences of '/' with '-' to make the file name for the cache file however it should skip the initial '/'. Which it does not.

I cannot reproduce your problem however you can try giving the prefix parameter to read_10x_mtx as

WT = sc.read_10x_mtx('/Users/sandb/OneDrive/UCB/result/scRNAseq/1strun/WT', var_names='gene_symbols', cache=True, prefix='SomePref')

So that your cache file name does not start with '-'.

Upvotes: 0

Related Questions