Config

SpatialTis allows you to set global configuration, so that you don’t have to specify some parameters in every function.

To set the config:

from spatialtis import CONFIG

Here is some useful configurations you will deal with a lot, all the names are CAPITALIZED.

CONFIG.EXP_OBS

None

CONFIG.ROI_KEY

None

CONFIG.CELL_TYPE_KEY

None

CONFIG.WORKING_ENV

"jupyter"

CONFIG.OS

None

CONFIG.CPU_ALLOC

None

CONFIG.VERBOSE

True

CONFIG.MULTI_PROCESSING

False

Storage keys, please explicitly specify for your own data

CONFIG.CENTROID_KEY

"centroid"

CONFIG.SHAPE_KEY

"cell_shape"

CONFIG.AREA_KEY

"area"

CONFIG.ECCENTRICITY_KEY

"eccentricity"

CONFIG.MARKER_KEY

"markers"

CONFIG.EXP_OBS

To let spatialtis how your experiments are designed, this should be a list of keys from anndata.obs. The order of the name do matters. The last element is assumed to be the ROI level. If not, you must specify using CONFIG.ROI_KEY.

CONFIG.CELL_TYPE_KEY

To let spatialtis know where to find your cell type, this should be a key name from anndata.obs.

CONFIG.WORKING_ENV

Available options: ["jupyter", "zepplin", None]. To set working environment to None will automatically disable progress bar.

CONFIG.OS

Available options: ["Linux", "Darwin", "Windows"]. Normally, you don’t need to specific your system, it will be auto detected by SpatialTis

CONFIG.MULTI_PROCESSING

To enable paralle processing globally in spatialtis. We used Ray to support this features, the support for windows platform is still in experimental stage, if something went wrong, you should turn it off.

CONFIG.CPU_ALLOC

Number of CPU to allocate in paralle processing, the defualt is to use all available resources.

CONFIG.VERBOSE

Config the amount of information print by SpatialTis

VERBOSE.ANNDATA: [True, False] whether to display the change made to anndata object

VERBOSE.PBAR: [True, False] whether to display the progress bar.

VERBOSE.INFO: [True, False] whether to display the runtime info and timer.

CONFIG.PBAR_FORMAT

Default value: "%s{l_bar}%s{bar}%s{r_bar}%s" % (Fore.GREEN, Fore.CYAN, Fore.GREEN, Fore.RESET,)

To configure the appearance of progress bar