Skip to main content

mixture of experts single cell malignancy classifier

Project description

The aeacus/ folder contains inference code. The model/ folder contains the trained weights and normalization artifacts.

Install

From the repository root:

python -m venv venv
source venv/bin/activate
pip install -e .

Input Format

Input can be:

  • .h5ad
  • .txt / .tsv
  • .csv
  • an AnnData object

For text files, rows should be genes and columns should be cells. For .h5ad, genes should be in adata.var_names and cells in adata.obs_names.

Normalization

To use the same expression scale expected by the model:

  • Already normalized: norm_type="False"
  • Raw UMI counts: norm_type="cpm_log1p"
  • TPM values: norm_type="tpm_log1p"

Do not z-score on new data. The model internally applies the training-set mean and standard deviation

Inference

For raw UMI count data:

from aeacus import Profiler

profiler = Profiler(
    test_input="query.h5ad",
    pretrain_dir="model",
    norm_type="cpm_log1p",
)

result_adata = profiler.load().profile()

For TPM data:

from aeacus import Profiler

result_adata = (
    Profiler(
        test_input="query.h5ad",
        pretrain_dir="model",
        norm_type="tpm_log1p",
    )
    .load()
    .profile()
)

For data already normalized:

from aeacus import Profiler

result_adata = (
    Profiler(
        test_input="query.h5ad",
        pretrain_dir="model",
        norm_type="False",
    )
    .load()
    .profile()
)

Output

Predictions are added to result_adata.obs:

malignancy_call      Normal or Malignant
malignancy_score     malignancy probability-like score
primary_expert       expert with the highest gate weight
primary_expert_label Normal or Malignant label for primary_expert
gate_entropy         uncertainty/spread of gate weights
normal_expert_weight gate weight assigned to the normal expert
malignant_expert_weight gate weight assigned to the malignant expert
expert_weight_0      same value as normal_expert_weight
expert_weight_1      same value as malignant_expert_weight
normal_expert_logit raw logit from the normal expert
malignant_expert_logit raw logit from the malignant expert

View results:

result_adata.obs["malignancy_call"].head()

View all other aeacus output columns:

prediction_cols = [
    "malignancy_call",
    "malignancy_score",
    "primary_expert",
    "primary_expert_label",
    "gate_entropy",
    "normal_expert_weight",
    "malignant_expert_weight",
    "expert_weight_0",
    "expert_weight_1",
    "normal_expert_logit",
    "malignant_expert_logit",
]

result_adata.obs[prediction_cols].head()

Note

  • geneorder.tsv controls the model gene order. Missing genes are filled with zero after alignment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aeacus-0.5.0.tar.gz (16.0 MB view details)

Uploaded Source

Built Distribution

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

aeacus-0.5.0-py3-none-any.whl (15.9 MB view details)

Uploaded Python 3

File details

Details for the file aeacus-0.5.0.tar.gz.

File metadata

  • Download URL: aeacus-0.5.0.tar.gz
  • Upload date:
  • Size: 16.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aeacus-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d680f94887a490dcd6bcc56e6b7e53e6c423bf85e1b25782893888550f7f6ccd
MD5 412c51dac71c60692c3d4ff9a1da7e5c
BLAKE2b-256 f2d26411e7f41876ff99170f95b1eabe93415c77f076f4f9731ec08efa0e0f56

See more details on using hashes here.

File details

Details for the file aeacus-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: aeacus-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aeacus-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 764c3331c1c56786bd0c5c9a80cbbd9b09ef6a33a3be477357f2852ddf13182b
MD5 35b21d53a26a762d8ddbb0b1531ec636
BLAKE2b-256 fc41c8334eccf87fbe3ba9138ab7e8ff7028dc325a8790ea74f1a96888bf7a02

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