scanpy.settings#

scanpy.settings = Settings(preset=<Preset.ScanpyV1: 'scanpy-v1'>, verbosity=<Verbosity.warning: 1>, logfile=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, N_PCS=50, plot_suffix='', file_format_data='h5ad', file_format_figs='pdf', autosave=False, autoshow=True, writedir=PosixPath('write'), cachedir=PosixPath('cache'), datasetdir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/checkouts/latest/data'), figdir=PosixPath('figures'), cache_compression='lzf', max_memory=15.0, n_jobs=4, categories_to_ignore=frozenset({'dontknow', '?', 'N/A', 'no_gate'}), logpath=None)[source]#

Allows users to customize settings for the scanpy package.

Settings here will generally be for advanced use-cases and should be used with caution.

For setting an option use override() (local) or set the attributes directly (global) i.e., scanpy.settings.my_setting = foo. For assignment by environment variable, use the variable name in all caps with SCANPY_ as the prefix before import of scanpy.

The following options are available:

settings.preset: scanpy.Preset = <Preset.ScanpyV1: 'scanpy-v1'>[source]#

Preset to use.

settings.verbosity: scanpy.Verbosity = <Verbosity.warning: 1>[source]#

Verbosity level (default Verbosity.warning).

settings.logfile: io.Writer[str] = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>[source]#

The open file to write logs to.

Set it to a Path or str to open a new one. By default uses sys.stdout in jupyter notebooks and sys.stderr otherwise.

settings.N_PCS: int = 50[source]#

Default number of principal components to use.

settings.plot_suffix: str = ''[source]#

Global suffix that is appended to figure filenames.

settings.file_format_data: Literal['h5ad', 'zarr'] = 'h5ad'[source]#

File format for saving AnnData objects.

settings.file_format_figs: str = 'pdf'[source]#

File format for saving figures.

For example 'png', 'pdf' or 'svg'. Many other formats work as well (see matplotlib.pyplot.savefig()).

settings.autosave: bool = False[source]#

Automatically save figures in figdir (default False).

Do not show plots/figures interactively.

settings.autoshow: bool = True[source]#

Automatically show figures if autosave == False (default True).

There is no need to call the matplotlib pl.show() in this case.

settings.writedir: pathlib._local.Path = PosixPath('write')[source]#

Directory where the function scanpy.write writes to by default.

settings.cachedir: pathlib._local.Path = PosixPath('cache')[source]#

Directory for cache files (default './cache/').

settings.datasetdir: pathlib._local.Path = PosixPath('data')[source]#

Directory for example datasets (default './data/').

settings.figdir: pathlib._local.Path = PosixPath('figures')[source]#

Directory for autosaveing figures (default './figures/').

settings.cache_compression: Optional[Literal['lzf', 'gzip']] = 'lzf'[source]#

Compression for sc.read(..., cache=True) (default 'lzf').

settings.max_memory: float = 15.0[source]#

Maximum memory usage in Gigabyte.

Is currently not well respected…

settings.n_jobs: int = 4[source]#

Default number of jobs/ CPUs to use for parallel computing.

Set to -1 in order to use all available cores. Not all algorithms support special behavior for numbers < -1, so make sure to leave this setting as >= -1.

Changed in version 1.13.0: The default changed from 1 to 4.

settings.categories_to_ignore: collections.abc.Container[str] = frozenset({'dontknow', '?', 'N/A', 'no_gate'})[source]#

Categories that are omitted in plotting etc.