Skip to content

omics-rust/rsomics-vlr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rsomics-vlr

Variation log-ratio (VLR), the proportionality metric for compositional data, as a single fast CLI. Equivalent to skbio.stats.composition.vlr and skbio.stats.composition.pairwise_vlr.

For two features i, j measured across samples,

VLR(i, j) = Var_samples( log x_i - log x_j )

with the given ddof. VLR is small when two features are proportional (their log-ratio is near-constant), so it is the compositional companion to correlation and to the rsomics-clr / rsomics-ilr transforms. Per-sample closure cancels in the log-difference, so it is omitted — the metric is scale-invariant.

rsomics-vlr table.tsv [--ddof 1] [--robust] [--pair i,j] [-o vlr.tsv]
  • table.tsv — composition table: header row of feature IDs (corner cell ignored), then one sample_id value... line per sample.
  • --ddof — degrees of freedom for the sample variance (default 1, as skbio).
  • --pair i,j — emit a single VLR value for the 0-based feature pair instead of the full matrix.
  • --robust — mask samples with a zero in either feature (skbio's _robust_vlr); available with --pair only, matching skbio (pairwise robust is not defined).

Default output is the full feature×feature VLR matrix: a feature header of IDs, then one id<TAB>value... row per feature. Use --csv for comma-separated I/O.

Origin

This crate is an independent Rust reimplementation of skbio.stats.composition.vlr / pairwise_vlr based on:

  • Lovell D, Pawlowsky-Glahn V, Egozcue JJ, Marguerat S, Bähler J (2015) Proportionality: A Valid Alternative to Correlation for Relative Data. PLoS Comput Biol 11(3): e1004075. DOI: 10.1371/journal.pcbi.1004075
  • Erb I, Notredame C (2016) How should we measure proportionality on relative gene expression data? Theory Biosci. 135, 21-36. DOI: 10.1007/s12064-015-0220-8
  • The scikit-bio implementation (Modified BSD License), read and cited: pairwise_vlr computes the matrix from np.cov of the log-transformed table via VLR = -2·cov + diag + diagᵀ. We use the same covariance identity, computing only the lower triangle of the Gram matrix Xcᵀ Xc of the centred log columns.

VLR values are value-exact vs scikit-bio to ~1e-9 (tests/compat.rs diffs both a committed skbio-captured golden and a live skbio.stats.composition run, covering the pairwise matrix, the single-pair value, and the robust zero-masking path).

License: MIT OR Apache-2.0. Upstream credit: scikit-bio https://scikit-bio.org/ (Modified BSD License).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors