Python 使用scanpy.read时FileNotFoundError

Python 使用scanpy.read时FileNotFoundError,python,file-not-found,scanpy,Python,File Not Found,Scanpy,我正在关注Jupyter笔记本上Theisplab的单细胞测序分析教程,链接如下 我可以在我的计算机上本地看到该文件,但我一直在下面看到错误 FileNotFoundError回溯(最近一次调用) 在() ---->1 adata=sc.read(数据文件,缓存=True) ~/anaconda3/lib/python3.6/site-packages/scanpy/readwrite.py in read(文件名、备份、工作表、ext、分隔符、第一列名称、备份url、缓存、缓存压缩、**k

我正在关注Jupyter笔记本上Theisplab的单细胞测序分析教程,链接如下

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


FileNotFoundError回溯(最近一次调用)
在()
---->1 adata=sc.read(数据文件,缓存=True)
~/anaconda3/lib/python3.6/site-packages/scanpy/readwrite.py in read(文件名、备份、工作表、ext、分隔符、第一列名称、备份url、缓存、缓存压缩、**kwargs)
120缓存=缓存,
121缓存压缩=缓存压缩,
-->122**夸尔格,
123         )
124#生成文件名并读取到dict
~/anaconda3/lib/python3.6/site-packages/scanpy/readwrite.py in\u read(文件名、备份、工作表、分词、分隔符、第一列名称、备份url、缓存、缓存压缩、抑制缓存警告、**kwargs)
713
714如果不存在,则:
-->715 raise FileNotFoundError(f'未找到文件{filename}'
716 logg.debug(f'reading{filename}')
717如果不缓存和不抑制\u缓存\u警告:
FileNotFoundError:未找到文件..data/Haber-et-al_mouse-industre-epithelium/GSE92332_RAW/GSM2836573_Regional_Duo_M1_matrix.mtx。
知道我做错了什么吗?
谢谢

我想你忘了
文件库中的斜杠了

file_base='../data/Haber-et-al_小鼠肠上皮/GSE92332_RAW'
而不是

file_base='…data/Haber-et-al_小鼠肠上皮/GSE92332_RAW/GSM283657'

您能提供一些关于
文件库
变量的信息吗?您知道在Python中,相对路径是相对于解释器的,而不是相对于脚本文件的吗?我在问题中编辑了文件库。关于路径,我已经检查了解释器中的路径,它就是我期望的路径:
/Users/Nora/data/Haber-et-al\u mouse-industre-epithelius/GSE92332\u RAW/
文件库
开头。data/
。它应该是
。/data/
最有可能。刚刚更改为
。/data/
,仍然在jupyter类型
%pwd
中获取文件未找到错误,以查看jupyter从哪个目录运行。我已将文件库更改为
。/data/
,但仍然得到相同的错误谢谢!通过使用建议和更改
文件_base='../data/Haber-et-al_小鼠肠上皮/GSE92332_RAW/GSM283657'
#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.