anndict.adata_dict.read_adata_dict_from_h5ad#
- anndict.adata_dict.read_adata_dict_from_h5ad(paths, *, keys=None)[source]#
Read
.h5ad
files from a list of paths and return them in a dictionary.For each element in the provided list of paths, if the element is a directory, it reads all
.h5ad
files in that directory. If the element is an.h5ad
file, it reads the file directly.For auto-generated keys, if there are duplicate filenames, the function will include parent directory names from right to left until keys are unique. For example,
dat/heart/fibroblast.h5ad
would generate the key('heart', 'fibroblast')
if disambiguation is needed.- Parameters:
- paths
str
|list
[str
] A string path or list of paths to directories or
.h5ad
files.- keys
list
[str
] |None
(default:None
) A list of strings to use as keys for the adata_dict. If provided, must be equal in length to the number of
.h5ad
files read.
- paths
- Return type:
- Returns:
An
AdataDict
.