Hello!
I’m having issues running two of my samples (Control & KO) following the example in your tutorials ‘combining multiple samples’. When I run the loop for the two files I get an error at the sc.read_10x_vdj stage (I have also tried using sc.read_h5ad). Any idea why this is?
Below is the code with the error:
samples = {
"Control": {"group": "Control"},
"KO": {"group": "KO"},
}
adatas_tcr = {}
adatas_gex = {}
for sample, sample_meta in samples.items():
gex_file = glob(f"/GEX_outs/h5 files/*{sample}*.h5")
tcr_file = glob(f"/VDJ_outs/csv files/*{sample}*.csv")
adata_gex = sc.read_h5ad(gex_file)
adata_tcr = ir.io.read_10x_vdj(tcr_file)
TypeError Traceback (most recent call last)
Input In [12], in <cell line: 4>()
5 gex_file = glob(f"/GEX_outs/h5 files/*{sample}*.h5")
6 tcr_file = glob(f"/VDJ_outs/csv files/*{sample}*.csv")
----> 7 adata_gex = sc.read_h5ad(gex_file)
8 adata_tcr = ir.io.read_10x_vdj(tcr_file)
File ~/miniconda3/envs/VDJ/lib/python3.8/site-packages/anndata/_io/h5ad.py:219, in read_h5ad(filename, backed, as_sparse, as_sparse_fmt, chunk_size)
211 raise NotImplementedError(
212 "Currently only `X` and `raw/X` can be read as sparse."
213 )
215 rdasp = partial(
216 read_dense_as_sparse, sparse_format=as_sparse_fmt, axis_chunk=chunk_size
217 )
--> 219 with h5py.File(filename, "r") as f:
221 def callback(func, elem_name: str, elem, iospec):
222 if iospec.encoding_type == "anndata" or elem_name.endswith("/"):
File ~/miniconda3/envs/VDJ/lib/python3.8/site-packages/h5py/_hl/files.py:542, in File.__init__(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, fs_strategy, fs_persist, fs_threshold, fs_page_size, page_buf_size, min_meta_keep, min_raw_keep, locking, alignment_threshold, alignment_interval, meta_block_size, **kwds)
540 name = repr(name).encode('ASCII', 'replace')
541 else:
--> 542 name = filename_encode(name)
544 if track_order is None:
545 track_order = h5.get_config().track_order
File ~/miniconda3/envs/VDJ/lib/python3.8/site-packages/h5py/_hl/compat.py:19, in filename_encode(filename)
11 def filename_encode(filename):
12 """
13 Encode filename for use in the HDF5 library.
14
(...)
17 filenames in h5py for more information.
18 """
---> 19 filename = fspath(filename)
20 if sys.platform == "win32":
21 if isinstance(filename, str):
TypeError: expected str, bytes or os.PathLike object, not list