scanpy.read
- scanpy.read(filename, backed=None, sheet=None, ext=None, delimiter=None, first_column_names=False, backup_url=None, cache=False, cache_compression=<Empty.token: 0>, **kwargs)
Read file and return
AnnDataobject.To speed up reading, consider passing
cache=True, which creates an hdf5 cache file.- Parameters
- filename :
Path|strUnion[Path,str] If the filename has no file extension, it is interpreted as a key for generating a filename via
sc.settings.writedir / (filename + sc.settings.file_format_data). This is the same behavior as insc.read(filename, ...).- backed : {‘r’, ‘r+’} |
NoneOptional[Literal[‘r’, ‘r+’]] (default:None) If
'r', loadAnnDatainbackedmode instead of fully loading it into memory (memorymode). If you want to modify backed attributes of the AnnData object, you need to choose'r+'.- sheet :
str|NoneOptional[str] (default:None) Name of sheet/table in hdf5 or Excel file.
- ext :
str|NoneOptional[str] (default:None) Extension that indicates the file type. If
None, uses extension of filename.- delimiter :
str|NoneOptional[str] (default:None) Delimiter that separates data within text file. If
None, will split at arbitrary number of white spaces, which is different from enforcing splitting at any single white space' '.- first_column_names :
boolbool(default:False) Assume the first column stores row names. This is only necessary if these are not strings: strings in the first column are automatically assumed to be row names.
- backup_url :
str|NoneOptional[str] (default:None) Retrieve the file from an URL if not present on disk.
- cache :
boolbool(default:False) If
False, read from source, ifTrue, read from fast ‘h5ad’ cache.- cache_compression : {‘gzip’, ‘lzf’} |
None|EmptyUnion[Literal[‘gzip’, ‘lzf’],None,Empty] (default:<Empty.token: 0>) See the h5py Filter pipeline. (Default:
settings.cache_compression)- kwargs
Parameters passed to
read_loom().
- filename :
- Return type
- Returns
An
AnnDataobject