使用 scanpy.read 时出现 FileNotFoundError

FileNotFoundError when using scanpy.read

我在 Jupyter notebook 上关注 theislab 的单细胞测序分析教程,link 下面

https://github.com/theislab/single-cell-tutorial/blob/master/latest_notebook/Case-study_Mouse-intestinal-epithelium_1906.ipynb

#Data files
sample_strings = ['Duo_M1', 'Duo_M2', 'Jej_M1', 'Jej_M2', 'Il_M1', 'Il_M2']
sample_id_strings = ['3', '4', '5', '6', '7', '8']
file_base = '..data/Haber-et-al_mouse-intestinal-epithelium/GSE92332_RAW'
exp_string = '_Regional_'
data_file_end = '_matrix.mtx'
barcode_file_end = '_barcodes.tsv'
gene_file_end = '_genes.tsv'
cc_genes_file = '../Macosko_cell_cycle_genes.txt'

# First data set load & annotation
#Parse Filenames
sample = sample_strings.pop(0)
sample_id = sample_id_strings.pop(0)
data_file = file_base+sample_id+exp_string+sample+data_file_end
barcode_file = file_base+sample_id+exp_string+sample+barcode_file_end
gene_file = file_base+sample_id+exp_string+sample+gene_file_end

#Load data
adata = sc.read(data_file, cache=True)

我可以在我的计算机上本地查看该文件,但我一直收到以下错误


FileNotFoundError                         Traceback (most recent call last)
<ipython-input-92-d3e19569f3db> in <module>()
----> 1 adata = sc.read(data_file, cache=True)

~/anaconda3/lib/python3.6/site-packages/scanpy/readwrite.py in read(filename, backed, sheet, ext, delimiter, first_column_names, backup_url, cache, cache_compression, **kwargs)
    120             cache=cache,
    121             cache_compression=cache_compression,
--> 122             **kwargs,
    123         )
    124     # generate filename and read to dict

~/anaconda3/lib/python3.6/site-packages/scanpy/readwrite.py in _read(filename, backed, sheet, ext, delimiter, first_column_names, backup_url, cache, cache_compression, suppress_cache_warning, **kwargs)
    713 
    714     if not is_present:
--> 715         raise FileNotFoundError(f'Did not find file {filename}.')
    716     logg.debug(f'reading {filename}')
    717     if not cache and not suppress_cache_warning:

FileNotFoundError: Did not find file ..data/Haber-et-al_mouse-intestinal-epithelium/GSE92332_RAW/GSM2836573_Regional_Duo_M1_matrix.mtx.

知道我做错了什么吗? 谢谢!

我想你忘记了 file_base 中的斜线:

file_base = '../data/Haber-et-al_mouse-intestinal-epithelium/GSE92332_RAW'

而不是

file_base = '..data/Haber-et-al_mouse-intestinal-epithelium/GSE92332_RAW/GSM283657'