Skip to main content

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.10+.

pip install mirpredictor==0.1.3

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.3 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, passing independently on Python 3.10.22 and 3.11.18. Model runners were checked on both versions against predictions from the original TabPack, TabM and XGBoost loaders using real weights on CPU. The maximum absolute difference was 4.77e-7; an end-to-end AnnData check matched exactly. A full real-data evaluation across all 159 targets and a CUDA validation remain separate from these checks.

Python 3.10 support replaces newer type-alias and tensor-indexing syntax with equivalent expressions. Model architectures, weights and robustness thresholds are unchanged. Python versions older than 3.10 are not supported.

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.3

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

Source distribution (sdist)

Source distribution for mirpredictor 0.1.3
File Size Uploaded Provenance Actions
mirpredictor-0.1.3.tar.gz 3.1 MB Without provenance Details for mirpredictor-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mirpredictor 0.1.3
File Interpreter ABI Platform Actions
mirpredictor-0.1.3-py3-none-any.whl Python 3 none any Details for mirpredictor-0.1.3-py3-none-any.whl

Total release size: 6.3 MB

Release files / mirpredictor-0.1.3.tar.gz

Download URL mirpredictor-0.1.3.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
225f08279958dd1b4086c39b522842064e6f45c035e0025bc95539e91045eb4a
BLAKE2b-256 checksum
How to use checksums
f2edac699099eb5fd50785b954e3263a77027ccab692172f49b6242a400a6a37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0

Release files / mirpredictor-0.1.3-py3-none-any.whl

Download URL mirpredictor-0.1.3-py3-none-any.whl
Size 3.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1805c76992d06833389e0ec215efee45910fa97dfa9ba09fb6db25e1600a987f
BLAKE2b-256 checksum
How to use checksums
7605a8ffc97653c4856fd50147935bd1ef7bf89e799d19129739b691e80a3d97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0

Security for mirpredictor 0.1.3

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.

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