API

Interact with HEST-1k

See tutorial 2. Interacting with HEST.

iter_hest(hest_dir[, id_list])

Iterate through HEST samples contained in hest_dir

Run HEST-Benchmark

See tutorial 4. Running HEST Benchmark.

benchmark(encoder, enc_transf, precision[, ...])

Benchmark a patch encoder on HEST-bench

HESTData class

Core object representing a (pooled) Spatial Transcriptomics sample along with a full resolution H&E image and associated metadata. See tutorial 2. Interacting with HEST.

HESTData(adata, img, pixel_size[, meta, ...])

Object representing a (pooled) Spatial Transcriptomics sample along with a full resolution H&E image and associated metadata

Pooling of transcripts, binning

Methods used to pool Xenium transcripts and Visium-HD bins into square bins of custom size

pool_transcripts_xenium(df, pixel_size_he[, ...])

Pool a xenium transcript dataframe by square spots of spot_size_um micrometers.

pool_bins_visiumhd(adata, pixel_size[, ...])

Pools Visium HD bins from an initial resolution (src_bin_size_um) into larger square spots of spot_size_um.

pool_bins_visiumhd_per_cell(nuc_seg, ...[, ...])

Pool Visium-hd bins per cell.

CellViT segmentation

Simplified API for nuclei segmentation

segment_cellvit(wsi_path, name[, ...])

Segment nuclei with CellViT

Gene names manipulation

unify_gene_names(adata[, species, drop])

unify gene names by resolving aliases

ensembl_id_to_gene(st[, filter_na])

Converts ensemble gene IDs of a HESTData object using Biomart annotations and filter out genes with no matching Ensembl ID

Readers to expand HEST-1k

Readers to expand HEST-1k with additional samples. See tutorial 3. Assembling HEST Data.

Reader()

ST/H&E reader

VisiumReader()

10x Genomics Visium reader

XeniumReader()

10x Xenium reader

VisiumHDReader()

10x Genomics Visium-HD reader

STReader()

Legacy Spatial Transcriptomics reader

IO

GDFReader()

Lazily read shapes such that read_gdf is called at compute time

XeniumParquetCellReader([pixel_size_morph, ...])

Xenium parquet shape reader

GDFParquetCellReader([use_dask])

Geopandas parquet shape reader

XeniumTranscriptsReader(pixel_size_morph[, ...])

Xenium transcript shape reader

HESTXeniumTranscriptsReader([use_dask])

HEST Xenium transcript reader

write_geojson(gdf, path)

Write a (dask) geodataframe in optimized QuPath geojson detection format.

Batch effect visualization/correction

filter_hest_stromal_housekeeping(meta_df, ...)

Filter the genes of HESTData samples, such that: - only stable housekeeping genes are kept (see assets/MostStable_{species}.csv).

get_silhouette_score(adata_list, labels[, ...])

Compute the silhouette score for adata_list, cluster memberships are passed in labels (len(labels) == len(adata_list))

plot_umap(adata_list, labels, plot_path[, ...])

Create UMAP plot (n=2) for adata_list, cluster memberships are passed in labels (len(labels) == len(adata_list))

correct_batch_effect(adata_list[, batch, ...])

Apply a batch effect correction method to a list of Spatial Transcriptomics expressions

Miscellaneous

tiff_save(img, save_path, pixel_size[, ...])

Save an image stored in a numpy array to the generic tiff format

autoalign_visium(fullres_img[, save_dir, name])

Automatically find the spot alignment based on an image with apparent Visium fiducials

write_10X_h5(adata, file)

Writes adata to a 10X-formatted h5 file.

find_pixel_size_from_spot_coords(my_df[, ...])

Estimate the pixel size of an image in um/px given a dataframe containing the spot coordinates in that image

get_k_genes(adata_list, k, criteria[, ...])

Get the top-k genes according to some criteria in common genes across multiple samples.