Skip to content

Commit

Permalink
Merge pull request #456 from remlapmot/tweaks-oct-2023
Browse files Browse the repository at this point in the history
Version 0.5.8
  • Loading branch information
remlapmot authored Nov 16, 2023
2 parents 592ebe0 + 906d34b commit cbd03e6
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 26 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ cache$
^index\.md$
^README\.Rmd$
^CITATION\.cff$
^README\.html$
5 changes: 3 additions & 2 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main, master]
workflow_dispatch:
schedule:
- cron: '37 2 * * TUE' # run at 7:37am UTC on Mondays
- cron: '37 2 * * TUE' # run at 2:37am UTC on Tuesdays

name: R-CMD-check

Expand All @@ -25,13 +25,14 @@ jobs:
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

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 @@ -13,7 +13,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ vignettes/*.R
vignettes/*.html
docs
tests/testthat/*.pdf
README.html
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ authors:
orcid: "https://orcid.org/0000-0003-4655-4511"
title: "TwoSampleMR R package"
type: software
version: 0.5.7
date-released: 2023-05-29
version: 0.5.8
date-released: 2023-11-16
doi: "10.5281/zenodo.4636570"
url: "https://mrcieu.github.io/TwoSampleMR/index.html"
repository-code: "https://github.com/MRCIEU/TwoSampleMR"
Expand Down
5 changes: 4 additions & 1 deletion 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.7
Version: 0.5.8
Authors@R: c(
person("Gibran", "Hemani", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0920-1055")),
Expand All @@ -22,6 +22,9 @@ Description: A package for performing Mendelian randomization using GWAS
functionality in this package, but for any serious work we strongly
recommend using this R package.
License: MIT + file LICENSE
URL: https://github.com/MRCIEU/TwoSampleMR,
https://mrcieu.github.io/TwoSampleMR/
BugReports: https://github.com/MRCIEU/TwoSampleMR/issues/
Depends:
R (>= 4.0.0)
Imports:
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ export(subset_on_method)
export(trim)
export(weighted_median)
export(weighted_median_bootstrap)
import(data.table)
importFrom(magrittr,"%>%")
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# TwoSampleMR v0.5.8

(Release date: 2023-11-16)

* Improved speed of harmonisation using data.table functions (thanks @nicksunderland)
* Updated URL to R-CMD-check README badge
* Updates to GitHub Actions workflows

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

Expand Down
2 changes: 1 addition & 1 deletion R/TwoSampleMR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' 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](http://www.mrbase.org/)
#' 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.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ utils::globalVariables(c(
"steiger_filtered", "theme", "theme_bw", "tibble", "tot", "type", "unit", "up", "up_ci",
"use_by_default", "value", "vgu", "vgx", "word_document",
"complete.cases", ".", "eaf", "id", "l2", "l2.x", "n1", "n2", "rsid", "z",
"orig_SNP", "df"
"orig_SNP", "df", "SNP_index"
))
6 changes: 3 additions & 3 deletions R/harmonise.R
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,12 @@ harmonise_11 <- function(SNP, A1, B1, betaA, betaB, fA, fB, tolerance, action)
return(d)
}


#' @import data.table
harmonise <- function(dat, tolerance, action)
{
dat$orig_SNP<-dat$SNP
SNP_index<-sapply(1:length(dat$SNP),function(i)sum(dat$SNP[1:i]==dat$SNP[i]))
dat$SNP<-paste0(dat$SNP,"_",SNP_index)
dat <- data.table::data.table(dat)[, SNP_index := 1:.N, by="SNP"]
dat$SNP <- paste0(dat$SNP, "_", dat$SNP_index)
SNP <- dat$SNP
A1 <- dat$effect_allele.exposure
A2 <- dat$other_allele.exposure
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

<!-- badges: start -->

[![Build
Status](https://github.com/MRCIEU/TwoSampleMR/workflows/R-CMD-check/badge.svg)](https://github.com/MRCIEU/TwoSampleMR/actions?workflow=R-CMD-check)
[![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)
Expand All @@ -17,7 +16,7 @@ coverage](https://codecov.io/gh/MRCIEU/TwoSampleMR/branch/master/graph/badge.svg
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](http://www.mrbase.org/) to
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.

Expand Down
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Mendelian randomization with GWAS summary data

<!-- badges: start -->
[![Build Status](https://github.com/MRCIEU/TwoSampleMR/workflows/R-CMD-check/badge.svg)](https://github.com/MRCIEU/TwoSampleMR/actions?workflow=R-CMD-check)
[![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)
<!-- 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](http://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.
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

Expand Down
2 changes: 1 addition & 1 deletion inst/sandpit/vignette.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The function looks up the rs IDs in biomart to validate them and retrieve chromo

### GWAS catalog

The GWAS catalog ([http://www.ebi.ac.uk/gwas/](http://www.ebi.ac.uk/gwas/)) is a collection of `r data(gwas_catalog); nrow(gwas_catalog)` reported associations against `r length(unique(gwas_catalog$Phenotype))` traits. These have the potential to be used as instruments in 2SMR. We have downloaded the GWAS catalog and made important formatting changes in order to simplify usage of these data for MR. **Please note that the reformatting of this data may be unreliable**.
The GWAS catalog ([https://www.ebi.ac.uk/gwas/](https://www.ebi.ac.uk/gwas/)) is a collection of `r data(gwas_catalog); nrow(gwas_catalog)` reported associations against `r length(unique(gwas_catalog$Phenotype))` traits. These have the potential to be used as instruments in 2SMR. We have downloaded the GWAS catalog and made important formatting changes in order to simplify usage of these data for MR. **Please note that the reformatting of this data may be unreliable**.

To use the GWAS catalog:

Expand Down
2 changes: 1 addition & 1 deletion man/TwoSampleMR-package.Rd

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

4 changes: 2 additions & 2 deletions vignettes/perform_mr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ This is an implementation of the method described here:

[Hemani G, Tilling K, Davey Smith G.<br/>
**Orienting the causal relationship between imprecisely measured traits using GWAS summary data.**<br/>
PLoS Genetics. 2017. 13(11): e1007081.](http://journals.plos.org/plosgenetics/article?id=10.1371/journal.pgen.1007081)
PLoS Genetics. 2017. 13(11): e1007081.](https://journals.plos.org/plosgenetics/article?id=10.1371/journal.pgen.1007081)

In MR it is assumed that the instruments influence the exposure first and then the outcome through the exposure. But sometimes this is difficult to evaluate, for example is a cis-acting SNP influencing gene expression levels or DNA methylation levels first? The causal direction between the hypothesised exposure and outcomes can be tested using the Steiger test [@hemani-plosgen-2017]. For example:

Expand Down Expand Up @@ -640,7 +640,7 @@ MendelianRandomization::mr_ivw(dat2[[1]], correl = TRUE)

## MR-MoE: Using a mixture of experts machine learning approach

We recently developed MR-MoE, a method to choose the most appropriate amongst several MR tests using a machine learning algorithm. Note that the method is still under review, but full details are described here: [biorxiv.org/content/early/2017/08/23/173682](http://www.biorxiv.org/content/early/2017/08/23/173682).
We recently developed MR-MoE, a method to choose the most appropriate amongst several MR tests using a machine learning algorithm. Note that the method is still under review, but full details are described here: <https://doi.org/10.1101/173682>.

MR-MoE operates by taking a set of harmonised data, inferring some characteristics about the dataset, and using those characteristics to predict how well each of the different MR methods will perform on the dataset, in terms of maximising power while minimising false discovery rates.

Expand Down
11 changes: 6 additions & 5 deletions vignettes/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @article{DaveySmith2003
number = {1},
pages = {1--22},
title = {{'Mendelian randomization': can genetic epidemiology contribute to understanding environmental determinants of disease?}},
url = {http://www.ije.oxfordjournals.org/cgi/doi/10.1093/ije/dyg070},
url = {https://doi.org/10.1093/ije/dyg070},
volume = {32},
year = {2003},
}
Expand All @@ -27,14 +27,15 @@ @article{DaveySmithHemani2014
author = {{Davey Smith}, George and Hemani, Gibran},
doi = {10.1093/hmg/ddu328},
issn = {0964-6906},
journal = {Human molecular genetics},
journal = {Human Molecular Genetics},
month = {jul},
number = {R1},
pages = {R89--R98},
publisher = {Oxford Univ Press},
title = {{Mendelian randomization: genetic anchors for causal inference in epidemiological studies}},
volume = {23},
year = {2014},
url = {https://doi.org/10.1093/hmg/ddu328}
}

@article{Pierce2013,
Expand All @@ -47,8 +48,8 @@ @article{Pierce2013
number = {7},
pages = {1177--1184},
pmid = {23863760},
title = {{Efficient design for Mendelian randomization studies: subsample and 2-sample instrumental variable estimators.}},
url = {http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=3783091{\&}tool=pmcentrez{\&}rendertype=abstract},
title = {{Efficient design for Mendelian randomization studies: subsample and 2-sample instrumental variable estimators}},
url = {https://doi.org/10.1093/aje/kwt084},
volume = {178},
year = {2013},
}
Expand All @@ -64,7 +65,7 @@ @article{Speliotes2010
pages = {937--948},
pmid = {20935630},
title = {{Association analyses of 249,796 individuals reveal 18 new loci associated with body mass index}},
url = {http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=3014648{\&}tool=pmcentrez{\&}rendertype=abstract},
url = {https://doi.org/10.1038/ng.686},
volume = {42},
year = {2010},
}
Expand Down

0 comments on commit cbd03e6

Please sign in to comment.