Top-level package for stLearn.

API

Import stLearn as:

import stlearn as st

Wrapper functions: wrapper

read_10x(path[, genome, count_file, ...])

Read data from 10X.

read_old_st(count_matrix_file, spatial_file)

Read Old Spatial Transcriptomics data

read_slide_seq(count_matrix_file, spatial_file)

Read Slide-seq data

read_merfish(count_matrix_file, spatial_file)

Read MERFISH data

read_seq_fish(count_matrix_file, spatial_file)

Read SeqFish data

read_xenium(feature_cell_matrix_file, ...[, ...])

Read Xenium data

create_stlearn(count, spatial, library_id[, ...])

Create AnnData object for stLearn

convert_scanpy(adata[, use_quality])

Add: add

add.image(adata, imgpath, library_id[, ...])

Adding image data to the Anndata object

add.positions(adata, position_filepath, ...)

Adding spatial information into the Anndata object

add.parsing(adata, coordinates_file[, copy])

Parsing the old spaital transcriptomics data

add.lr(adata, db_filepath[, sep, source, copy])

Add significant Ligand-Receptor pairs into AnnData object

add.labels(adata, label_filepath[, ...])

Add label transfer results into AnnData object

add.annotation(adata, label_list[, ...])

Adding annotation for cluster

add.add_loupe_clusters(adata, loupe_path[, ...])

Adding label transfered from Seurat

add.add_mask(adata, imgpath[, key, copy])

Adding binary mask image to the Anndata object

add.apply_mask(adata[, masks, select, ...])

Parsing the old spaital transcriptomics data

add.add_deconvolution(adata, annotation_path)

Adding label transfered from Seurat

Preprocessing: pp

pp.filter_genes(adata[, min_counts, ...])

Wrap function scanpy.pp.filter_genes

pp.log1p(adata[, copy, chunked, chunk_size, ...])

Wrap function of scanpy.pp.log1p Copyright (c) 2017 F.

pp.normalize_total(adata[, target_sum, ...])

Wrap function from scanpy.pp.log1p - normalize counts per cell.

pp.scale(data[, zero_center, max_value, copy])

Wrap function of scanpy.pp.scale

pp.neighbors(adata[, n_neighbors, n_pcs, ...])

Compute a neighborhood graph of observations [McInnes18].

pp.tiling(adata[, out_path, library_id, ...])

Tiling H&E images to small tiles based on spot spatial location.

pp.extract_feature(adata[, cnn_base, ...])

Extract latent morphological features from H&E images using pre-trained convolutional neural network base

Embedding: em

em.run_pca(data[, n_comps, zero_center, ...])

Wrap function scanpy.pp.pca

em.run_umap(adata[, min_dist, spread, ...])

Wrap function scanpy.pp.umap

em.run_ica(adata[, n_factors, fun, tol, ...])

FastICA: a fast algorithm for Independent Component Analysis.

em.run_fa(adata[, n_factors, tol, max_iter, ...])

Factor Analysis (FA) A simple linear generative model with Gaussian latent variables.

em.run_diffmap(adata[, n_comps, copy])

Diffusion Maps [Coifman05] [Haghverdi15] [Wolf18].

Spatial: spatial

spatial.clustering.localization(adata[, ...])

Perform local cluster by using DBSCAN.

spatial.trajectory.pseudotime(adata[, ...])

Perform pseudotime analysis.

spatial.trajectory.pseudotimespace_global(adata)

Perform pseudo-time-space analysis with global level.

spatial.trajectory.pseudotimespace_local(adata)

Perform pseudo-time-space analysis with local level.

spatial.trajectory.compare_transitions(...)

Compare transition markers between two clades

spatial.trajectory.detect_transition_markers_clades(...)

Transition markers detection of a clade.

spatial.trajectory.detect_transition_markers_branches(...)

Transition markers detection of a branch.

spatial.trajectory.set_root(adata, ...[, ...])

Automatically set the root index for trajectory analysis.

spatial.morphology.adjust(adata[, use_data, ...])

SME normalisation: Using spot location information and tissue morphological features to correct spot gene expression

spatial.sme.sme_impute0(adata[, use_data, ...])

Fill missing/zero expression values using spatial, morphological, and expression (SME) information when you what to correct for technical noise (dropouts) without altering existing biological signals.

spatial.sme.pseudo_spot(adata[, tile_path, ...])

Improve spatial resolution by imputing (creating) new spots from existing ones using spatial, morphological, and expression (SME) information.

