Single-cell analysis using Multiple Kernel Learning
Project description
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:
conda create -n scMKL python=3.12
conda activate scMKL
conda install -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.13
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 (scMET) | 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:
- Taking an existing
AnnData.anndataobject and formatting it for scMKL to train and test on.
import scmkl
import numpy as np
import anndata as ad
# Read in feature grouping dictionary (e.g. geneset library for RNA)
group_dict = np.load('your_grouping.pkl', allow_pickle=True)
# Read in your AnnData.anndata obj
adata = ad.read_h5ad('your_adata.h5ad')
# 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
)
- Reading in data separately and creating an scMKL formatted
AnnData.anndataobject.
import scmkl
import numpy as np
# Read in feature grouping dictionary (e.g. geneset library for RNA)
group_dict = np.load('your_grouping.pkl', allow_pickle=True)
# Read in feature names
var_names = np.load('your_feature_names.npy')
# 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
)
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, ect... To learn more about accessing this data, see our GitHub Pages.
Links
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file scmkl-0.4.3.tar.gz.
File metadata
- Download URL: scmkl-0.4.3.tar.gz
- Upload date:
- Size: 76.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94ed6bfc2093c6215d6175531182ec43b27dd1483168eede142fbd40182e5739
|
|
| MD5 |
8f4fc2a83fb1490b486825fbbc1f7153
|
|
| BLAKE2b-256 |
6ec1fe3c57a180c093fb1d255b517a926e0e471ed837c8e523ec257e10f63b48
|