Single-cell cross-species cell type annotation tool using knowledge graph.
Project description
Xener
This is the public version, containing only the necessary code.
A cross-species single-cell cell type annotation tool using knowledge graph.
Installation
pip install .
# or
pip install xener
Quick Start
from xener import Xener
# Initialize
annor = Xener()
# Run full pipeline
cluster2celltype, _ = annor.run_from_yaml('config.yaml')
config.yaml example.
cluster_key: leiden
model_species:
- Brassica_rapa
non_model_fasta: Arabidopsis_thaliana.fasta
non_model_h5ad: ERP132245.h5ad
organ: leaf
outdir: output/ERP132245
Step-by-step
from xener import Xener
import scanpy as sc
annor = Xener()
adata = sc.read('ERP132245.h5ad')
cluster_key = 'leiden'
non_model_fasta = 'Arabidopsis_thaliana.fasta'
model_species = ['Brassica_rapa']
organ = 'leaf'
outdir = 'output/ERP132245'
marker_gene = annor.get_markers(adata, cluster_key)
marker_weight = annor.get_gene_weight(marker_gene)
gene_homolo_weight = annor.mapping(marker_weight, non_model_fasta, model_species, outdir)
topk_markers = annor.get_topk_gene(gene_homolo_weight, k=30)
# Only the top 30 genes will be retained for the subsequent steps.
cluster2celltype, _, celltype_weight, _, _ = annor.cell_annotation(
topk_markers, annotation_info_path, organ)
Sub-cluster refinement
cluster_id = 0
candidate_celltype = ['type1', 'type2']# Only support the values that appear in celltype_weight[celltype_weight['cluster'] == cluster_id]['celltype'].unique()
key_added = 'xener_refine'
moranI_threshold = 0.5
# moranI_threshold used for gene screening, the effective value ranges from [-1, 1]. The closer to 1, the stricter it is. If an invalid value is input, the screening step will be skipped.
annor.refine_single_cluster(adata, topk_markers,
cluster_key, cluster_id, candidate_celltype,
key_added, organ, moranI_threshold)
# The results can be found in adata.obs[key_added]
Links
Homepage: https://xenor.dcs.cloud/
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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
xener-0.1.3-py3-none-any.whl
(32.9 kB
view details)
File details
Details for the file xener-0.1.3-py3-none-any.whl.
File metadata
- Download URL: xener-0.1.3-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb2f45f6a5f4a1731c13914c8cdcfc84b51720ae99a41c91da0711ba4acd4ac
|
|
| MD5 |
de1f35b3ca9cadfb398b4b15b209fb49
|
|
| BLAKE2b-256 |
8e4b024976ad85ee6a8909fd7fa2b926a4938081935d0be0b9b859241a833d26
|