scNoah#

Benchmarking cell type annotation and modality prediction.

Balance dataset#

Balancing dataset using your own annotation for future model training. Oversmaple or undersample some cell types.

scnoah.balance

Balance cell types by undersampling large classes and oversampling small classes with PCA-based synthetic-cell interpolation.

scnoah.oversample

Oversample underrepresented cell types in an AnnData object using PCA-based interpolation.

scnoah.undersample

Undersample overrepresented cell types in an AnnData object.

Annotation metrics#

Test annotation method quality using confusion matrix, accuracy, balanced accuracy and calculating cell type specific precision, recall (also called sensitivity), specificity, f1-score, geometric mean, and index balanced accuracy of the geometric mean.

scnoah.report_classif_full

Returns metrics (precision, recall (also called sensitivity), specificity, f1-score, geometric mean, and index balanced accuracy of the geometric mean) of predicted cell types.

scnoah.report_classif_sens_spec

Returns specificity and recall (also called sensitivity) metrics of predicted cell types.

scnoah.conf_matrix

Compute confusion matrix to evaluate the accuracy of a classification.

scnoah.pred_status

Find correct and incorrect predictions.

Regression metrics#

Test modality prediction method quality using error metrics (RMSE, MedianAE, MeanAE), EVS, R² score, PCC, SCC and KTCC. Also, visualise metrics on cell embeddings.

RMSE - Root mean squared error, MeanAE - Mean absolute error, MedianAE - Median absolute error, EVS - Explained variance score, R² score - Coefficient of determination, PCC - Pearson correlation coefficient, SCC - Spearman correlation coefficient, KTCC - Kendall tau correlation coefficient.

For error metrics (RMSE, MedianAE, MeanAE): lower value - better prediction

scnoah.report_reg

Returns multiple metrics of cell surface proteins prediction.

scnoah.regres_status

Compute regression status of cells to visualize on UMAP.

scnoah.pearson_coef

Compute Pearson correlation coefficient of predicted feature.

scnoah.spearman_coef

Compute Spearman correlation coefficient of predicted feature.

scnoah.kendalltau_coef

Compute Kendall’s tau, a correlation measure of predicted feature.

Count cells#

Count number of cell types per sample or condition.

scnoah.cell_counter

Count cell types in samples.

Explanations#

Get explanations of gene importances in scAdam model prediction.

scnoah.explain

Compute SHAP explanations for the predicted probability of one cell type.

scnoah.feature_importance_df

Create a feature-importance table from SHAP explanations.

Managing large datasets#

Get fraction of large dataset.

scnoah.get_frac

Return a random subset of an AnnData object.

scnoah.get_samples

Get samples from AnnData object.

Difference between clusters#

Calculate Integral of absolute density difference and Mutual Information between two clusterings.

scnoah.clust_diff

Calculates metrics to Integral of absolute density difference and Mutual Information between two clusterings.