spatial-gpu v0.1.0

Reference

API reference for spatialgpu.deconvolution

All public functions are available via import spatialgpu.deconvolution as spacet.

Core Deconvolution

deconvolution(adata, cancer_type, ...)
Two-stage hierarchical cell type deconvolution. Infers malignant cell fractions, then deconvolves non-malignant cell types.
deconvolution_bulk(adata, cancer_type, ...)
Cell type deconvolution adapted for bulk RNA-seq cohorts.
quality_control(adata, min_genes=1)
Filter out cells/spots with fewer than min_genes expressed genes.
cormat(adata)
Compute pairwise correlation matrix of deconvolution cell type fractions.

Extensions

deconvolution_malignant(adata, ...)
Explore different malignant cell states in tumor ST data by clustering high-malignant spots and re-deconvolving.
deconvolution_malignant_custom_scrnaseq(adata, ...)
Malignant cell state deconvolution using a custom scRNA-seq reference.
deconvolution_matched_scrnaseq(adata, ...)
Deconvolution using a matched scRNA-seq reference from the same tissue sample.
generate_ref(adata_sc, ...)
Generate a reference signature matrix from scRNA-seq data for use in deconvolution.

Gene Set

gene_set_score(adata, gene_sets)
Calculate gene set scores per spot using UCell-like ranking. Supports built-in sets ('Hallmark', 'CancerCellState', 'TLS') or custom gene set dicts.

Cell-Cell Interaction

cci_colocalization(adata)
Cell-type pair colocalization via Spearman correlation of deconvolution fractions.
cci_lr_network_score(adata, ...)
Ligand-receptor network scoring with permutation testing for each spot.
cci_cell_type_pair(adata, cell_type_pair)
Cell-type pair interaction analysis using Cohen’s d and Wilcoxon test.
identify_interface(adata, ...)
Identify tumor-stroma interface spots based on malignant fraction and spatial neighbors.
combine_interface(adata, cell_type_pair)
Overlay cell-type pair interaction spots onto the tumor-stroma interface map.
distance_to_interface(adata, cell_type_pair, ...)
Permutation test for the distance of cell-cell interactions to the tumor border.
visualize_colocalization(adata, ...)
Dot plot + scatter visualization of cell-type colocalization results.
visualize_cell_type_pair(adata, cell_type_pair, ...)
Three-panel visualization of a co-localized cell-type pair interaction.
visualize_distance_to_interface(adata, cell_type_pair, ...)
Histogram with density overlay showing distance of interactions to the tumor border.

Spatial Correlation

spatial_correlation(adata, ...)
Univariate, bivariate, and pairwise Moran’s I spatial autocorrelation with permutation testing.
cal_weights(adata, radius=200, ...)
Compute spatial weight matrix using an RBF (Gaussian) kernel with KD-tree neighbor search.

SecAct Analysis

secact_inference(adata, ...)
Infer secreted protein signaling activity from spatial transcriptomics data via ridge regression.
secact_signaling_patterns(adata, k=3, ...)
Discover signaling patterns via NMF on activity z-scores, with optional automatic k selection by silhouette score.
secact_pattern_genes(adata, n)
Enumerate secreted proteins most associated with signaling pattern n, sorted by NMF weight.
secact_signaling_velocity(adata, gene, ...)
Compute spot-level signaling velocity arrows for a secreted protein (source → sink direction).
secact_signaling_velocity_scst(adata, sender, secreted_protein, receiver, ...)
Compute single-cell resolution signaling velocity arrows between specific sender and receiver cell types.
secact_spatial_ccc(adata, cell_type_col, ...)
Compute spatial cell-cell communication mediated by secreted proteins with permutation testing.
secact_coxph_regression(activity_matrix, survival_data)
Cox proportional hazards regression for secreted protein risk scores in bulk cohorts.
secact_survival_data(activity_matrix, survival_data, protein, ...)
Prepare Kaplan-Meier survival data for a secreted protein, stratified by activity cutoff.

Visualization

visualize_spatial_feature(adata, spatial_type, ...)
Spatial scatter plots for QC metrics, gene expression, cell fractions, interface, gene set scores, activity, and metadata.
visualize_secact_heatmap(adata, ...)
CCC heatmap showing sender × receiver secreted protein counts with marginal bar plots.
visualize_secact_circle(adata, ...)
CCC chord/circle diagram with directional links between cell types.
visualize_secact_sankey(adata, sender, secreted_protein, receiver, ...)
Sankey (alluvial) diagram of sender → protein → receiver communication flows.
visualize_secact_dotplot(adata, sender, secreted_protein, receiver, ...)
CCC dot plot showing secreted protein communication across sender→receiver pairs.
visualize_secact_heatmap_activity(data, ...)
Generic activity heatmap for secreted protein z-scores or pattern weights.
visualize_secact_bar(data, ...)
Diverging bar plot for secreted protein values (e.g., Cox regression coefficients).
visualize_secact_lollipop(data, ...)
Lollipop plot for secreted protein values.
visualize_secact_velocity(adata, gene, ...)
Spot-level signaling velocity visualization with optional contour map and animation.
visualize_secact_velocity_scst(velocity_result, ...)
Single-cell resolution signaling velocity visualization with customizable area zoom.
visualize_secact_survival(survival_result, ...)
Kaplan-Meier survival plot for secreted protein stratification.

I/O

create_spacet_object(counts, spot_coordinates, platform, ...)
Create an AnnData object from a count matrix (genes × spots) and spot coordinate DataFrame.
create_spacet_object_10x(visium_path)
Create an AnnData object from a 10X Visium Space Ranger output directory.