Skip to main content

ctdecon

Reference-based cell type deconvolution in spatial transcriptomics.

Experiments were executed with PyTorch 2.1.0+cu121 on NVIDIA A40 with 46068MiB memory in linux environment.

adata_utils

adata_utils file contains 4 functions, preprocess function selects highly variable genes from raw adata, then normalize, log1p, and scale adata or adata_sc(scRNA-seq). The spot_graph function constructs spot-to-spot interactive graph with is_sparse and n_neighbors, is_sparse controls the way of creating interactions matrix, then interaction of graph neighborhood and symmetrical adjacent save in adata.obsm. The contrast function generates contrastive label for spots and save in adata.obsm. The get_feature function augmentes features of adata by permutation after selecting highly variable genes with bool deconvolution and choose whether instance of adata is csc_matrix or csr_matrix.

deconvo

deconvo file contains 1 class named config, which have train, train_sc, and train_map functions to learn representation of adata and adata_sc. Parameter device sets the device of training process, while learning_rate set for train function and learng_rate_sc set for train_sc function. Parameter dim_output is the output representation of adata, while alpha and beta act on loss functions combination of train function. The train_sc function evaluates loss with mse_loss, while lambda1 and lambda2 control the influence of reconstruction loss and contrastive loss in mapping matrix learning. Class config uses default True in deconvolution and False in is_sparse to control whether uses sparse data.

reference

reference file contains 2 functions, overlap_gene function computes the overlap genes of adata and adata_sc, while cell2spot projects cell types onto spatial transcriptomics data using mapped matrix in adata.obsm. The overlap_gene function selects and saves overlap data by genes with spatial data and scRNA-seq reference data. The cell2spot function extracts top-k values for each spot with float retain_percent, and using map_matrix.dot(matrix_cell_type) as projection by spot-level. Final mapped results are saved in adata.obs by columns of projection dataframes.

Metadata

Release files for ctdecon 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctdecon 1.0.1
File Size Uploaded
ctdecon-1.0.1.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ctdecon 1.0.1
File Interpreter ABI Platform
ctdecon-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / ctdecon-1.0.1.tar.gz

Download URL ctdecon-1.0.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a6802e27e956edc27b33ca025af1255e7ff06e115c3606fe32b2f410b609c78b
BLAKE2b-256 checksum
How to use checksums
c73058f1058a5e7217769c00af70d03f383e5f682792330692ffb293b28c1dc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.4

Release files / ctdecon-1.0.1-py3-none-any.whl

Download URL ctdecon-1.0.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3400328c7671211ff0f4588cfed211815eec842a755352104183138fd40f6c7
BLAKE2b-256 checksum
How to use checksums
15dccdc843b24e1c41a86b7ed810c13923f59edadfdf6ec25b71fa00a8e1b1da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page