From dff987d602835eb5ce4158b52b37ad429247cda5 Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Mon, 24 Aug 2026 09:29:46 +0100 Subject: [PATCH 1/8] Use Rscript in justfile --- justfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/justfile b/justfile index 6f36eb563..e3e1f3bef 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,8 @@ docs: - R -e "devtools::document()" + Rscript -e "devtools::document()" check: docs - R -e "devtools::check()" + Rscript -e "devtools::check()" install: docs - R -e "devtools::install(build_vignettes = TRUE)" + Rscript -e "devtools::install(build_vignettes = TRUE)" dev: - R -e "pak::local_install_dev_deps()" + Rscript -e "pak::local_install_dev_deps()" From cc2daa104d187fd682285e460b0596e8ac8de7ad Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Mon, 24 Aug 2026 09:29:55 +0100 Subject: [PATCH 2/8] Add readme recipe --- justfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/justfile b/justfile index e3e1f3bef..6ea263221 100644 --- a/justfile +++ b/justfile @@ -6,3 +6,5 @@ install: docs Rscript -e "devtools::install(build_vignettes = TRUE)" dev: Rscript -e "pak::local_install_dev_deps()" +readme: + Rscript -e "rmarkdown::render('README.Rmd', output_options = list(html_preview = FALSE))" From f3935d3c3edd78a7640b196c47fa5bf51fa9b212 Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Thu, 24 Sep 2026 12:04:22 +0100 Subject: [PATCH 3/8] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 71f2c80b1..31fe5ade5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: TwoSampleMR Title: Two Sample MR Functions and Interface to MRC Integrative Epidemiology Unit OpenGWAS Database -Version: 0.7.9 +Version: 0.7.10 Authors@R: c( person("Gibran", "Hemani", , "g.hemani@bristol.ac.uk", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0920-1055")), From e364d59e96a0abb33c17aea93b6c5fdecc7aa35b Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Thu, 24 Sep 2026 12:05:20 +0100 Subject: [PATCH 4/8] Fix grouping when removing duplicated proxy SNPs in format_d() --- R/query.R | 2 +- tests/testthat/test_format_d.R | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/test_format_d.R diff --git a/R/query.R b/R/query.R index 36cc3f2d9..7cdcb1488 100644 --- a/R/query.R +++ b/R/query.R @@ -286,7 +286,7 @@ format_d <- function(d) { # If two SNPs have the same proxy SNP then one has to be removed d <- data.table::as.data.table(d) - d <- d[!duplicated(proxy_snp.outcome), , by = outcome] + d <- d[!duplicated(d, by = c("outcome", "proxy_snp.outcome"))] data.table::setDF(d) } else { d <- d1 diff --git a/tests/testthat/test_format_d.R b/tests/testthat/test_format_d.R new file mode 100644 index 000000000..dfc062058 --- /dev/null +++ b/tests/testthat/test_format_d.R @@ -0,0 +1,26 @@ +test_that("format_d() removes duplicated proxy SNPs within each outcome without warning", { + d <- data.frame( + rsid = c("rs1", "rs2", "rs1", "rs2"), + chr = "1", + position = c(100, 200, 100, 200), + beta = 0.1, + se = 0.01, + n = 1000, + p = 1e-8, + eaf = 0.3, + ea = "A", + nea = "G", + trait = c("Trait A", "Trait A", "Trait B", "Trait B"), + id = c("id-a", "id-a", "id-b", "id-b"), + proxy = TRUE, + target_snp = c("rs1", "rs2", "rs1", "rs2"), + proxy_snp = "rs3", + target_a1 = "A", + target_a2 = "G", + proxy_a1 = "A", + proxy_a2 = "G" + ) + expect_no_warning(out <- format_d(d)) + expect_equal(nrow(out), 2) + expect_setequal(out$id.outcome, c("id-a", "id-b")) +}) From 55689b40d49c484e3efed3e70b817a05cb5015a5 Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Thu, 24 Sep 2026 12:05:24 +0100 Subject: [PATCH 5/8] Update NEWS.md --- NEWS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index c293a255b..49e885269 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# TwoSampleMR v0.7.10 + +(Release date 2026-09-24) + +* Fixed the removal of duplicated proxy SNPs in `extract_outcome_data()`, which since v0.6.30 ignored its intended grouping by outcome and emitted the warning "Ignoring by/keyby because 'j' is not supplied" whenever proxies were used. Results were unaffected because proxies are looked up one outcome at a time. (thanks @amymariemason for the report) + # TwoSampleMR v0.7.9 (Release date 2026-06-24) From 9133228fb124ac67d4067b04a8952aedb414c541 Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Thu, 24 Sep 2026 12:06:11 +0100 Subject: [PATCH 6/8] Add test recipe --- justfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/justfile b/justfile index 6ea263221..1c245190e 100644 --- a/justfile +++ b/justfile @@ -2,6 +2,8 @@ docs: Rscript -e "devtools::document()" check: docs Rscript -e "devtools::check()" +test: + Rscript -e "devtools::test()" install: docs Rscript -e "devtools::install(build_vignettes = TRUE)" dev: From ec169b2c8c53dcb6285ec1dbe77cba88c2554fa4 Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Thu, 24 Sep 2026 12:14:10 +0100 Subject: [PATCH 7/8] Add test-server recipe --- justfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/justfile b/justfile index 1c245190e..168a6f47f 100644 --- a/justfile +++ b/justfile @@ -4,6 +4,8 @@ check: docs Rscript -e "devtools::check()" test: Rscript -e "devtools::test()" +test-server: + TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS=TRUE Rscript -e "devtools::test()" install: docs Rscript -e "devtools::install(build_vignettes = TRUE)" dev: From b1d3342ae844219295acbf0ae636792dbebe32bf Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Thu, 24 Sep 2026 12:26:07 +0100 Subject: [PATCH 8/8] Add install-fast recipe --- justfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/justfile b/justfile index 168a6f47f..9ebf294e6 100644 --- a/justfile +++ b/justfile @@ -8,6 +8,8 @@ test-server: TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS=TRUE Rscript -e "devtools::test()" install: docs Rscript -e "devtools::install(build_vignettes = TRUE)" +install-fast: docs + Rscript -e "pkg <- pkgbuild::build(dest_path = tempdir(), vignettes = FALSE); install.packages(pkg, repos = NULL, type = 'source')" dev: Rscript -e "pak::local_install_dev_deps()" readme: