rrblup-rs

Crates.iorrblup-rs
lib.rsrrblup-rs
version0.1.0
created_at2025-12-12 03:25:57.910631+00
updated_at2025-12-12 03:25:57.910631+00
descriptionRust implementation of R/rrBLUP package for mixed model analysis
homepagehttps://github.com/alex-sandercock/Binx/tree/main/crates/rrblup-rs
repositoryhttps://github.com/alex-sandercock/Binx
max_upload_size
id1980949
size112,876
Alexander Sandercock (alex-sandercock)

documentation

https://docs.rs/rrblup-rs

README

rrblup-rs

A Rust implementation of rrBLUP for mixed model solving and genomic prediction. Based on R/rrBLUP version 4.6.3.

This is a library crate.

For GWAS workflows, see gwaspoly-rs (which uses this crate) or the Binx CLI (binx gwas) for a complete command-line interface.

Features

  • mixed_solve() - REML-based mixed model solver
  • a_mat() - Additive relationship matrix computation
  • kin_blup() - Genomic BLUP with kinship matrix
  • Faithful port of R/rrBLUP algorithms

Usage

use rrblup_rs::{mixed_solve_reml, MixedSolveOptions};
use nalgebra::DMatrix;

let y = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let x = DMatrix::from_row_slice(5, 1, &[1.0, 1.0, 1.0, 1.0, 1.0]); // intercept

let result = mixed_solve_reml(&y, Some(&x), None, MixedSolveOptions::default())?;
println!("Vu: {}, Ve: {}", result.vu, result.ve);

Benchmarks

mixed.solve with marker matrix Z

Varying markers (n=500 genotypes):

Markers (m) R (ms) Rust (ms) Speedup
1,000 1,014 532 1.9x
5,000 2,447 706 3.5x
10,000 4,222 1,000 4.2x
20,000 7,841 1,604 4.9x

Varying genotypes (m=10,000 markers):

Genotypes (n) R (ms) Rust (ms) Speedup
100 159 31 5.1x
200 638 117 5.5x
500 4,237 936 4.5x
1,000 19,937 5,960 3.3x

kin.blup

n_geno R (ms) Rust (ms) Speedup
100 93 54 1.7x
200 704 474 1.5x

Summary: Rust is 3-5x faster for marker-based workflows, with advantages growing as problem size increases.

Citation

If you use rrblup-rs, please cite the original R/rrBLUP paper:

Endelman, J.B. (2011). Ridge regression and other kernels for genomic selection with R package rrBLUP. The Plant Genome 4:250-255.

This crate is a Rust reimplementation of mixed.solve and related functionality. For a command-line interface, see Binx.

Related Crates

  • gwaspoly-rs - GWASpoly implementation (uses this crate)
  • binx-cli - User-facing CLI for GWAS workflows

License

GPL-3.0-or-later

Commit count: 0

cargo fmt