Python wrapper for Azimuth (Seurat-based single-cell mapping) using rpy2
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file azimuthpy-0.1.1.tar.gz.
File metadata
- Download URL: azimuthpy-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdd1ae08a0c21a51150c63ba35bad6508464329d906614c4bc3b9592a6056255
|
|
| MD5 |
77da6a750d95636061f79f1c8e418a5a
|
|
| BLAKE2b-256 |
f754f595270ef74f5982e899e3aaede0f0d36d37fddccb594c84456b2e72621d
|
File details
Details for the file azimuthpy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: azimuthpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ea6554265f42b11bf70e787f095d938473f95a5314497745b0c9567eb3483be
|
|
| MD5 |
434c97a025118651558a08b22386e658
|
|
| BLAKE2b-256 |
5eb6668f573080e3de021dd5771fb41bec02123c976b489d52607f0d6c1a07b2
|