API#
The main user-facing API is exposed at the top level of the terra package. The
typical workflow is to harmonize an AnnData, tokenize it against a trained
model, and embed it:
from terra import download_pretrained, harmonize_tokenize_embed_pipeline
Inference#
|
Harmonize, tokenize and embed an AnnData object. |
|
Harmonize an AnnData object prior to tokenization. |
|
Tokenize an AnnData object based on the parameters in the model config and return the tokenized Hugging Face dataset. |
|
Embed a tokenized dataset, returning cell-, neighborhood- and gene-level embeddings. |
|
Compute per-gene embeddings or co-occurrence statistics over a tokenized dataset. |
|
Use a trained model for inference, returning cell, neighborhood and optionally gene embeddings. |
|
Retrieve gene embeddings for specified cell and neighborhood gene IDs. |
|
Retrieve average gene embeddings for each gene per dataset. |
|
Perturb a tokenized Hugging Face dataset according to a perturbation dataframe. |
|
Compute and return distance between cosine similarity of cell_neb and cell_cell matrix. |
|
Compute and return cosine similarity matrix for specified gene IDs. |
Hugging Face Hub#
|
Download a published TERRA model bundle. |
|
Create (if needed) a Hugging Face model repo and upload a TERRA model bundle. |
Data#
Convenience reader used by the tutorials to load public 10x Genomics Xenium samples.
|
Download a 10x Genomics Xenium sample and load it as an |