ehrapy._settings.EhrapyConfig#

class ehrapy._settings.EhrapyConfig(*, plot_suffix='', file_format_data='h5ad', file_format_figs='pdf', autosave=False, autoshow=True, writedir='./ehrapy_write/', cachedir='./ehrapy_cache/', datasetdir='./ehrapy_data/', figdir='./figures/', cache_compression='lzf', max_memory=15, n_jobs=-1, categories_to_ignore=('N/A', 'dontknow', 'no_gate', '?'), _frameon=True, _vector_friendly=False, _low_resolution_warning=True, n_pcs=50)[source]#

Configuration manager for ehrapy.

Attributes table#

autosave

Automatically save figures in figdir (default False).

autoshow

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

cache_compression

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

cachedir

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

categories_to_ignore

Categories that are omitted in plotting etc.

datasetdir

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

figdir

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

file_format_data

File format for saving AnnData objects.

file_format_figs

File format for saving figures.

max_memory

Maximal memory usage in Gigabyte.

n_jobs

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

plot_suffix

Global suffix that is appended to figure filenames.

verbosity

Logger verbosity (default 'warning').

writedir

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

N_PCS

Default number of principal components to use.

Methods table#

set_figure_params([scanpy, dpi, dpi_save, ...])

Set resolution/size, styling and format of figures.

Attributes#

EhrapyConfig.autosave#

Automatically save figures in figdir (default False).

Do not show plots/figures interactively.

EhrapyConfig.autoshow#

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

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

EhrapyConfig.cache_compression#

Compression for sc.read(…, cache=True) (default ‘lzf’).

May be ‘lzf’, ‘gzip’, or None.

EhrapyConfig.cachedir#

Directory for cache files (default ‘./cache/’).

EhrapyConfig.categories_to_ignore#

Categories that are omitted in plotting etc.

EhrapyConfig.datasetdir#

Directory for example datasets (default ‘./data/’).

EhrapyConfig.figdir#

Directory for saving figures (default ‘./figures/’).

EhrapyConfig.file_format_data#

File format for saving AnnData objects.

Allowed are ‘txt’, ‘csv’ (comma separated value file) for exporting and ‘h5ad’ (hdf5) for lossless saving.

EhrapyConfig.file_format_figs#

File format for saving figures.

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

EhrapyConfig.max_memory#

Maximal memory usage in Gigabyte.

Is currently not well respected….

EhrapyConfig.n_jobs#

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

EhrapyConfig.plot_suffix#

Global suffix that is appended to figure filenames.

EhrapyConfig.verbosity#

Logger verbosity (default ‘warning’).

  • ‘error’: ❌ only show error messages

  • ‘warning’: ❗ also show warning messages

  • ‘success’: ✅ also show success and save messages

  • ‘info’: 💡 also show info messages

  • ‘hint’: 💡 also show hint messages

  • ‘debug’: 🐛 also show detailed debug messages

EhrapyConfig.writedir#

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

EhrapyConfig.N_PCS#

Default number of principal components to use.

Methods#

EhrapyConfig.set_figure_params(scanpy=True, dpi=80, dpi_save=150, frameon=True, vector_friendly=True, fontsize=14, figsize=None, color_map=None, format='pdf', facecolor=None, transparent=False, ipython_format='png2x', dark=False)[source]#

Set resolution/size, styling and format of figures.

Parameters:
  • scanpy (bool, default: True) – Init default values for matplotlib.rcParams based on Scanpy’s.

  • dpi (int, default: 80) – Resolution of rendered figures – this influences the size of figures in notebooks.

  • dpi_save (int, default: 150) – Resolution of saved figures. This should typically be higher to achieve publication quality.

  • frameon (bool, default: True) – Add frames and axes labels to scatter plots.

  • vector_friendly (bool, default: True) – Plot scatter plots using png backend even when exporting as pdf or svg.

  • fontsize (int, default: 14) – Set the fontsize for several rcParams entries. Ignored if scanpy=False.

  • figsize (int | None, default: None) – Set plt.rcParams[‘figure.figsize’].

  • color_map (str | None, default: None) – Convenience method for setting the default color map. Ignored if scanpy=False.

  • format (Literal['png', 'jpg', 'tif', 'tiff', 'pdf', 'ps', 'eps', 'svg', 'svgz', 'pgf', 'raw', 'rgba'], default: 'pdf') – This sets the default format for saving figures: file_format_figs.

  • facecolor (str | None, default: None) – Sets backgrounds via rcParams[‘figure.facecolor’] = facecolor and rcParams[‘axes.facecolor’] = facecolor.

  • transparent (bool, default: False) – Save figures with transparent back ground. Sets rcParams[‘savefig.transparent’].

  • ipython_format (str, default: 'png2x') – Only concerns the notebook/IPython environment; see set_matplotlib_formats() for details.

  • dark (bool, default: False) – Whether to enable Matplotlibs dark styled. Inverts all colors.