Skip to content

Update returned harmonized data object + NEWS to v0.0.3.4#27

Open
lcpilling wants to merge 6 commits inton-mounier:masterfrom
lcpilling:master
Open

Update returned harmonized data object + NEWS to v0.0.3.4#27
lcpilling wants to merge 6 commits inton-mounier:masterfrom
lcpilling:master

Conversation

@lcpilling
Copy link
Copy Markdown
Contributor

Changes:

  1. MRlap now returns the "harmonised_mr_data" i.e., the IVs used in the IVW. This PR updates the naming to be consistent with format for TwoSampleMR::mr() -- see below example -- we were finding it a bit tedious to keep formatting the data in multiple ways to perform additional downstream sensitivity analysis
  2. The "NEWS" was a few versions out of date

Example of how update affects using MRlap in a pipeline:

# run standard MRlap analysis
mrlap_res = MRlap::MRlap(
  exposure = gwas1,
  exposure_name = "gwas1",
  outcome = gwas2,
  outcome_name = "gwas2",
  ld = ld,
  hm3 = hm3)

# get harmonised IVs
dat <- mrlap_res$harmonised_mr_data

# run other TwoSampleMR analyses
res <- TwoSampleMR::mr(dat)

# get scatter plot of IVs with "standard" estimates plotted
p1 <- TwoSampleMR::mr_scatter_plot(res, dat)
p[[1]]

# add MRlap corrected estimate line
p[[1]] + 
  ggplot2::geom_abline(intercept=0, slope=mrlap_res$MRcorrection$corrected_effect, color="red")

To be consistent with format for TwoSampleMR::mr()
@lcpilling
Copy link
Copy Markdown
Contributor Author

Another small quality of life improvement added to this branch... MRlap can now take GWAS catalog formatted summary statistics using their default headers

@lcpilling
Copy link
Copy Markdown
Contributor Author

Actually just realised it is really easy to bundle a data frame of the TwoSampleMR output with additional row for corrected IVW effect.

Means that the output of MRlap can be inspected a plotted very easily now:

# run standard MRlap analysis
mrlap_res = MRlap::MRlap(
  exposure = gwas1,
  exposure_name = "gwas1",
  outcome = gwas2,
  outcome_name = "gwas2",
  ld = ld,
  hm3 = hm3)

# check out results table
mrlap_res$results_table
#>   id.exposure id.outcome outcome exposure                                method nsnp         b         se        pval
#> 1        GORD        CRS     CRS     GORD             Inverse variance weighted   38 0.1258992 0.05436226 0.020562052
#> 2        GORD        CRS     CRS     GORD Inverse variance weighted (corrected)   38 0.1545762 0.07318573 0.034677164
#> 3        GORD        CRS     CRS     GORD                       Weighted median   38 0.1578384 0.05514316 0.004205286
#> 4        GORD        CRS     CRS     GORD                           Simple mode   38 0.2228619 0.11716894 0.064970474
#> 5        GORD        CRS     CRS     GORD                         Weighted mode   38 0.2078488 0.11262181 0.072972196
#> 6        GORD        CRS     CRS     GORD                              MR Egger   38 0.7187816 0.55849830 0.206311804

# get scatter plot of IVs with "standard" estimates & the new corrected estimate too
p1 <- TwoSampleMR::mr_scatter_plot(mrlap_res$results_table, mrlap_res$harmonised_mr_data)

I know trivial updates but just saves incremental time each time I run things

Correct link to my GitHub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant