azimuthpy
azimuthpy is a lightweight Python package that enables seamless integration with the Azimuth reference mapping framework using rpy2.
It lets you map single-cell RNA-seq datasets (in Python AnnData format) to Azimuth references in Python.
- Supports direct
AnnData➔Seuratconversion - Pulls predictions and annotations back into
AnnData.obs - Fully in-memory, no saving intermediate files
Installation
You need to have R installed on your machine with the following R packages:
Install:
pip install azimuthpy
Or using Conda:
# takes 15+ min...
conda env create -f environment.yml
conda activate azimuthpy_conda
If r-azimuth is not available through Conda, install it manually inside R:
install.packages("remotes")
remotes::install_github("satijalab/azimuth")
How to Use
import scanpy as sc
from azimuthpy import annotate_adata_azimuth
Load example dataset
adata = sc.datasets.pbmc3k()
adata
Preprocess
sc.pp.highly_variable_genes(adata, n_top_genes=2000, subset=True, flavor="seurat_v3") # Optional
# Store raw counts in adata.layers["raw_counts"]
adata.layers["raw_counts"] = adata.X
Map to Azimuth reference
You can download references from https://azimuth.hubmapconsortium.org/
# e.g., from https://azimuth.hubmapconsortium.org/references/#Human%20-%20Lung%20v2%20%28HLCA%29
# -> Zenodo: https://zenodo.org/records/6342228
# wget -c https://zenodo.org/api/records/6342228/files-archive
# unzip ...
adata = annotate_adata_azimuth(adata, reference_path="path/to/folder/",
use_layer="raw_counts",
umap_name="ref.umap")
View predicted labels
adata.obs[['predicted.celltype.l1', 'prediction.score.celltype.l1']]
For a full tutorial, see tutorial/gettingStarted.ipynb.
For more info, take a look at the original azimuth R page.
Release files for azimuthpy 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| azimuthpy-0.1.1.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| azimuthpy-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / azimuthpy-0.1.1.tar.gz
| Download URL | azimuthpy-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdd1ae08a0c21a51150c63ba35bad6508464329d906614c4bc3b9592a6056255
|
|
BLAKE2b-256 checksum How to use checksums |
f754f595270ef74f5982e899e3aaede0f0d36d37fddccb594c84456b2e72621d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / azimuthpy-0.1.1-py3-none-any.whl
| Download URL | azimuthpy-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ea6554265f42b11bf70e787f095d938473f95a5314497745b0c9567eb3483be
|
|
BLAKE2b-256 checksum How to use checksums |
5eb6668f573080e3de021dd5771fb41bec02123c976b489d52607f0d6c1a07b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|