| Crates.io | single_rust |
| lib.rs | single_rust |
| version | 0.5.8 |
| created_at | 2024-08-13 13:53:46.465387+00 |
| updated_at | 2025-11-24 13:41:21.942686+00 |
| description | Single-cell analysis in Rust |
| homepage | https://singlerust.com |
| repository | https://github.com/SingleRust/SingleRust |
| max_upload_size | |
| id | 1336069 |
| size | 363,086 |
Welcome to Single Rust π, a pioneering library for the Rust programming language, focused on the future of production-grade, high-throughput analysis pipelines for single-cell data. SingleRust leverages Rust's fearless concurrency model to transition single-cell data analysis from initial prototyping to robust, scalable deployments.
SingleRust is in active development with substantial core functionality implemented:
Add SingleRust to your Cargo.toml:
[dependencies]
single_rust = "0.5.6"
use single_rust::io;
use single_rust::memory::processing::{normalize_expression, log1p_expression};
use single_rust::memory::processing::hvg::compute_highly_variable_genes;
use single_rust::memory::processing::diffexp::{rank_gene_groups, CorrectionMethod};
use single_rust::memory::statistics::qc::qc_metrics;
use single_utilities::types::Direction;
// Load data and run complete analysis pipeline
let adata = io::read_h5ad_memory("path/to/data.h5ad")?;
qc_metrics(&adata)?; // Quality control
log1p_expression(&adata.x(), None)?; // Log1p normalization
normalize_expression(&adata.x(), 10_000, &Direction::ROW, None)?; // Normalize to 10k
compute_highly_variable_genes(&adata, None)?; // Find HVGs
// Differential expression analysis
rank_gene_groups(&adata, "cell_type", Some("rest"), None, None, None,
Some(100), CorrectionMethod::BejaminiHochberg, None, None)?;
Robust statistical testing for identifying differentially expressed genes between cell populations:
// Compare cell types using Mann-Whitney test
use single_statistics::testing::TestMethod;
rank_gene_groups(&adata, "cell_type", Some("T_cells"), Some(&["B_cells"]),
Some("comparison"), Some(TestMethod::MannWhitney), Some(50),
CorrectionMethod::BejaminiHochberg, Some(true), Some(1.0))?;
// Complete QC and feature selection workflow
use single_rust::shared::HVGParams;
qc_metrics(&adata)?;
compute_highly_variable_genes(&adata, Some(HVGParams {
n_top_genes: Some(2000), ..Default::default()
}))?;
// PCA with HVG feature selection
use single_rust::memory::processing::dimred::{FeatureSelectionMethod, pca::run_pca_sparse_masked};
let pca_result = run_pca_sparse_masked::<f64>(&adata.x(),
Some(FeatureSelectionMethod::HighlyVariableSelection(hvg_mask)),
Some(true), None, Some(50), None, Some(42), None)?;
Rather than implementing visualization directly in Rust, SingleRust focuses on computation while enabling visualization through data exports:
This approach combines Rust's performance benefits for computation with the rich visualization ecosystems of Python and R.
Comprehensive documentation with API docs (cargo doc --open) and scientific context for all modules.
Contributions welcome! Areas needing development: algorithm implementations, performance optimization, testing, and documentation. See issues for specific needs.
SingleRust is distributed under the BSD 3-Clause License, ensuring it remains free and open for all to use and contribute to.
For inquiries, suggestions, or expressions of interest in contributing, please open an issue on our GitHub repository or reach out directly via email.
This library is still in active development and highly unoptimized in some areas. If you want to contribute, please go for it! We especially welcome help in performance optimization, test coverage, and documentation.