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, _, _, _, _ = self.cell_annotation(
            topk_markers, annotation_info_path, organ)

Sub-cluster refinement

cluster_id = 0
candidate_celltype = ['type1', 'type2']
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


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.0-py3-none-any.whl (32.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xener-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3abee8d1dfcd06bfc3a608eb54fc0dd62cf69f5674be8088fe52fae8fafa74e
MD5 e868bf250b8ed4c767ce0fa123580b64
BLAKE2b-256 6919e4af69d749510023c7dc695a89eb532c988d2accc092075548b7815a5aa2

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