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
4 changes: 2 additions & 2 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: macos-13, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: '4.3.2'}
- {os: ubuntu-24.04-arm, r: 'release', rspm: 'no' }
- {os: macos-13, r: 'release'}
# - {os: ubuntu-24.04-arm, r: 'release', rspm: 'no' }

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
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.6.13
Version: 0.6.14
Authors@R: c(
person("Gibran", "Hemani", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0920-1055")),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# TwoSampleMR v0.6.14

(Release date 2025-03-28)

* Minor amends to the `mr_grip()` returned object names (thanks @fdudbridge)
* Fixed some typos in the helpfiles and vignettes

# TwoSampleMR v0.6.13

(Release date 2025-03-26)
Expand Down
2 changes: 1 addition & 1 deletion R/forest_plot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ forest_plot_names <- function(dat, section=NULL, bottom=TRUE)
#'
#' @param mr_res Results from [mr()].
#' @param exponentiate Convert effects to OR? Default is `FALSE`.
#' @param single_snp_method Which of the single SNP methosd to use when only 1 SNP was used to estimate the causal effect? The default is `"Wald ratio"`.
#' @param single_snp_method Which of the single SNP methods to use when only 1 SNP was used to estimate the causal effect? The default is `"Wald ratio"`.
#' @param multi_snp_method Which of the multi-SNP methods to use when there was more than 1 SNPs used to estimate the causal effect? The default is `"Inverse variance weighted"`.
#' @param group_single_categories If there are categories with only one outcome, group them together into an "Other" group. The default is `TRUE`.
#' @param by_category Separate the results into sections by category? The default is `TRUE`.
Expand Down
2 changes: 1 addition & 1 deletion R/forest_plot_1-to-many.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ format_1_to_many <- function(mr_res, b="b",se="se",exponentiate=FALSE, ao_slc=FA
#' @param sort_action Choose how to sort results.
#' \itemize{
#' \item `sort_action = 1`: sort results by effect size within groups. Use the group order supplied by the user.
#' \item `sort_action = 2`: sort results by effect size and group. Overides the group ordering supplied by the user.
#' \item `sort_action = 2`: sort results by effect size and group. Overrides the group ordering supplied by the user.
#' \item `sort_action = 3`: group results for the same trait together (e.g. multiple results for the same trait from different MR methods).
#' \item `sort_action = 4`: sort by decreasing effect size (largest effect size at top and smallest at bottom).
#' \item `sort_action = 5`: sort by increasing effect size (smallest effect size at top and largest at bottom).
Expand Down
2 changes: 1 addition & 1 deletion R/ld.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

if(!is.data.frame(dat))
{
stop("Expecting data frame returned from format_data")
stop("Expecting data frame returned from format_data().")

Check warning on line 34 in R/ld.R

View check run for this annotation

Codecov / codecov/patch

R/ld.R#L34

Added line #L34 was not covered by tests
}

if("pval.exposure" %in% names(dat) && "pval.outcome" %in% names(dat))
Expand Down
16 changes: 8 additions & 8 deletions R/mr-grip.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' MR-GRIP: a modified MR-Egger model with the Genotype Recoding Invariant Property
#' MR-GRIP: a modified MR-Egger model with the Genotype Recoding Invariance Property
#'
#' This implements the modified MR-Egger model with the Genotype Recoding Invariant Property (MR-GRIP) due to Dudbridge and Bowden et al. (2025).
#' This implements the modified MR-Egger model with the Genotype Recoding Invariance Property (MR-GRIP) due to Dudbridge and Bowden et al. (2025).
#' It is well known that the results of MR-Egger are sensitive to which alleles are designated as the effect alleles.
#' A pragmatic convention is to orient all SNPs to have positive effects on the exposure, which has some advantages in interpretation but also brings some philosophical limitations.
#' The MR-GRIP model is a modification to the MR-Egger model in which each term is multiplied by the genotype-phenotype associations.
Expand Down Expand Up @@ -61,17 +61,17 @@ mr_grip <- function(b_exp, b_out, se_exp, se_out, parameters) {
smod <- summary(mod)
b <- stats::coefficients(smod)[2, 1]
se <- stats::coefficients(smod)[2, 2]
b.adj <- NA
se.adj <- NA
pval.adj <- NA
b.wi <- NA
se.wi <- NA
pval.wi <- NA
pval <- 2 * stats::pt(abs(b / se), length(b_exp) - 2L, lower.tail = FALSE)
return(list(
b = b,
se = se,
pval = pval,
b.adj = b.adj,
se.adj = se.adj,
pval.adj = pval.adj,
b.wi = b.wi,
se.wi = se.wi,
pval.wi = pval.wi,
nsnp = length(b_exp),
mod = smod,
dat = dat
Expand Down
4 changes: 2 additions & 2 deletions R/multivariable_mr.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ mv_extract_exposures <- function(id_exposure, clump_r2=0.001, clump_kb=10000, ha
#' Note that you can provide an array of column names for each column, which is of length `filenames_exposure`
#'
#' @param filenames_exposure Filenames for each exposure dataset. Must have header with at least SNP column present. Following arguments are used for determining how to read the filename and clumping etc.
#' @param sep Specify delimeter in file. The default is space, i.e. `sep=" "`. If length is 1 it will use the same `sep` value for each exposure dataset. You can provide a vector of values, one for each exposure dataset, if the values are different across datasets. The same applies to all dataset-formatting options listed below.
#' @param sep Specify delimiter in file. The default is space, i.e. `sep=" "`. If length is 1 it will use the same `sep` value for each exposure dataset. You can provide a vector of values, one for each exposure dataset, if the values are different across datasets. The same applies to all dataset-formatting options listed below.
#' @param phenotype_col Optional column name for the column with phenotype name corresponding the the SNP. If not present then will be created with the value `"Outcome"`. Default is `"Phenotype"`.
#' @param snp_col Required name of column with SNP rs IDs. The default is `"SNP"`.
#' @param beta_col Required for MR. Name of column with effect sizes. THe default is `"beta"`.
#' @param beta_col Required for MR. Name of column with effect sizes. The default is `"beta"`.
#' @param se_col Required for MR. Name of column with standard errors. The default is `"se"`.
#' @param eaf_col Required for MR. Name of column with effect allele frequency. The default is `"eaf"`.
#' @param effect_allele_col Required for MR. Name of column with effect allele. Must be "A", "C", "T" or "G". The default is `"effect_allele"`.
Expand Down
2 changes: 1 addition & 1 deletion R/other_formats.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dat_to_MRInput <- function(dat, get_correlations=FALSE, pop="EUR")

#' Harmonise LD matrix against summary data
#'
#' LD matrix returns with rsid_ea_oa identifiers. Make sure that they are oriented to the same effect allele as the summary dataset. Summary dataset can be exposure dataset or harmonised dartaset.
#' LD matrix returns with rsid_ea_oa identifiers. Make sure that they are oriented to the same effect allele as the summary dataset. Summary dataset can be exposure dataset or harmonised dataset.
#'
#' @param x Exposure dataset or harmonised dataset
#' @param ld Output from [ld_matrix()]
Expand Down
6 changes: 3 additions & 3 deletions R/read_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#'
#' @param filename Filename. Must have header with at least SNP column present.
#' @param snps SNPs to extract. If `NULL`, which the default, then doesn't extract any and keeps all.
#' @param sep Specify delimeter in file. The default is space, i.e. `sep=" "`.
#' @param sep Specify delimiter in file. The default is space, i.e. `sep=" "`.
#' @param phenotype_col Optional column name for the column with phenotype name corresponding the the SNP. If not present then will be created with the value `"Outcome"`. Default is `"Phenotype"`.
#' @param snp_col Required name of column with SNP rs IDs. The default is `"SNP"`.
#' @param beta_col Required for MR. Name of column with effect sizes. THe default is `"beta"`.
#' @param beta_col Required for MR. Name of column with effect sizes. The default is `"beta"`.
#' @param se_col Required for MR. Name of column with standard errors. The default is `"se"`.
#' @param eaf_col Required for MR. Name of column with effect allele frequency. The default is `"eaf"`.
#' @param effect_allele_col Required for MR. Name of column with effect allele. Must be "A", "C", "T" or "G". The default is `"effect_allele"`.
Expand Down Expand Up @@ -64,7 +64,7 @@ read_outcome_data <- function(filename, snps=NULL, sep=" ", phenotype_col="Pheno
#'
#' @param filename Filename. Must have header with at least SNP column present.
#' @param clump Whether to perform LD clumping with [clump_data()] on the exposure data. The default is `FALSE`.
#' @param sep Specify delimeter in file. The default is a space, i.e. `" "`.
#' @param sep Specify delimiter in file. The default is a space, i.e. `" "`.
#' @param phenotype_col Optional column name for the column with phenotype name corresponding the the SNP. If not present then will be created with the value "Outcome". The default is `"Phenotype"`.
#' @param snp_col Required name of column with SNP rs IDs. The default is `"SNP"`.
#' @param beta_col Required for MR. Name of column with effect sizes. The default is `"beta"`.
Expand Down
6 changes: 3 additions & 3 deletions R/steiger.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' \describe{
#' \item{vz}{Total volume of the error parameter space}
#' \item{vz0}{Volume of the parameter space that gives the incorrect answer}
#' \item{vz1}{Volume of the paramtere space that gives the correct answer}
#' \item{vz1}{Volume of the parameter space that gives the correct answer}
#' \item{sensitivity_ratio}{Ratio of vz1/vz0. Higher means inferred direction is less susceptible to measurement error}
#' \item{pl}{plot of parameter space}
#' }
Expand Down Expand Up @@ -92,7 +92,7 @@ steiger_sensitivity <- function(rgx_o, rgy_o, ...)
#' \item{steiger_test_adj}{p-value for inference of direction of causality for given measurement error parameters}
#' \item{vz}{Total volume of the error parameter space}
#' \item{vz0}{Volume of the parameter space that gives the incorrect answer}
#' \item{vz1}{Volume of the paramtere space that gives the correct answer}
#' \item{vz1}{Volume of the parameter space that gives the correct answer}
#' \item{sensitivity_ratio}{Ratio of vz1/vz0. Higher means inferred direction is less susceptible to measurement error}
#' \item{sensitivity_plot}{Plot of parameter space of causal directions and measurement error}
#' }
Expand Down Expand Up @@ -223,7 +223,7 @@ directionality_test <- function(dat)
#' \item{steiger_test_adj}{p-value for inference of direction of causality for given measurement error parameters}
#' \item{vz}{Total volume of the error parameter space}
#' \item{vz0}{Volume of the parameter space that gives the incorrect answer}
#' \item{vz1}{Volume of the paramtere space that gives the correct answer}
#' \item{vz1}{Volume of the parameter space that gives the correct answer}
#' \item{sensitivity_ratio}{Ratio of vz1/vz0. Higher means inferred direction is less susceptible to measurement error}
#' \item{sensitivity_plot}{Plot of parameter space of causal directions and measurement error}
#' }
Expand Down
2 changes: 1 addition & 1 deletion man/forest_plot.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/harmonise_ld_dat.Rd

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

4 changes: 2 additions & 2 deletions man/mr_grip.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_steiger.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_steiger2.Rd

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

4 changes: 2 additions & 2 deletions man/mv_extract_exposures_local.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/read_exposure_data.Rd

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

4 changes: 2 additions & 2 deletions man/read_outcome_data.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/sort_1_to_many.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/steiger_sensitivity.Rd

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

Loading
Loading