Skip to main content

robust cell type classifier for immune cells

Project description

CLACELL

Robust cell type classifier for immune cells

Usage

MarkerAnnotator

The MarkerAnnotator can be used to annotate an Anndata dataset. It uses a marker based annotation strategy to annotate the dataset. You can either use an own marker dictionary or use the default dictionary.

from clacell import MarkerAnnotator

annotator = MarkerAnnotator(marker_dict=marker_dict)
adata = annotator.annotate(adata)
# Now adata.obs['scumi-annotation'] contains the annotations

BloodCellClassifier

The cell type classifier has four different methods:

  1. grid_search: Makes a search over the hyperparameters of the model, evaluates the best model and retrains it on the whole dataset using 'train'.
  2. train: Trains the model with the given hyperparameters.
  3. evaluate: Evaluates the current model with robustness tests. The model needs to be trained before this method is called.
  4. predict: Predicts new samples. The model needs to be trained before this method is called.

All methods can be called with Dataframes or with an Anndata object. If an Anndata object is provided, it will be automatically preprocessed.

from clacell import BloodCellClassifier

classifier = BloodCellClassifier()

# 1. GridSearch
print("\n1. grid_search")
classifier.grid_search(X_train, y_train, X_test, y_test, n_jobs=3)

# 2. Train
print("\n2. train")
classifier.train(X_train, y_train, C=0.001)

# 3. Evaluate
print("\n3. evaluate")
classifier.evaluate(X_test, y_test)

# 4. Predict
print("\n4. predict")
predictions = classifier.predict(X_test)
print(f"Macro F1: {f1_score(y_test, predictions, average="macro")}")

Acknowledgments & Data Sources

The marker based annotation strategy is a reimplementation of the existing R package scumi-dev (licensed under BSD 3-Clause License). Link to the repository: https://bitbucket.org/jerry00/scumi-dev/src/master/

  • Citation: Ding, J., Adiconis, X., Simmons, S.K. et al. Systematic comparison of single-cell and single-nucleus RNA-sequencing methods. Nat Biotechnol 38, 737–746 (2020). https://doi.org/10.1038/s41587-020-0465-8

This repository contains reference datasets used for training and validation:

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

clacell-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

clacell-0.1.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file clacell-0.1.0.tar.gz.

File metadata

  • Download URL: clacell-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clacell-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d849aa5faeb4fd0134924cef1048c77dcaf5f54f425f8f597a4cff5d8c4fac4
MD5 816a389fd48ec1e1969416332793700a
BLAKE2b-256 48fd783c0420cee8fbc6466def7b3b2721abc4e46310fd7256921e8fda997f5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clacell-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clacell-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14342bec1af12c8a92cd38dce9e61a16b655dcbce4e020945529cf5fd67125af
MD5 45cb1c88a86d3baed5b44e2f8eb536b7
BLAKE2b-256 b170c028947037321dc117ed3e8b156bc5017b55c2d845af085f6ad3651142c0

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