API

Import PAST with:

import past

Model

Model.PAST(d_in, d_lat[, k_neighbors, dropout])

PAST Model: latent feature extraction and spatial domain deciphering with a prior-based self-attention framework for spatial transcriptomics

Utils

Utils.setup_seed(seed)

Set random seed

Utils.integration(adata_ref, adata)

Align the gene set of reference dataset with that of target dataset

Utils.geary_genes(adata[, n_tops, k])

Select spatially variable genes for better downstream analysis

Utils.preprocess(adata[, min_cells, ...])

Data preprocess for downstream analysis

Utils.get_bulk(adata_ref, key[, min_samples, r])

construct pseudo bulk from reference dataset according to annotation

Utils.visualize(adata, keys[, use_rep, ...])

visualization for cell embedding and spatial clustering

Utils.Ripplewalk_sampler(graph[, r, ...])

Training stategy of subgraph segmentation based on random walk, enabling mini-batch training on large datasets

Utils.Ripplewalk_prediction(graph[, r, ...])

Prediction stategy of subgraph segmentation based on random walk, enabling mini-batch prediction on large datasets

Utils.StDataset(data, knn, metric)

Spatial Transcriptomic Dataset

Utils.optim_parameters(net[, included, excluded])

Parameters in neural network to be trained

Utils.spatial_prior_graph(feature_matrix, ...)

Construct spatial prior graph for metric learning

Utils.load_noise(sdata, mask)

Add noise to gene expression matrix

Utils.svm_annotation(ref_mtx, ref_anno, ...)

Use SVM with radial basis function kernel as classifier to train on the reference dataset and annotate the target dataset.

Utils.DLPFC_split(adata, dataset_key, anno_key)

Based on domain annotation and dataset annotation, apply Stratified downsampling to DLPFC dataset

Evaluation

Evaluation.svm_cross_validation(mtx, target)

K-fold cross validation, taking low-dimensional embedding as input, annotation as output and SVM with rbf kernel as classifier

Evaluation.cluster_refine(pred, spatial_mtx)

Refine clustering result according spatial neighborhood

Evaluation.default_louvain(adata[, refine, ...])

Default louvain clustering algorithm applied in scanpy package with default resolution 1.0

Evaluation.default_leiden(adata[, refine, ...])

Default leiden clustering algorithm applied in scanpy package with default resolution 1.0

Evaluation.run_louvain(adata, n_cluster[, ...])

Search resolution so that louvain clustering algorithm obtain cluster numbers as close to given number as possible

Evaluation.run_leiden(adata, n_cluster[, ...])

Search resolution so that leiden clustering algorithm obtain cluster numbers as close to given number as possible

Evaluation.mclust_R(adata, num_cluster[, ...])

Clustering using the mclust algorithm.

Evaluation.cluster_metrics(adata, target, pred)

clustering metrics including ARI, AMI, HOMO and NMI