spatialtis.config._Config¶
- class spatialtis.config._Config[source]¶
Global configurations for spatialtis
Don’t directly import this class, import the instance created for you
>>> from spatialtis import Config
This allows you to set global configuration, so that you don’t have to repeatly pass the same parameters in every function.
To set a config, simple set the attribute
>>> Config.auto_save = True # auto save to current directory >>> Config.auto_save = "my_spatialtis_result" # save to custom directory
To view your current configs
>>> Config.view() Current configurations of SpatialTis ┌─────────────────────────┬───────────────┬───────┐ │ Options │ Attributes │ Value │ ├─────────────────────────┼───────────────┼───────┤ │ Multiprocessing │ mp │ True │ │ Verbose │ verbose │ True │ │ Progress bar │ progress_bar │ False │ │ Auto save │ auto_save │ False │ │ Experiment observations │ exp_obs │ None │ │ ROI key │ roi_key │ │ │ Cell type key │ cell_type_key │ │ │ Marker key │ marker_key │ │ │ Centroid key │ centroid_key │ │ │ Shape key │ shape_key │ │ └─────────────────────────┴───────────────┴───────┘
- exp_obs¶
REQUIRED, (Default: None); The columns in AnnData.obs that tells how your experiments organized, for example, you have different columns [“patients”, “sex”, “organ_part”, “roi_id”], the last one will be used as roi_key by default.
- roi_key¶
OPTIONAL, (Default: None); Overwrite the roi_key
- centroid_key¶
REQUIRED, (Default: None); The column in AnnData.obs that store cell coordination, must be in wkt format, you can use spatialtis.transform_points to transform you data into wkt.
- shape_key¶
OPTIONAL, (Default: None);The columns in AnnData.obs that store cell shape, must be in wkt format, you can use spatialtis.transform_shapes to transform you data into wkt.
- cell_type_key¶
OPTIONAL, (Default: None); The columns in AnnData.obs that store cell type name, some analysis require cell type name to proceed
- marker_key¶
OPTIONAL, (Default: None); The columns in AnnData.var that store protein/gene/transcript… name, if not specific, will use AnnData.var.index. some analysis require marker name to proceed
- mp¶
OPTIONAL, (Default: True); To turn on/off multiprocessing. From v0.4.0, It only affects spatial_coexp, other analysis are implemented in Rust with default parallel processing on.
- verbose¶
OPTIONAL, (Default: True); Control the printed message
- progress_bar¶
OPTIONAL, (Default: True); Control the progress bar
- auto_save¶
OPTIONAL, (Default: None); Set to True will automatically save all images in spatialtis_result fold created at current directory, or set a path to store else where.
Methods
dumps
(data)Save configurations to anndata
loads
(data)Load configurations from anndata
reset
()Reset to default
view
()Print a table with current configurations