Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TwoSampleMR 0.5.9 #472

Merged
merged 40 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
449624a
Delete not needed library(TwoSampleMR) calls
remlapmot Nov 28, 2023
3809c3a
Use string GWAS IDs
remlapmot Nov 28, 2023
210617b
Use string GWAS IDs
remlapmot Nov 28, 2023
164b0ff
Improve helpfile formatting
remlapmot Nov 28, 2023
597e01f
devtools::document()
remlapmot Nov 28, 2023
26c7949
Bump version
remlapmot Nov 28, 2023
504d841
Update NEWS.md
remlapmot Nov 28, 2023
305a314
Update NEWS.md
remlapmot Nov 28, 2023
1a5e33e
Bump actions/upload-artifact to v4
remlapmot Dec 20, 2023
2563044
Fix subset call
remlapmot Nov 28, 2023
a195383
Bump roxygen2 version
remlapmot Jan 11, 2024
1662a82
usethis::use_package_doc()
remlapmot Jan 11, 2024
25658de
Move content from TwoSampleMR-package.R
remlapmot Jan 11, 2024
f804400
devtools::document()
remlapmot Jan 11, 2024
39671a9
Add trailing / to URL
remlapmot Jan 11, 2024
43458b5
Amend URL to CRAN canonical form
remlapmot Jan 11, 2024
fbe3a92
Update PHESANT pubmed URL
remlapmot Jan 11, 2024
9a4f297
Update opengwas-requests URL
remlapmot Jan 11, 2024
e580373
Add <> around URL
remlapmot Jan 11, 2024
46fbc8c
Update lifecycle URL
remlapmot Jan 11, 2024
055e3fb
Update codecov URL
remlapmot Jan 11, 2024
72a9781
rmarkdown::render('README.Rmd')
remlapmot Jan 11, 2024
921cbee
Update bioRxiv URL
remlapmot Jan 11, 2024
034a948
Use \doi{} instead of <https:>
remlapmot Jan 11, 2024
bf751bf
devtools::document()
remlapmot Jan 11, 2024
c4d705b
Bump roxygen2 version
remlapmot Jan 23, 2024
5de7ebc
Run tests on macos-14 M1 runners
remlapmot Feb 1, 2024
c1cdac3
Add GHA bullet to NEWS
remlapmot Feb 1, 2024
420372c
Add updated URLs NEWS bullet
remlapmot Feb 1, 2024
3ee2508
Delete whitespace
remlapmot Feb 1, 2024
dcd2ee7
Delete whitespace
remlapmot Feb 1, 2024
73ba2c4
Delete whitespace and enclose URL in <>
remlapmot Feb 1, 2024
e26730f
Call functions functions
remlapmot Feb 1, 2024
f310972
Delete whitespace
remlapmot Feb 1, 2024
2dacc30
Delete whitespace
remlapmot Feb 1, 2024
dfd8abb
Remove inline html <br/> from markdown syntax
remlapmot Feb 1, 2024
68a98df
Delete whitespace
remlapmot Feb 1, 2024
84bfeed
Delete whitespace
remlapmot Feb 1, 2024
b135695
Delete TwoSampleMR bullet
remlapmot Feb 1, 2024
4a7ba3b
Add release date
remlapmot Feb 1, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-14, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: TwoSampleMR
Title: Two Sample MR Functions and Interface to MR Base Database
Version: 0.5.8
Version: 0.5.9
Authors@R: c(
person("Gibran", "Hemani", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0920-1055")),
Expand All @@ -16,9 +16,10 @@ Authors@R: c(
comment = c(ORCID = "0000-0003-4655-4511"))
)
Description: A package for performing Mendelian randomization using GWAS
summary data. It uses the IEU GWAS database to obtain data
automatically, and a wide range of methods to run the analysis. You
can use the MR-Base web app to try out a limited range of the
summary data. It uses the IEU GWAS database
<https://gwas.mrcieu.ac.uk/> to automatically obtain data, and a wide
range of methods to run the analysis. You can use the MR-Base web app
<https://www.mrbase.org/> to try out a limited range of the
functionality in this package, but for any serious work we strongly
recommend using this R package.
License: MIT + file LICENSE
Expand Down Expand Up @@ -68,4 +69,4 @@ Remotes:
WSpiller/RadialMR
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
12 changes: 11 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# TwoSampleMR v0.5.9

(Release date: 2024-02-01)

* Fixed a minor issue in `dat_to_RadialMR()`
* Minor improvements to `make_dat()` default arguments and helpfile
* Minor improvements to package tests
* Amendments to GitHub Actions workflows
* Updated several URLs which had changed

# TwoSampleMR v0.5.8

(Release date: 2023-11-16)
Expand All @@ -6,7 +16,7 @@
* Updated URL to R-CMD-check README badge
* Updates to GitHub Actions workflows

TwoSampleMR v0.5.7
TwoSampleMR v0.5.7
==============

(Release date: 2023-05-29)
Expand Down
18 changes: 5 additions & 13 deletions R/TwoSampleMR-package.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#' TwoSampleMR: Two Sample MR functions and interface to MR Base database
#'
#' A package for performing Mendelian randomization using GWAS summary data.
#' It uses the [IEU GWAS database](https://gwas.mrcieu.ac.uk/) to obtain data automatically,
#' and a wide range of methods to run the analysis. You can use the [MR-Base web app](https://www.mrbase.org/)
#' to try out a limited range of the functionality in this package,
#' but for any serious work we strongly recommend using this R package.
#'
#' **Full documentation available here:** [https://mrcieu.github.io/TwoSampleMR](https://mrcieu.github.io/TwoSampleMR/)
#'
#' @name TwoSampleMR-package
#' @aliases TwoSampleMR twosamplemr
#' @docType package
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
2 changes: 1 addition & 1 deletion R/add_rsq.r
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ compareNA <- function(v1,v2) {
#' Estimate proportion of variance of liability explained by SNP in general population
#'
#' This uses equation 10 in Lee et al. A Better Coefficient of Determination for Genetic Profile Analysis.
#' Genetic Epidemiology 36: 214–224 (2012) <https://doi.org/10.1002/gepi.21614>.
#' Genetic Epidemiology 36: 214–224 (2012) \doi{10.1002/gepi.21614}.
#'
#' @param lor Vector of Log odds ratio.
#' @param af Vector of allele frequencies.
Expand Down
8 changes: 4 additions & 4 deletions R/make_dat.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#'
#' Convenient function to create a harmonised dataset.
#'
#' @param exposures The default is `c(2, 301)` (BMI and LDL).
#' @param outcomes The default is `c(7, 1001)` (EDU and CHD).
#' @param proxies Look for proxies? Default = TRUE
#' @param exposures The default is `c("ieu-a-2", "ieu-a-301")` (BMI and LDL).
#' @param outcomes The default is `c("ieu-a-7", "ieu-a-1001")` (CHD and EDU).
#' @param proxies Look for proxies? Default = `TRUE`
#'
#' @export
#' @return Harmonised data frame
make_dat <- function(exposures=c(2,301), outcomes=c(7,1001), proxies=TRUE)
make_dat <- function(exposures=c("ieu-a-2","ieu-a-301"), outcomes=c("ieu-a-7","ieu-a-1001"), proxies=TRUE)
{
a <- extract_instruments(exposures)
b <- extract_outcome_data(a$SNP, outcomes, proxies=proxies)
Expand Down
2 changes: 1 addition & 1 deletion R/moe.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ get_rsq <- function(dat)

#' Mixture of experts
#'
#' Based on the method described here \url{https://www.biorxiv.org/content/early/2017/08/23/173682}.
#' Based on the method described here \url{https://www.biorxiv.org/content/10.1101/173682v2}.
#' Once all MR methods have been applied to a summary set, you can then use the mixture of experts to predict the method most likely to be the most accurate.
#'
#' @param res Output from [mr_wrapper()].
Expand Down
2 changes: 1 addition & 1 deletion R/other_formats.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ dat_to_RadialMR <- function(dat)
message("Converting:")
message(" - exposure: ", x$exposure[1])
message(" - outcome: ", x$outcome[1])
d <- subset(x, mr_keep=TRUE)
d <- subset(x, mr_keep)
d <- RadialMR::format_radial(d$beta.exposure, d$beta.outcome, d$se.exposure, d$se.outcome, RSID=d$SNP)
return(d)
})
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ output: github_document

<!-- Additional content -->

**Full documentation available here:** https://mrcieu.github.io/TwoSampleMR
**Full documentation available here:** https://mrcieu.github.io/TwoSampleMR/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

[![R-CMD-check](https://github.com/MRCIEU/TwoSampleMR/actions/workflows/check-full.yaml/badge.svg)](https://github.com/MRCIEU/TwoSampleMR/actions/workflows/check-full.yaml)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![DOI](https://zenodo.org/badge/49515156.svg)](https://zenodo.org/badge/latestdoi/49515156)
[![Codecov test
coverage](https://codecov.io/gh/MRCIEU/TwoSampleMR/branch/master/graph/badge.svg)](https://codecov.io/gh/MRCIEU/TwoSampleMR?branch=master)
coverage](https://codecov.io/gh/MRCIEU/TwoSampleMR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/MRCIEU/TwoSampleMR?branch=master)
<!-- badges: end -->

A package for performing Mendelian randomization using GWAS summary
Expand Down Expand Up @@ -56,4 +56,4 @@ is available here: <https://hub.docker.com/r/mrcieu/twosamplemr>
<!-- Additional content -->

**Full documentation available here:**
<https://mrcieu.github.io/TwoSampleMR>
<https://mrcieu.github.io/TwoSampleMR/>
6 changes: 3 additions & 3 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<!-- badges: start -->
[![R-CMD-check](https://github.com/MRCIEU/TwoSampleMR/actions/workflows/check-full.yaml/badge.svg)](https://github.com/MRCIEU/TwoSampleMR/actions/workflows/check-full.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) [![DOI](https://zenodo.org/badge/49515156.svg)](https://zenodo.org/badge/latestdoi/49515156)
[![Codecov test coverage](https://codecov.io/gh/MRCIEU/TwoSampleMR/branch/master/graph/badge.svg)](https://codecov.io/gh/MRCIEU/TwoSampleMR?branch=master)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html) [![DOI](https://zenodo.org/badge/49515156.svg)](https://zenodo.org/badge/latestdoi/49515156)
[![Codecov test coverage](https://codecov.io/gh/MRCIEU/TwoSampleMR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/MRCIEU/TwoSampleMR?branch=master)
<!-- badges: end -->

A package for performing Mendelian randomization using GWAS summary data. It uses the [IEU GWAS database](https://gwas.mrcieu.ac.uk/) to obtain data automatically, and a wide range of methods to run the analysis. You can use the [MR-Base web app](https://www.mrbase.org/) to try out a limited range of the functionality in this package, but for any serious work we strongly recommend using this R package.

## January 2020 major update

**We have made substantial changes to the package, database and reference panels.** For full details of the changes, please visit https://mrcieu.github.io/TwoSampleMR/articles/gwas2020.html
**We have made substantial changes to the package, database and reference panels.** For full details of the changes, please visit <https://mrcieu.github.io/TwoSampleMR/articles/gwas2020.html>

## Installation

Expand Down
35 changes: 25 additions & 10 deletions man/TwoSampleMR-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_r_from_lor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/make_dat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/mr_moe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/testthat/test_add_metadata.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("add metadata")
library(TwoSampleMR)

test_that("exposure data 1", {
d <- extract_instruments('ieu-a-2') %>% add_metadata()
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_eve.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("eve")
library(TwoSampleMR)

dat <- make_dat("ieu-a-2", "ieu-a-7") %>% add_metadata()

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_harmonise.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("harmonise")
library(TwoSampleMR)

exp_dat <- extract_instruments("ieu-a-2")
out_dat <- extract_outcome_data(exp_dat$SNP, "ieu-a-7")
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_heterogeneity.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("heterogeneity")
library(TwoSampleMR)

dat <- make_dat()

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_instruments.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("Instruments")
library(TwoSampleMR)

test_that("server and mrinstruments", {

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_ld.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("ld")
library(TwoSampleMR)


a <- extract_instruments(2, clump=FALSE)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_ldsc.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("LDSC")
library(TwoSampleMR)


test_that("get afl2", {
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test_leaveoneout.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
context("leaveoneout")
library(TwoSampleMR)

dat <- make_dat(2, 7)
dat <- make_dat("ieu-a-2", "ieu-a-7")

test_that("leaveoneout", {
w <- mr_leaveoneout(dat)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_mvmr.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("mvmr")
library(TwoSampleMR)

test_that("control", {
lipids <- mv_extract_exposures(c("ieu-a-299","ieu-a-300","ieu-a-302"))
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_otherformats.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("other formats")
library(TwoSampleMR)

dat <- make_dat("ieu-a-2", "ieu-a-7")

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_outcomes.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("outcome")
library(TwoSampleMR)

test_that("outcomes", {

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_plots.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("plots")
library(TwoSampleMR)

test_that("scatter plot", {
dat <- make_dat(2,7)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_rsq.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("add rsq")
library(TwoSampleMR)

test_that("exposure data 1", {
d <- extract_instruments('ieu-a-2') %>% add_rsq()
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_singlesnp.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("singlesnp")
library(TwoSampleMR)

dat <- make_dat("ieu-a-2", "ieu-a-7")

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_steiger.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
context("steiger")
library(TwoSampleMR)

w <- make_dat(2, 7)

Expand Down
4 changes: 2 additions & 2 deletions vignettes/exposure.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bmi_exp_dat$exposure <- "BMI"

## Using an existing data frame

If the data already exists as a data frame in R then it can be converted into the correct format using the `format_data` function. For example, here is some randomly created data:
If the data already exists as a data frame in R then it can be converted into the correct format using the `format_data()` function. For example, here is some randomly created data:

```{r}
random_df <- data.frame(
Expand Down Expand Up @@ -319,7 +319,7 @@ You can provide a list of SNP IDs, the SNPs will be extracted from 1000 genomes
bmi_exp_dat <- clump_data(bmi_exp_dat)
```

The `clump_data` command takes any data frame that has been formatted to be an exposure data type of data frame. Note that for the instruments in the R/MRInstruments package the SNPs are already LD clumped.
The `clump_data()` function takes any data frame that has been formatted to be an exposure data type of data frame. Note that for the instruments in the MRInstruments package the SNPs are already LD clumped.

**Note:** The LD reference panel only includes SNPs (no INDELs). There are five super-populations from which LD can be calculated, by default European samples are used. Only SNPs with MAF > 0.01 within-population are available.

Expand Down
Loading