RIsearch for Python¶
RIsearch predicts RNA and DNA interactions: RNA-RNA, DNA-DNA and RNA-DNA hybrids. You give it query sequences, such as miRNAs or siRNAs, and a set of targets, such as a transcriptome. It reports every duplex whose predicted free energy is at or below a threshold, with coordinates, strand, energy and the pairing pattern, as a Polars DataFrame.
This package wraps the same Rust library as the risearch command-line tool, a rewrite of RIsearch2.
It is a pre-release: options and output may still change before 3.0.0.
Installation¶
or uv add risearch.
Wheels are built for Linux x86_64 (manylinux) and macOS on Apple Silicon, for every supported Python version.
On other platforms pip builds from the source distribution, which needs Rust 1.88 or newer.
On older x86-64 CPUs, or x86-64 Python running under Rosetta, install the compatibility Polars runtime; the module is still imported as polars:
The package does not install the risearch command-line program; its releases ship prebuilt binaries.
Quick start¶
The following example requires you to have cloned the github repository to run
import risearch
risearch.index("tests/data/target.fa", "targets.idx") # build once
targets = risearch.TargetRegistry.open("targets.idx") # reuse for every search
hits = risearch.search("tests/data/query.fa", targets)
hits is a polars DataFrame with one row per interaction.
With the example in the repository, two human miRNAs against the 19 transcripts of RHOC in tests/data:
>>> hits.sort("energy", "target_name", "t_start").select(
... "query_name", "target_name", "t_start", "t_end", "strand", "energy"
... ).head(3)
shape: (3, 6)
┌────────────────────────────┬─────────────────────────────────┬─────────┬───────┬────────┬──────────┐
│ query_name ┆ target_name ┆ t_start ┆ t_end ┆ strand ┆ energy │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ u64 ┆ u64 ┆ str ┆ f64 │
╞════════════════════════════╪═════════════════════════════════╪═════════╪═══════╪════════╪══════════╡
│ hsa-miR-24-3p MIMAT0000080 ┆ ENSG00000155366|ENST00000527563 ┆ 481 ┆ 505 ┆ + ┆ -25.3257 │
│ hsa-miR-24-3p MIMAT0000080 ┆ ENSG00000155366|ENST00000285735 ┆ 305 ┆ 322 ┆ + ┆ -23.0914 │
│ hsa-miR-24-3p MIMAT0000080 ┆ ENSG00000155366|ENST00000285735 ┆ 1373 ┆ 1398 ┆ - ┆ -21.7137 │
└────────────────────────────┴─────────────────────────────────┴─────────┴───────┴────────┴──────────┘
Coordinates are 0-based and inclusive, unlike the 1-based CLI output. The row order can change from run to run, so sort when you need a stable order.
The API documentation covers every function and option. A short guide covers the result columns, the energy models and logging.
Citation¶
If you use RIsearch, please cite:
Roncelli S, Favaro L, Anthon C, Gorodkin J. RIsearch and siOFF: An integrated, high-performance framework for RNA-RNA interaction and siRNA off-target prediction. Bioinformatics.