Skip to main content

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/

PyPI: https://pypi.org/project/xener

Github: https://github.com/liushuai6bgi/Xener

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

xener-0.1.4-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file xener-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: xener-0.1.4-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

Hashes for xener-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e835314cd8e0a712df5d0039c04c17eed1a8242b4de95c2452e4b8d451ce2c1d
MD5 37fd4ddb0d0e98da16b89e2d2b262bde
BLAKE2b-256 23016cf4798d6c8a4c4717d0b37d52d7fb8d6dd241635f4cf402b3687f9845fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page