Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
explodecomputer committed Nov 5, 2019
1 parent 2382513 commit f3b55c9
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 210 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
^mrbase\.oauth$
^mrbase\.oauth2$
^LICENSE\.md$
^\.travis\.yml$
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: r
r:
- release
- devel
cache: packages

r_github_packages:
- rondolab/MR-PRESSO
- mrcieu/MRInstruments
- mrcieu/ieugwasr
- mrcieu/MRInstruments
- WSpiller/RadialMR
- gqi/MRMix

r_packages:
- covr

after_success:
- Rscript -e 'library(covr); codecov()'
28 changes: 17 additions & 11 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.4.25
Version: 1.0.0
Authors@R: c(person("Gibran", "Hemani", email = "[email protected]",
role = c("aut", "cre")),
person("Philip", "Haycock", email = "[email protected]",
Expand All @@ -15,7 +15,7 @@ Authors@R: c(person("Gibran", "Hemani", email = "[email protected]",
Description: See title
Depends:
R (>= 3.1.0)
Suggests:
Imports:
ggplot2,
gridExtra,
cowplot,
Expand All @@ -26,21 +26,27 @@ Suggests:
markdown,
gtable,
rmarkdown,
MRInstruments,
MendelianRandomization,
MRPRESSO,
dplyr,
igraph,
mr.raps,
RadialMR,
psych,
testthat,
randomForest
Imports:
ieugwasr,
randomForest,
meta,
data.table
License: Artistic-2.0
data.table,
ieugwasr,
MRPRESSO,
MRInstruments,
RadialMR,
MRMix
Remotes:
rondolab/MR-PRESSO,
mrcieu/MRInstruments,
mrcieu/ieugwasr,
mrcieu/MRInstruments,
WSpiller/RadialMR,
gqi/MRMix
License: MIT + file LICENSE
LazyData: true
VignetteBuilder: knitr
RoxygenNote: 6.1.1
Expand Down
187 changes: 2 additions & 185 deletions LICENSE

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions R/forest_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@
#' @param returnRobj = (logical) return the graph as an internal R object y/n?
#'
#' @return grid object giving the forest plot (or plot as pdf, and )
#'
#' @examples
#' mr_forest_plot()
#'

mr_forest_plot_grouped <-
function(name, eff_Col = "b", exposure_Name="exposure", outcome_Name="outcome", forest_Title = '', outfile_Name = 'annot_FP.pdf', left_Col_Names=c("Exposure", "Outcome"), left_Col_Titles = NULL, right_Col_Names = c("p", "Outcome.n.case", "Outcome.n.control", "Outcome.sample.size"), right_Col_Titles =
NULL, debug = FALSE, log_ES = FALSE, decrease = TRUE, returnRobj = TRUE, se_Col = "se") {
Expand Down
3 changes: 2 additions & 1 deletion R/moe.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ get_rsq <- function(dat)
#' @export
#' @return List
#' @examples
#'
#' \dontrun{
#' # Load libraries
#' library(dplyr)
#' library(randomForest)
Expand All @@ -204,6 +204,7 @@ get_rsq <- function(dat)
#' # been sorted in order from most likely to least likely to
#' # be accurate, based on MOE prediction
#' r[[1]]$estimates
#'}
mr_moe <- function(res, rf)
{
require(dplyr)
Expand Down
18 changes: 16 additions & 2 deletions R/steiger_filtering.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ steiger_filtering <- function(dat)

steiger_filtering_internal <- function(dat)
{
if(! "units.outcome" %in% names(dat))
{
dat$units.outcome <- NA
}
if(! "units.exposure" %in% names(dat))
{
dat$units.exposure <- NA
}
stopifnot(length(unique(dat$exposure)) == 1)
stopifnot(length(unique(dat$outcome)) == 1)
stopifnot(length(unique(dat$units.exposure)) == 1)
Expand All @@ -27,7 +35,7 @@ steiger_filtering_internal <- function(dat)
if(!"rsq.exposure" %in% names(dat))
{
dat$pval.exposure[dat$pval.exposure < 1e-300] <- 1e-300
if(dat$units.exposure[1] == "log odds")
if(compareNA(dat$units.exposure[1], "log odds"))
{
# message("Estimating rsq.exposure for binary trait")
# message("Ensure that beta.exposure, eaf.exposure, ncase.exposure, ncontrol.exposure are all specified with no missing values")
Expand Down Expand Up @@ -71,7 +79,7 @@ steiger_filtering_internal <- function(dat)
if(!"rsq.outcome" %in% names(dat))
{
dat$pval.outcome[dat$pval.outcome < 1e-300] <- 1e-300
if(dat$units.outcome[1] == "log odds")
if(compareNA(dat$units.outcome[1], "log odds"))
{
if(! "prevalence.outcome" %in% names(dat))
{
Expand Down Expand Up @@ -121,3 +129,9 @@ steiger_filtering_internal <- function(dat)
return(dat)
}


compareNA <- function(v1,v2) {
same <- (v1 == v2) | (is.na(v1) & is.na(v2))
same[is.na(same)] <- FALSE
return(same)
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Two Sample MR

[![DOI](https://zenodo.org/badge/49515156.svg)](https://zenodo.org/badge/latestdoi/49515156)
<!-- badges: start -->
[![Travis build status](https://travis-ci.org/MRCIEU/TwoSampleMR.svg?branch=master)](https://travis-ci.org/MRCIEU/TwoSampleMR) [![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)
<!-- badges: end -->

Extended documentation is available here:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions man/mr_forest_plot_grouped.Rd

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

3 changes: 2 additions & 1 deletion man/mr_moe.Rd

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

4 changes: 4 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(TwoSampleMR)

test_check("TwoSampleMR")

0 comments on commit f3b55c9

Please sign in to comment.