Higher scores favor merging.
Arguments
- aggs
A tile data structure.
- agg_mode
Method to use to calculate aggregation scores (1, 2, or 3).
- ...
Additional parameters for different modes:
No additional parameters.
Requires
alphaandmax_npts. Foralpha, 0.2 = conservative merging, 2 = liberal merging.Requires
alphaandmin_npts. Foralpha, 0.2 = conservative merging, 2 = liberal merging.
Value
aggs with scores for aggregation stored in attributes:
- edges
Additional attributes are calculated: *
dscore: Overall score for merging two tiles. Product ofw,score_size, anddC. *w: Gene expression similarity score. *score_size: Penalizes tiles with many points. *perimeter_merge: Perimeter of merged tile.- d_mu,d_sig
Parameters used to calculate
w.- pcs_merged
Average PCs for merged tile.
Details
Methods for different modes of aggregation:
dscorehas already been manually calculated and stored inaggs$edges$dscore. Will set thescore,score_size, andcompactnessattributes ofaggs$meta_datato 0.dscoreis the product of three factors:w: A 2-cluster GMM is used to determine the meanmuand standard deviationsigof the distance between tiles that have similar gene expression (Euclidean distancedin PC space). Then we defined_mu = mu + sigandd_sig = alpha * sig, and calculatewasw = 0.5 - 1 / (1 + exp(-(d - d_mu) / d_sig)). Ranges from -0.5 to 0.5. If adjacent tiles are very dissimilar (d >> d_mu), thendis large, andwis close to-0.5. If adjacent tiles are very similar (d < d_mu), thendis small, andwis positive.score_size:(1 - npts_from/max_npts) * (1 - npts_to/max_npts). Ranges from 0 to 1. If merging the two tiles would have a total number of points ≥max_npts, thenscore_sizeis-Inf, which prevents merging.dC:.5 * (C_merge - C_from - C_to + 1). Ranges from 0 to 1.
dscoreis the product of same three factors as mode 2, butscore_sizehas already been precomputed. Additionally,dscoreis set to -1 if both adjacent tiles have at leastmin_nptscells.