miRPredictor
Predict miRNA expression from single-cell RNA-seq counts using neuropromotion's TabPack, TabM and XGBoost ensembles, with optimized preprocessing and cached model runners. Python 3.12+.
pip install mirpredictor==0.1.2
From source:
pip install .
The compatible TabPack inference layers are included privately in the package. The default installation includes the model dependencies. No Git clone, external TabPack installation, or PYTHONPATH editing is needed. The model architecture is taken from the historical version used to create the weights; updating the external TabPack repository will not change it.
import anndata as ad
from mirpredictor import miRPredictor
adata = ad.read_h5ad("input.h5ad") # raw counts in X, layers['counts'], or raw
predictor = miRPredictor(device="cpu")
print(predictor.check_assets()) # reports missing HF files before downloading weights
result = predictor.predict(adata, groupby="CellType", embedding_key="X_pca_harmony")
print(predictor.last_timings)
result.write_h5ad("predicted.h5ad")
predictor.close()
device="cuda" uses a CUDA GPU when available. Reuse one predictor for multiple
datasets to reuse loaded models. cache_models=False avoids keeping all model
weights in RAM. Models are on CPU between predictions by default; GPU residency
can be requested using keep_models_on_device=True.
predict(..., fast=False) uses the reference preprocessing and uncached model
execution for comparison. predict_csv retains the reference CSV/parquet API.
Both paths share upstream gene mapping, robustness thresholds, target panels,
and output conventions. AnnData is copied unless inplace=True.
Model files and offline use
Only stack JSONs and the base models with nonzero stack coefficients (or the
selected fallback model) are downloaded, at a pinned HF revision. Training
datasets/checkpoints/predictions are excluded. HF's xgb/ maps to local
xgb_optuna/. Use cache_dir=..., models_root=..., local_files_only=True,
and revision=... as needed. An explicit models_root uses the upstream layout:
tabpack/<miRNA>/, tabm/<miRNA>/, xgb_optuna/<miRNA>/, and
ensemble/tabpack_tabm_xgb_stack/weights/<miRNA>.json.
check_assets(mirnas=[...]) inspects the remote manifest and stack weights,
without downloading tensor weights. Missing base models raise an explicit
error; the package does not silently change the ensemble.
The complete paginated HF listing contains XGBoost models for all 312 targets.
All 159 configured inference targets have their required ensemble artifacts.
The K1 reference is distributed separately on Kaggle:
https://www.kaggle.com/datasets/ismailovaly/mirna-prediction-project
under sc_TRAIN/X_TRAIN_K1.parquet. It is downloaded automatically on the first
K1 prediction and cached, pinned to Kaggle dataset version 4 (138 MB). K2–K10
never download it. You can supply a local copy with knn_ref_path. With
local_files_only=True, missing cached files raise a clear error and no
network requests are made. Failed or incomplete reference downloads are not
promoted into the cache.
Implementation and validation
The package uses private relative imports and does not depend on the training
directory or manipulate global constants modules. The bundled model
architecture preserves the original TabPack checkpoint layout.
Version 0.1.2 includes the updated robustness configuration and feature weights
from upstream commit 05a2708fcf4dd6bf07ffd2529f135ff639109bc7. All data paths
inside the supplied robustness configuration are relative to installed package
resources.
Preprocessing equivalence, robustness filtering, reference caching, and artifact selection are covered by 22 tests. Model runners have also been checked against real TabPack, TabM and XGBoost weights on CPU. A full real-data evaluation across all 159 targets and a CUDA validation remain separate from these checks.
The K1 download endpoint was verified, but full transfer from Google Storage
could not be completed in the validation environment; use knn_ref_path when
network policy prevents automatic downloads.
Source provenance is recorded in provenance.json and
THIRD_PARTY_NOTICES.md. No additional license grant for upstream source is
asserted by this package.
To run tests from a source checkout:
pip install '.[test]'
python -m pytest
Metadata
Release files for mirpredictor 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mirpredictor-0.1.2.tar.gz | 3.1 MB | Without provenance | Details for mirpredictor-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mirpredictor-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mirpredictor-0.1.2-py3-none-any.whl |
Total release size: 6.3 MB
Release files / mirpredictor-0.1.2.tar.gz
| Download URL | mirpredictor-0.1.2.tar.gz |
|---|---|
| Size | 3.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c28b5b52faaf909fc5ed15cfe03a067295275ba79c0d66a503d54a3f0053e00
|
|
BLAKE2b-256 checksum How to use checksums |
6d6aba0b54c63d10f61adfc3e310879f414fcc75127dd4cf0b1391ed21eed868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0
|
Release files / mirpredictor-0.1.2-py3-none-any.whl
| Download URL | mirpredictor-0.1.2-py3-none-any.whl |
|---|---|
| Size | 3.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
634815b6463f653c26e27867ae014707f616f0bc32aa4a2b5c0ad68bccaf0d00
|
|
BLAKE2b-256 checksum How to use checksums |
9cbb59546b8d19e1a237b1736ea4b08123c13ec28ca6d0dab8a984ac098de1b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0
|
Security for mirpredictor 0.1.2
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.