spamosaic.framework.SpaMosaic
- class spamosaic.framework.SpaMosaic(modBatch_dict={}, input_key='dimred_bc', mnn_rep_key=None, batch_key='batch', radius_cutoff=2000, intra_knns=10, inter_knn_base=10, smooth_input=False, smooth_L=1, inter_auto_knn=False, inter_auto_thr=0.8, rmv_outlier=False, contamination='auto', w_g=0.8, log_dir=None, seed=1234, num_workers=6, device='cuda:0')[source]
SpaMosaic: A modular framework for multi-modal spatial omics integration.
This class manages data pre-processing, intra- and inter-batch graph construction, model initialization and training, feature alignment, and imputation across multiple omics modalities (e.g., RNA, ADT, ATAC) in spatial transcriptomics.
- Parameters:
modBatch_dict (dict) – Dictionary mapping modality name (e.g., ‘rna’, ‘adt’) to a list of AnnData objects (batches).
input_key (str) – Key in obsm where input features are stored (e.g., ‘dimred_bc’).
mnn_rep_key (str, optional) – Key for representation used in MNN search. If None, defaults to input_key.
batch_key (str) – Column name in obs denoting batch identity.
radius_cutoff (int) – Radius threshold to construct spatial neighbor graph.
intra_knns (int or list of int) – Number of neighbors in intra-batch graph (can be int or per-batch list).
inter_knn_base (int) – Base KNN size for inter-batch MNN search.
smooth_input (bool) – Whether to apply GCN-based input feature smoothing.
smooth_L (int) – Number of GCN layers used in smoothing.
inter_auto_knn (bool) – Whether to adapt KNN size based on batch size ratio.
inter_auto_thr (float) – Size ratio threshold to apply adaptive KNN.
rmv_outlier (bool) – Whether to remove outlier MNN pairs.
contamination (str or float) – Contamination level for outlier detection (used in IsolationForest).
w_g (float) – Weight for inter-batch expression edges in the merged graph.
log_dir (str, optional) – Directory for saving logs or results.
seed (int) – Random seed.
num_workers (int) – Number of workers used for computation.
device (str) – Device to use, e.g., ‘cuda:0’ or ‘cpu’.