Preprocess

spann.preprocess.anndata_preprocess(adata_spa, adata_rna, highly_variable=2000, spatial_labels=False)[source]

Preprocess the rna and spatial Anndata

Adata_spa:

AnnData file of spatial dataset, .obs contains 'X','Y', 'source'

Adata_rna:

AnnData file of rna dataset, .obs contains 'cell_type', 'source'

Highly_variable:

number of highly variable genes

Spatial_labels:

if there are ground truth spatial data labels, if True, adata_spa.obs should contains 'cell_type'

Returns:

preprocessed AnnData file, adata_cm, adata_rna, adata_spa

spann.preprocess.generate_dataloaders(adata_cm, adata_spa, adata_rna, batch_size=256)[source]

Generate torch datasets and torch dataloaders from preprocessed AnnData files

Adata_cm:

AnnData file of the preprocessed common gene integrated scRNA-seq & spatial data

Adata_spa:

AnnData file of the preprocessed spatial data

Adata_rna:

AnnData file of the preprocessed scRNA-seq data

Batch_size:

batch size of the dataloaders, default=256

Returns:

domain specific genes datasets - source_sp_ds,target_sp_ds, train dataloaders - source_cm_dl,target_cm_dl, test dataloaders - test_source_cm_dl,test_target_cm_dl

spann.preprocess.generate_ae_params(adata_cm, adata_spa, adata_rna, feat_dim=16)[source]

Generate default autoencoder parameters from preprocessed spatial and rna data

Adata_cm:

AnnData file of the preprocessed common gene integrated scRNA-seq & spatial data

Adata_spa:

AnnData file of the preprocessed spatial data

Adata_rna:

AnnData file of the preprocessed scRNA-seq data

Feat_dim:

dimension of latent features, default=16

Returns:

encoder_parameters, decoder_parameters, output dimensions, latent dimension