API#
Import Harpy as:
import harpy as hp
IO#
I/O.
|
Read MACSima formatted dataset. |
|
Read MERSCOPE data from Vizgen. |
|
Read a 10X Genomics Xenium dataset into a |
|
Read 10x Genomics Visium formatted dataset. |
|
Read 10x Genomics Visium HD formatted dataset. |
|
Reads transcript information from a file with each row listing the x and y coordinates, along with the gene name. |
|
Reads and adds transcripts from Resolve Biosciences’ Molecular Cartography technology to a SpatialData object. |
|
Reads and adds merscope transcript information to a SpatialData object. |
|
Reads and adds Stereoseq transcript information to a SpatialData object. |
|
Convert a backed Zarr v3 SpatialData object into a Zarr v2 SpatialData store. |
Image#
Operations on image and labels elements.
|
Add an image element to a SpatialData object. |
|
Add a labels element to a SpatialData object. |
|
Retrieve the highest-resolution |
|
Apply a specified function to an image element of a SpatialData object. |
|
Function corrects for the tiling effect that occurs in some image data (e.g. resolve data). |
|
Enhance the contrast of an image in a SpatialData object. |
|
Normalize the intensity of an image element in a SpatialData object using specified percentiles. |
|
Apply min max filtering to an image in a SpatialData object using dask (using |
|
Apply Gaussian filtering to an image in a SpatialData object using dask. |
|
Calculate the transcript density using a Gaussian filter and add it to the provided |
|
Combines specific channels within an image element of a SpatialData object. |
|
Segment images using a provided model and add segmentation results (labels element and shapes element) to the SpatialData object. |
|
Segment images using a |
|
Perform cell segmentation using the Cellpose model. |
|
Perform segmentation using instanseg. |
|
Perform cell segmentation using the Baysor algorithm. |
|
Adds a grid-based labels element to the SpatialData object using either a hexagonal or square grid. |
|
Expand cells in the labels element |
|
Align two labels elements. |
|
Apply a specified function to a labels element in a SpatialData object. |
|
Filter labels in a labels element by global object size. |
|
Merge two labels elements using a global object-level overlap rule. |
|
Match source labels to reference labels based on an overlap score. |
|
Given a shapes element in a SpatialData object, corresponding masks are created, and added as a labels element to the SpatialData object. |
|
Preprocess image elements specified in |
|
Applies flowsom clustering on image element(s) of a SpatialData object. |
Shape#
Operations on shapes (polygons) elements.
|
Vectorize a labels element. |
|
Add a shapes element to a SpatialData object. |
|
Filter shapes in a SpatialData object. |
|
Create Voronoi boundaries from the shapes element of the provided SpatialData object. |
Table#
Operations on table (AnnData object) elements.
|
Add an |
|
Allocates transcripts to instances via provided |
|
Bins gene counts from barcodes to cells or regions defined in |
|
Allocates intensity values from a specified image element to corresponding cells in a SpatialData object and returns an updated SpatialData object augmented with a table element ( |
|
Calculates region property features from the specified labels element, and adds the results to the |
|
Compute per-instance feature matrices from labels and optional image data. |
|
Extract per-label instance windows from |
|
Chunk-wise iterable dataset that: |
|
DataLoader that increments epoch and forwards it to epoch-aware datasets. |
|
Extract per-instance feature vectors from |
|
Preprocess a table (AnnData) attribute of a SpatialData object for transcriptomics data. |
|
Preprocess a table (AnnData) attribute of a SpatialData object for proteomics data. |
|
Returns the updated SpatialData object. |
|
Applies leiden clustering on the |
|
Applies KMeans clustering on the |
|
The function loads marker genes from a CSV file and scores cells for each cell type using those markers using scanpy's |
|
Iterative annotation algorithm. |
|
Correct celltype expression in |
|
Re-calculates annotations, potentially following corrections to the list of celltypes, or after a manual update of the assigned scores per cell type via e.g. |
|
Calculate the nhood enrichment using squidpy via |
|
Cluster cells (instances) based on neighborhood cell-type composition using KMeans. |
|
Calculates weighted (by instance size) average intensity per cluster. |
|
Calculates average intensity of each channel in |
|
Computes spatial pixel neighbors and performs neighborhood enrichment analysis. |
|
Preprocesses spatial data for cell clustering. |
|
Run FlowSOM cell clustering on pixel-cluster-derived cell features. |
|
Calculation of weighted channel expression in the context of cell clustering. |
Points#
Operations on points (Dask DataFrame object) elements.
|
Add a points element to a SpatialData object. |
Externals#
External integrations.
Run ilastik headless object classification and add predicted labels to a table element. |
Quality Control#
Quality control functions.
|
Generate and visualize a histogram for a specified image channel within an image of a |
|
Calculate coverage statistics for a segmentation labels element. |
|
Plot a histogram of segmented instance sizes for a labels element. |
|
Analyse and visualize the proportion of genes that could not be assigned to an instance during allocation step. |
|
Plot a QC metric histogram for an |
|
Plot a standard panel of QC metric histograms for an |
|
Plot the relationship between two observation-level columns. |
Plotting#
Plotting functions.
General plots#
|
Light wrapper around |
|
Light wrapper around |
|
Plot an instance density heatmap from centroids stored in |
Proteomics plots#
|
Generate and visualize a heatmap of mean channel intensities per cluster for each channel. |
|
Visualize spatial distribution of pixel clusters based on labels in a |
|
Generate and visualize a heatmap of mean channel intensities for clusters or metaclusters. |
|
Plot the signal to noise ratio. |
|
Plot the signal to noise ratio. |
|
|
|
|
|
Transcriptomics plots#
|
Plot a transcript density heatmap from a |
Utils#
Utility functions.
|
Helper class to calulate aggregated 'sum', 'mean', 'var', 'kurtosis', 'skew', 'area', 'min', 'max' and 'center of mass' of image and labels using Dask. |
|
Helper class to featurize images and labels using Dask. |
|
Compute KRONOS embeddings for multi-channel instance windows using a pre-trained vision transformer. |
|
Query the labels elements of a SpatialData object and the corresponding instances it annotates in |
Datasets#
Dataset loaders.
|
Differs from |
|
Multisample blobs. |
Example pixie dataset, loaded from s3 bucket. |
|
Example proteomics dataset generated using the MACSima platform. |
|
Load the Colorectal Carcinoma MACSima dataset as a |
|
Colorectal carcinoma MACSima course dataset. |
|
|
Tonsil proteomics dataset generated using the MACSima platform |
|
Example annotated codex dataset (cHL maps dataset), Shaban, M. |
Example proteomics dataset |
|
|
Example proteomics dataset LuCa-7color_[13860,52919]_1x1 from Perkin Elmer |
|
Example transcriptomics dataset. |
|
Example transcriptomics dataset |
|
Example transcriptomics dataset |
Example transcriptomics dataset |
|
Human ovarian cancer Xenium course dataset. |
|
|
Example transcriptomics dataset |
Example transcriptomics dataset |
|
|
Get the Pooch registry |
Get the Pooch SpatialData registry |