diff --git a/DESCRIPTION b/DESCRIPTION index d551e30..8085116 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: cytomapper -Version: 1.15.3 +Version: 1.15.4 Title: Visualization of highly multiplexed imaging data in R Description: Highly multiplexed imaging acquires the single-cell expression of diff --git a/NEWS b/NEWS index c31bda4..a1fa264 100644 --- a/NEWS +++ b/NEWS @@ -195,3 +195,6 @@ Changes in version 1.15.2 (2023-12-13): Changes in version 1.15.3 (2024-03-13): + measureObject fixes for Bioc 3.19 release + +Changes in version 1.15.4 (2024-03-21): ++ measureObject fix reversion and test - Bioc 3.19 diff --git a/R/measureObjects.R b/R/measureObjects.R index d0b57a5..55513c7 100644 --- a/R/measureObjects.R +++ b/R/measureObjects.R @@ -254,8 +254,8 @@ measureObjects <- function(mask, cur_colData <- colData(object) cur_df <- cbind(mcols(image), mcols(mask)) cur_df <- cur_df[,unique(names(cur_df)), drop=FALSE] - cur_colData <- merge(as.data.frame(as.matrix(cur_colData)), - as.data.frame(as.matrix(cur_df)), + cur_colData <- merge(as.data.frame(cur_colData), + as.data.frame(cur_df), by = img_id, sort = FALSE) colData(object) <- as(cur_colData, "DataFrame") diff --git a/tests/testthat/test_measureObjects.R b/tests/testthat/test_measureObjects.R index 5e7775c..6ecf7c0 100644 --- a/tests/testthat/test_measureObjects.R +++ b/tests/testthat/test_measureObjects.R @@ -237,6 +237,11 @@ test_that("measureObjects: defaults work", { feature_types = c("basic", "haralick"), haralick_feature = c("var.s1", "test"), haralick_scales = c(1, 3)), regexp = "Only haralick features of type asm.s1, con.s1, cor.s1, var.s1, idm.s1, sav.s1, sva.s1, sen.s1, ent.s1, dva.s1, den.s1, f12.s1, f13.s1, asm.s3, con.s3, cor.s3, var.s3, idm.s3, sav.s3, sva.s3, sen.s3, ent.s3, dva.s3, den.s3, f12.s3, f13.s3 allowed.", fixed = TRUE) + + # Test for character img_id + expect_silent(sce <- measureObjects(pancreasMasks, pancreasImages, img_id = "ImageName")) + expect_true(is.numeric(sce$object_id)) + expect_equal(sce$object_id[1:10], c(824, 835, 839, 844, 847, 853, 859, 864, 865, 872)) }) test_that("measureObjects: different settings work", {