spatial.sme.sme_normalize(adata[, use_data, ...])

Reduce technical noise by spatially smoothing all expression values using

Tools: tl

tl.clustering.kmeans(adata[, n_clusters, ...])

Perform kmeans cluster for spatial transcriptomics data

tl.clustering.leiden(adata[, resolution, ...])

Wrap function scanpy.tl.leiden

tl.cci.load_lrs([names, species])

Loads inputted LR database, & concatenates into consistent database set of pairs without duplicates.

tl.cci.grid(adata[, n_row, n_col, ...])

Creates a new anndata representing a gridded version of the data; can be

tl.cci.run(adata, lrs[, min_spots, ...])

Performs stLearn LR analysis.

tl.cci.adj_pvals(adata[, pval_adj_cutoff, ...])

Performs p-value adjustment and determination of significant spots.

tl.cci.run_lr_go(adata, r_path[, n_top, ...])

Runs a basic GO analysis on the genes in the top ranked LR pairs.

tl.cci.run_cci(adata, use_label[, ...])

Calls significant celltype-celltype interactions based on cell-type data randomisation.

Plot: pl

pl.qc_plot(adata, name[, library_id, ...])

QC plot for sptial transcriptomics data.

pl.gene_plot(adata[, gene_symbols, ...])

Allows the visualization of a single gene or multiple genes as the values of dot points or contour in the Spatial transcriptomics array.

pl.gene_plot_interactive(adata)

pl.cluster_plot(adata[, title, figsize, ...])

Allows the visualization of a cluster results as the discretes values of dot points in the Spatial transcriptomics array.

pl.cluster_plot_interactive(adata)

pl.subcluster_plot(adata[, title, figsize, ...])

Allows the visualization of a subclustering results as the discretes values of dot points in the Spatial transcriptomics array.

pl.non_spatial_plot(adata[, use_label])

A wrap function to plot all the non-spatial plot from scanpy.

pl.deconvolution_plot(adata[, library_id, ...])

Clustering plot for sptial transcriptomics data.

pl.plot_mask(adata[, library_id, show_spot, ...])

mask plot for sptial transcriptomics data.

pl.lr_summary(adata[, n_top, highlight_lrs, ...])

Plotting the top LRs ranked by number of significant spots.

pl.lr_diagnostics(adata[, highlight_lrs, ...])

Diagnostic plot looking at relationship between technical features of lrs and lr rank.

pl.lr_n_spots(adata[, n_top, font_dict, ...])

Bar plot showing for each LR no.

pl.lr_go(adata[, n_top, highlight_go, ...])

Plots the results from the LR GO analysis.

pl.lr_result_plot(adata[, use_lr, ...])

Plots the per spot statistics for given LR.

pl.lr_plot(adata, lr[, min_expr, sig_spots, ...])

Creates different kinds of spatial visualisations for the LR analysis results.

pl.cci_check(adata, use_label[, figsize, ...])

Checks relationship between no.

pl.ccinet_plot(adata, use_label[, lr, pos, ...])

Circular celltype-celltype interaction network based on LR-CCI analysis.

pl.lr_chord_plot(adata, use_label[, lr, ...])

Chord diagram of interactions between cell types.

pl.lr_cci_map(adata, use_label[, lrs, ...])

Heatmap of interaction counts.

pl.cci_map(adata, use_label[, lr_or_none, ...])

Heatmap visualising sender->receivers of cell type interactions.

pl.lr_plot_interactive(adata)

Plots the LR scores for significant spots interatively using Bokeh.

pl.spatialcci_plot_interactive(adata)

Plots the significant CCI in the spatial context interactively using Bokeh.

pl.trajectory.pseudotime_plot(adata[, ...])

Global trajectory inference plot (Only DPT).

pl.trajectory.local_plot(adata, use_cluster)

Local spatial trajectory inference plot.

pl.trajectory.tree_plot(adata[, library_id, ...])

Hierarchical tree plot represent for the global spatial trajectory inference.

pl.trajectory.transition_markers_plot(adata, ...)

Plot transition marker.

pl.trajectory.de_transition_plot(adata[, ...])

Differential expression between transition markers.

Datasets: datasets

datasets.visium_sge([sample_id, ...])

Processed Visium Spatial Gene Expression data from 10x Genomics’ database.

datasets.xenium_sge([base_url, ...])

Download and extract Xenium SGE data files.