Skip to main content


PyPI PyPI Downloads Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge

Single-cell analysis using Multiple Kernel Learning, scMKL, is a binary classification algorithm utilizing prior information to group features to enhance classification and aid understanding of distinguishing features in omic and multi-omic data sets.

We have demonstrated scMKL's ability to achieve high classification performance while providing the added confidence of model interpretability on single-cell RNA, ATAC, ADT, and methylation data.

Installation

Conda install

Conda is the recommended method to install scMKL and Python version must be '>=3.11.1,<=3.13':

conda create -n scmkl_env -c conda-forge -c bioconda ivango17::scmkl

Ensure bioconda and conda-forge are in your available conda channels.

Pip install

First, create a virtual environment with 'python>=3.11.1,<=3.13'.

Then, install scMKL with:

# activate your new env with python>=3.11.1 and <3.14
pip install scmkl

If wheels do not build correctly, ensure gcc and g++ are installed and up to date. They can be installed with sudo apt install gcc and sudo apt install g++.

Usage

The table below shows what type of data scMKL expects based on the modality in question. In all situations, matrices should be cells x features.

Modality Input matrix description
Transcriptomics (RNA) Counts matrix
Chromatin Accessibility (ATAC) Binarized counts matrix (any counts more than 0 become 1)
Epitope (ADT) Counts matrix
Methylomics (MET) Aggregated methylation over windows (e.g. mean methylation per genomics window)

Additionally, scMKL requires a feature grouping dictionary where each key, value pair is represented as 'group1': ['feature1', 'feature2', 'feature7']. Features can be genes for RNA, regions for ATAC and MET, or proteins for ADT. Any number of groups can be used and features can be overlapping between groups (e.g. 'feature1' is in five groups). For help getting feature groupings, see our notebooks in examples.

scMKL implements AnnData.anndata objects in one of two ways:

  1. Taking an existing AnnData.anndata object and formatting it for scMKL to train and test on.
import scmkl
import numpy as np
import anndata as ad

# Read in your AnnData.anndata obj
adata = ad.read_h5ad('your_adata.h5ad')

# Read in feature grouping dictionary (e.g. geneset library for RNA)
group_dict = np.load('your_grouping.pkl', allow_pickle=True)
# or for RNA, pull a gene set from the internet with 
group_dict = scmkl.get_gene_groupings('Azimuth_2021', organism='human')

# Apply scmkl formatting where 'phenotype_obs_key' is the col name in obs 
# for labels, can also be an array of labels and set `allow_multiclass` to 
# true if there are more than two cell classes 
adata = scmkl.format_adata(
    adata, 
    cell_labels='phenotype_obs_key', 
    group_dict=group_dict,
    allow_multiclass=True
    )
  1. Reading in data separately and creating an scMKL formatted AnnData.anndata object.
import scmkl
import numpy as np

# Read in feature names
var_names = np.load('your_feature_names.npy')

# Read in feature grouping dictionary (e.g. geneset library for RNA)
group_dict = np.load('your_grouping.pkl', allow_pickle=True)
# or for RNA, pull a gene set from the internet with
group_dict = scmkl.get_gene_groupings('Azimuth_2021', organism='human')

# Read in cell labels
obs = np.load('your_cell_labels.npy')

# Read in data matrix (can also be a scipy.sparse matrix)
mat = np.load('your_matrix.npy')

# Create scMKL formatted AnnData.anndata and set `allow_multiclass` to true 
# if there are more than two cell classes 
adata = scmkl.create_adata(
    data_mat, 
    feature_names=gene_names, 
    group_dict=group_dict,
    allow_multiclass=True
    )

If you are not using RNA data and do not have a grouping dictionary but want to try scMKL on your dataset, you can create a random grouping with:

# Assuming feature names and numpy are loaded
n_groups = 50
group_size = 25
grouping_dict = {f'group_{i}': np.random.choice(
                                   var_names, 
                                   size=group_size, 
                                   replace=False
                                   ) 
                    for i in range(n_groups)}

Then, depending on whether or not your labels are binary, train and test your model.

For binary:

results = scmkl.run(adata)

For multiclass:

results = scmkl.one_v_rest(
    adata, 
    names=['RNA']
    )

Both of these functions return a dictionary with evaluation metrics, group weights, etc... To learn more about accessing this data, see our GitHub Pages.

Repo: https://github.com/ohsu-cedar-comp-hub/scMKL

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

Anaconda: https://anaconda.org/ivango17/scmkl

API: https://ohsu-cedar-comp-hub.github.io/scMKL/

Publication

If you use scMKL in your research, please cite using:

Kupp, S., VanGordon, I., Gönen, M., Esener, S., Eksi, S., Ak, C. Interpretable and integrative analysis of single-cell multiomics with scMKL. Commun Biol 8, 1160 (2025). https://doi.org/10.1038/s42003-025-08533-7

Our Shiny for Python application for viewing data produced from this work can be found here: scMKL_analysis

Issues

Please report bugs here.

Metadata

Release files for scmkl 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scmkl 0.5.1
File Size Uploaded Provenance Actions
scmkl-0.5.1.tar.gz 75.9 kB Without provenance Details for scmkl-0.5.1.tar.gz

Release files / scmkl-0.5.1.tar.gz

Download URL scmkl-0.5.1.tar.gz
Size 75.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ee091f9070bf1b25c6f3a66a437a7c75d66d2c50b879242f5dcf1fb41770e4ff
BLAKE2b-256 checksum
How to use checksums
b5356336d3df2b88b1a30597b9c85d17e098ac03ad636a100f4086ecdfb53d5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for scmkl 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page