From 0d94fc87a1e4cfdee732f2f2dfa22f8a0796cc22 Mon Sep 17 00:00:00 2001 From: George Chen <72078254+jiajic@users.noreply.github.com> Date: Mon, 3 Jun 2024 12:52:40 -0400 Subject: [PATCH] fix: `find_dampening_constant()` needs `drop = FALSE` --- NEWS.md | 3 ++- R/spatial_enrichment.R | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3b03d36be..5fe9c1560 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,8 @@ # Giotto 4.0.10 TBD ## Bug fixes -* Fix error in `plotInteractivePolygons()` when providing a spatial plot with a continuous scale +* Fix error in `plotInteractivePolygons()` when providing a spatial plot with a continuous scale [#964](https://github.com/drieslab/Giotto/issues/964) by jweis3 +* Fix error in DWLS `find_dampening_constant()` when `S[subset, ]` produces only 1 gene. # Giotto 4.0.9 diff --git a/R/spatial_enrichment.R b/R/spatial_enrichment.R index ffcb3b801..1f95d9a53 100644 --- a/R/spatial_enrichment.R +++ b/R/spatial_enrichment.R @@ -2911,7 +2911,7 @@ find_dampening_constant <- function( # solve dampened weighted least squares for subset fit <- stats::lm( - B[subset] ~ -1 + S[subset, ], + B[subset] ~ -1 + S[subset, , drop = FALSE], weights = wsDampened[subset] ) sol <- fit$coef * sum(goldStandard) / sum(fit$coef)