From 690d7bf71e2711fe7d0c8259338ae80e970a0c3a Mon Sep 17 00:00:00 2001 From: Joel Eliason Date: Tue, 3 Feb 2026 09:46:58 -0700 Subject: [PATCH 1/3] Fix SIC extraction failing when cell type names are prefixes of others The coefficient name matching used a substring search that incorrectly matched multiple cell types when one name was a prefix of another (e.g., cd4tcells also matched cd4tcells_ICOS, cd4tcells_PD1, etc.). Changed grep pattern to use regex $ anchor to match only coefficient names ending with the exact source type name. Fixes #5 --- R/sic_extraction.R | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/R/sic_extraction.R b/R/sic_extraction.R index f7babc6..49f134b 100644 --- a/R/sic_extraction.R +++ b/R/sic_extraction.R @@ -153,8 +153,9 @@ compute_sic_posterior <- function(fit, for (group_i in indices) { for (source in source_types) { # Find coefficient indices for this target-source pair - coef_pattern <- paste0("_", target_type, "_", source) - coef_ix <- grep(coef_pattern, coef_names, fixed = TRUE) + # Use $ anchor to match exact source name at end (avoids matching cd4tcells_ICOS when looking for cd4tcells) + coef_pattern <- paste0("_", target_type, "_", source, "$") + coef_ix <- grep(coef_pattern, coef_names) if (length(coef_ix) == 0) { warning(sprintf("No coefficients found for %s -> %s", source, target_type)) @@ -221,8 +222,9 @@ compute_sic_posterior <- function(fit, for (patient_i in indices) { for (source in source_types) { # Find coefficient indices for this target-source pair - coef_pattern <- paste0("_", target_type, "_", source) - coef_ix <- grep(coef_pattern, coef_names, fixed = TRUE) + # Use $ anchor to match exact source name at end (avoids matching cd4tcells_ICOS when looking for cd4tcells) + coef_pattern <- paste0("_", target_type, "_", source, "$") + coef_ix <- grep(coef_pattern, coef_names) if (length(coef_ix) == 0) { warning(sprintf("No coefficients found for %s -> %s", source, target_type)) @@ -283,8 +285,9 @@ compute_sic_posterior <- function(fit, for (image_i in indices) { for (source in source_types) { # Find coefficient indices for this target-source pair - coef_pattern <- paste0("_", target_type, "_", source) - coef_ix <- grep(coef_pattern, coef_names, fixed = TRUE) + # Use $ anchor to match exact source name at end (avoids matching cd4tcells_ICOS when looking for cd4tcells) + coef_pattern <- paste0("_", target_type, "_", source, "$") + coef_ix <- grep(coef_pattern, coef_names) if (length(coef_ix) == 0) { warning(sprintf("No coefficients found for %s -> %s", source, target_type)) From 354aab1c0bd44659c19eae6bb2148214c2d1c0e1 Mon Sep 17 00:00:00 2001 From: Joel Eliason Date: Tue, 3 Feb 2026 16:11:40 -0700 Subject: [PATCH 2/3] Fix macOS CI by using upgrade: TRUE for R dependencies CRAN removes old macOS ARM binaries when new versions are released, causing cached lockfiles to reference non-existent packages. --- .github/workflows/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 794ac1d..5787e1f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -43,6 +43,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + upgrade: TRUE extra-packages: | any::testthat any::devtools From 6a4bf7ac933ef5dc294682137ba60d7fc7f2a4ba Mon Sep 17 00:00:00 2001 From: Joel Eliason Date: Tue, 3 Feb 2026 16:17:26 -0700 Subject: [PATCH 3/3] Fix upgrade parameter syntax - must be quoted R expression --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5787e1f..a30a2e1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -43,7 +43,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - upgrade: TRUE + upgrade: 'TRUE' extra-packages: | any::testthat any::devtools