Estimate Elliptical Distance Between Two USERM Spread Objects
Source:R/EstimateDistance.R
EstimateDistance.RdThis function computes a distance matrix between fluorochrome pairs based on the geometric relationship of their signal ellipses in two USERM spread objects (Spr). The distance is defined as the ratio between the center-to-center distance and the sum of the ellipse radii along the connecting line. A value less than 1 indicates overlapping ellipses.
Arguments
- Spr1
A spread object generated by
EstimateSpread(), containing intensity and variance information for a population.- Spr2
Another spread object generated by
EstimateSpread(), to be compared withSpr1.
Value
A square numeric matrix with fluorochrome names as row and column names. Each entry represents
the elliptical distance ratio between a pair of fluorochromes in Spr1 and Spr2.
Details
The function checks that both spread objects contain the same set of fluorochromes. For each fluorochrome pair, it calculates:
The center positions from intensity values.
The ellipse radii from the square root of summed intercept and slope variances.
The distance between ellipse centers.
The sum of half-lengths of the line segments within each ellipse along the connecting direction.
The final distance ratio is computed as: $$(distance\_between\_centers + 0.01) / (sum\_of\_ellipse\_radii + 0.01)$$
Examples
if (FALSE) { # \dontrun{
dist_matrix <- EstimateDistance(Spr1, Spr2)
heatmap(dist_matrix)
} # }