Detection and Spatial Analysis of Tertiary Lymphoid Structures
Overview
Fast, reproducible detection and quantitative analysis of tertiary lymphoid structures (TLS) in multiplexed tissue imaging. Implements Independent Component Analysis Trace (ICAT) index, local Ripley's K scanning, automated K Nearest Neighbor (KNN)-based TLS detection, and T-cell clusters identification as described in Amiryousefi et al. (2025) doi:10.1101/2025.09.21.677465.
Breaking changes
scan_clustering()— completely redesigned. The function no longer runs Monte Carlo CSR envelope tests. Instead it computes the **K-integral** clustering index (mean positive L excess over theoretical CSR) in each sliding window and — whenplot = TRUE(now the default) — draws a spatial base-graphics map with LOESS-smoothed L-excess curves and numeric CI labels overlaid inside each qualifying window. The returned value is a plain list ofLestobjects (one per qualifying window). Thensimargument has been removed; a newmin_phen_cellsargument controls the per-window phenotype-cell threshold.
Improvements to existing functions
calc_icat()— fixed sign-ambiguity bug. The previous implementation returned the raw signed trace of the FastICA mixing matrix, which could be negative. The index is now computed as100 * sqrt(v1 + v2 + 2*sqrt(v1*v2)) / nrow(X)— a normalised trace-standard-deviation of the ICA-reconstructed coordinates — which is always non-negative and reflects average spatial spread per cell in microns.
Show all changes in 0.3.0Hide the rest of the changes in 0.3.0
plot_TLS()— two visual improvements:- Background (non-TLS, non-TIC) cells are now rendered with
bg_alpha = 0.25by default, making them more visually recessive. - TIC cells are drawn at
point_size * tic_size_mult(default1.8x), making them slightly larger than TLS cells.
Both new arguments (bg_alpha, tic_size_mult) are fully exposed.
Internal
- NAMESPACE updated: added
grDevices::adjustcolor,graphics::*,stats::cov,stats::loess,stats::predict; removedspatstat.explore::envelope(no longer needed). - DESCRIPTION Imports extended to declare
grDevices,graphics,stats. - Vignette updated throughout to reflect all changes.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
- Help pages
- 8includes a package overview page
- Examples that run
- 100%7 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 25%
Downloads
Repository
2 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/labsyspharm/tlsr on 2026-10-21.
GitHub Pages site last deployed 2026-04-23
Dependencies
Installing tlsR adds 34 packages (20 with compiled code, 24 MB of source tarballs). Heaviest: ggplot2 6.0 MB, dbscan 3.8 MB, spatstat.data 2.9 MB.
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2025-12-18
- Total releases
- 3 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.0.0
- Bundled data
- 754 KB / 1 file
- Download size
- 1.0 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("tlsR")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.