| Title: | 'Rust' Native Kernels for 'Seurat' |
|---|---|
| Description: | Provides 'Rust' implementations of performance-critical 'Seurat' native routines such as log-normalization, sparse row scaling, shared nearest-neighbor graph construction, and integration helpers. Install alongside 'Seurat' to use the same function signatures with a 'Rust' backend. Builds require 'Cargo' and 'rustc' (>= 1.81); CRAN source builds include offline crate sources under 'src/rust'. |
| Authors: | Nebil Ibrahim [aut, cre], Rahul Satija [ctb] (Original Seurat native APIs), Satija Lab and Collaborators [cph] (Original Seurat / ModularityOptimizer code) |
| Maintainer: | Nebil Ibrahim <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.5 |
| Built: | 2026-09-27 08:27:12 UTC |
| Source: | https://github.com/NebilI/seurust |
Rust/extendr reimplementation matching Seurat's native API for ComputeSNN.
ComputeSNN(nn_ranked, prune)ComputeSNN(nn_ranked, prune)
nn_ranked |
Matrix of 1-based neighbor indices (cells x k); integer or double. |
prune |
Numeric threshold. |
A dgCMatrix SNN graph.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for DirectSNNToFile.
Computes the SNN graph as ComputeSNN does and writes its lower
triangle to filename in the same tab-separated format as
WriteEdgeFile.
DirectSNNToFile(nn_ranked, prune, display_progress, filename)DirectSNNToFile(nn_ranked, prune, display_progress, filename)
nn_ranked |
Matrix of 1-based neighbor indices (cells x k); integer or double. |
prune |
Numeric pruning threshold. |
display_progress |
Logical. |
filename |
Output path. |
The SNN graph as a dgCMatrix, as returned by Seurat.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for fast_dist.
fast_dist(x, y, n)fast_dist(x, y, n)
x, y
|
Numeric matrices of embeddings with the same number of columns (cells in rows). |
n |
A list with one element per row of |
A list the same length (and with the same names) as n, holding
the distances in the same order as the neighbor indices. An empty list if
length(n) != nrow(x), matching Seurat.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastCov.
FastCov(mat, center = TRUE)FastCov(mat, center = TRUE)
mat |
Numeric matrix. |
center |
Logical. |
A covariance matrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastCovMats.
FastCovMats(mat1, mat2, center = TRUE)FastCovMats(mat1, mat2, center = TRUE)
mat1, mat2
|
Numeric matrices. |
center |
Logical. |
A cross-covariance matrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastExpMean.
FastExpMean(mat, display_progress)FastExpMean(mat, display_progress)
mat |
A dgCMatrix. |
display_progress |
Logical. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastLogVMR.
FastLogVMR(mat, display_progress)FastLogVMR(mat, display_progress)
mat |
A dgCMatrix. |
display_progress |
Logical. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastRBind.
FastRBind(mat1, mat2)FastRBind(mat1, mat2)
mat1, mat2
|
Numeric matrices. |
A row-bound numeric matrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastSparseRowScale.
FastSparseRowScale( mat, scale = TRUE, center = TRUE, scale_max = 10, display_progress = TRUE )FastSparseRowScale( mat, scale = TRUE, center = TRUE, scale_max = 10, display_progress = TRUE )
mat |
A dgCMatrix. |
scale, center
|
Logical. |
scale_max |
Numeric. |
display_progress |
Logical. |
Dense numeric matrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FastSparseRowScaleWithKnownStats.
FastSparseRowScaleWithKnownStats( mat, mu, sigma, scale = TRUE, center = TRUE, scale_max = 10, display_progress = TRUE )FastSparseRowScaleWithKnownStats( mat, mu, sigma, scale = TRUE, center = TRUE, scale_max = 10, display_progress = TRUE )
mat |
A dgCMatrix. |
mu, sigma
|
Row means and sds. |
scale, center
|
Logical. |
scale_max |
Numeric. |
display_progress |
Logical. |
Dense numeric matrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for FindWeightsC.
FindWeightsC( cells2, distances, anchor_cells2, integration_matrix_rownames, cell_index, anchor_score, min_dist, sd, display_progress )FindWeightsC( cells2, distances, anchor_cells2, integration_matrix_rownames, cell_index, anchor_score, min_dist, sd, display_progress )
cells2, anchor_cells2, integration_matrix_rownames
|
Character vectors. |
distances, anchor_score, min_dist, sd
|
Numeric. |
cell_index |
Integer. |
display_progress |
Logical. |
A dgCMatrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for GraphToNeighborHelper.
Reads each row of mat (cell k's neighbors are the non-zero
columns of row k), exactly like Seurat. Every row must have the same
number of non-zero entries.
GraphToNeighborHelper(mat)GraphToNeighborHelper(mat)
mat |
Sparse adjacency matrix (cells x cells), |
An unnamed list of two nrow(mat) x k numeric matrices:
1-based neighbor indices and the corresponding distances, both sorted by
increasing distance.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for IntegrateDataC.
IntegrateDataC(integration_matrix, weights, expression_cells2)IntegrateDataC(integration_matrix, weights, expression_cells2)
integration_matrix, weights, expression_cells2
|
Sparse matrices. |
A dgCMatrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for LogNorm.
LogNorm(data, scale_factor, display_progress = TRUE)LogNorm(data, scale_factor, display_progress = TRUE)
data |
A dgCMatrix of counts. |
scale_factor |
Numeric scale factor. |
display_progress |
Logical. |
A log-normalized dgCMatrix.
Nebil Ibrahim [email protected]
## Not run: library(Matrix) mat <- sparseMatrix(i = c(1, 3, 2), j = c(1, 2, 3), x = 1:3, dims = c(3, 3)) LogNorm(mat, scale_factor = 1e4, display_progress = FALSE) ## End(Not run)## Not run: library(Matrix) mat <- sparseMatrix(i = c(1, 3, 2), j = c(1, 2, 3), x = 1:3, dims = c(3, 3)) LogNorm(mat, scale_factor = 1e4, display_progress = FALSE) ## End(Not run)
Rust/extendr reimplementation matching Seurat's native API for ReplaceColsC.
ReplaceColsC(mat, col_idx, replacement)ReplaceColsC(mat, col_idx, replacement)
mat |
A dgCMatrix. |
col_idx |
Integer column indices. |
replacement |
A dgCMatrix. |
A dgCMatrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for row_mean_dgcmatrix.
row_mean_dgcmatrix(x, i, rows, cols)row_mean_dgcmatrix(x, i, rows, cols)
x |
Numeric values. |
i |
Integer row indices. |
rows, cols
|
Dimensions. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for row_sum_dgcmatrix.
row_sum_dgcmatrix(x, i, rows, cols)row_sum_dgcmatrix(x, i, rows, cols)
x |
Numeric values. |
i |
Integer row indices. |
rows |
Number of rows. |
cols |
Number of columns. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for row_var_dgcmatrix.
row_var_dgcmatrix(x, i, rows, cols)row_var_dgcmatrix(x, i, rows, cols)
x |
Numeric values. |
i |
Integer row indices. |
rows, cols
|
Dimensions. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for RowMergeMatrices.
Seurat's C++ entry point only accepts row-compressed (RsparseMatrix)
inputs and errors on a dgCMatrix. This version accepts either layout
(or any coercible matrix) and converts to row-compressed form first; for
RsparseMatrix inputs the result is identical to Seurat's.
RowMergeMatrices(mat1, mat2, mat1_rownames, mat2_rownames, all_rownames)RowMergeMatrices(mat1, mat2, mat1_rownames, mat2_rownames, all_rownames)
mat1, mat2
|
Sparse matrices, preferably row-compressed ( |
mat1_rownames, mat2_rownames, all_rownames
|
Character vectors. |
A dgCMatrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for RowVar.
RowVar(x)RowVar(x)
x |
Numeric matrix. |
Numeric vector of row variances.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for RunModularityClusteringCpp.
RunModularityClusteringCpp( SNN, modularityFunction = 1, resolution = 1, algorithm = 1, nRandomStarts = 1, nIterations = 1, randomSeed = 0, printOutput = FALSE, edgefilename = "" )RunModularityClusteringCpp( SNN, modularityFunction = 1, resolution = 1, algorithm = 1, nRandomStarts = 1, nIterations = 1, randomSeed = 0, printOutput = FALSE, edgefilename = "" )
SNN |
Sparse SNN graph. |
modularityFunction, algorithm, nRandomStarts, nIterations, randomSeed
|
Integers. |
resolution |
Numeric. |
printOutput |
Logical. |
edgefilename |
Optional path. |
Integer cluster assignments.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for RunUMISampling.
RunUMISampling(data, sample_val, upsample = FALSE, display_progress = TRUE)RunUMISampling(data, sample_val, upsample = FALSE, display_progress = TRUE)
data |
A dgCMatrix. |
sample_val |
Numeric. |
upsample |
Logical. |
display_progress |
Logical. |
A dgCMatrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for RunUMISamplingPerCell.
RunUMISamplingPerCell(data, sample_val, upsample = FALSE, display_progress = TRUE)RunUMISamplingPerCell(data, sample_val, upsample = FALSE, display_progress = TRUE)
data |
A dgCMatrix. |
sample_val |
Numeric. |
upsample |
Logical. |
display_progress |
Logical. |
A dgCMatrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for ScoreHelper.
ScoreHelper( snn, query_pca, query_dists, corrected_nns, k_snn, subtract_first_nn, display_progress )ScoreHelper( snn, query_pca, query_dists, corrected_nns, k_snn, subtract_first_nn, display_progress )
snn |
Sparse SNN graph. |
query_pca, query_dists, corrected_nns
|
Numeric inputs. |
k_snn |
Integer. |
subtract_first_nn, display_progress
|
Logical. |
Numeric scores.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for SNN_SmallestNonzero_Dist.
SNN_SmallestNonzero_Dist(snn, mat, n, nearest_dist)SNN_SmallestNonzero_Dist(snn, mat, n, nearest_dist)
snn |
Sparse SNN graph. |
mat |
Numeric matrix. |
n |
Integer. |
nearest_dist |
Numeric vector. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for SparseRowVar.
SparseRowVar(mat, display_progress)SparseRowVar(mat, display_progress)
mat |
A dgCMatrix. |
display_progress |
Logical. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for SparseRowVar2.
SparseRowVar2(mat, mu, display_progress)SparseRowVar2(mat, mu, display_progress)
mat |
A dgCMatrix. |
mu |
Row means. |
display_progress |
Logical. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for SparseRowVarStd.
SparseRowVarStd(mat, mu, sd, vmax, display_progress)SparseRowVarStd(mat, mu, sd, vmax, display_progress)
mat |
A dgCMatrix. |
mu |
Row means. |
sd |
Row sds. |
vmax |
Clip value. |
display_progress |
Logical. |
Numeric vector.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for Standardize.
Standardize(mat, display_progress = TRUE)Standardize(mat, display_progress = TRUE)
mat |
Numeric matrix. |
display_progress |
Logical. |
A numeric matrix.
Nebil Ibrahim [email protected]
Rust/extendr reimplementation matching Seurat's native API for WriteEdgeFile.
WriteEdgeFile(snn, filename, display_progress)WriteEdgeFile(snn, filename, display_progress)
snn |
Sparse SNN graph. |
filename |
Path. |
display_progress |
Logical. |
Invisibly returns NULL.
Nebil Ibrahim [email protected]