Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/query.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
docs:
R -e "devtools::document()"
Rscript -e "devtools::document()"
check: docs
R -e "devtools::check()"
Rscript -e "devtools::check()"
test:
Rscript -e "devtools::test()"
test-server:
TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS=TRUE Rscript -e "devtools::test()"
install: docs
R -e "devtools::install(build_vignettes = TRUE)"
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:
R -e "pak::local_install_dev_deps()"
Rscript -e "pak::local_install_dev_deps()"
readme:
Rscript -e "rmarkdown::render('README.Rmd', output_options = list(html_preview = FALSE))"
26 changes: 26 additions & 0 deletions tests/testthat/test_format_d.R
Original file line number Diff line number Diff line change
@@ -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"))
})
Loading