Skip to content

Commit

Permalink
Fixed covar not being allowed to be NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjvincent committed Jan 31, 2019
1 parent d471bb6 commit ac672b9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/mediation.scan.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ mediation.scan <- function(target,
stopifnot(NROW(target) == NROW(mediator))
stopifnot(NROW(annotation) == NCOL(mediator))
stopifnot(NROW(qtl.geno) == NROW(target))
stopifnot(is.null(covar) | NROW(target) == NROW(covar))
stopifnot(!any(is.na(covar)))
stopifnot(!any(is.na(qtl.geno)))
stopifnot(all(is.numeric(target[,1])))
stopifnot(all(is.numeric(mediator)))
stopifnot(all(is.numeric(qtl.geno)))
stopifnot(all(is.numeric(covar)))
stopifnot(c("CHR", "MIDDLE_POINT") %in% toupper(names(annotation)))
method = match.arg(method)

if (!is.null(covar)) {
stopifnot(NROW(target) == NROW(covar))
stopifnot(!any(is.na(covar)))
stopifnot(all(is.numeric(covar)))
}


# data preparation
mediator <- cbind(mediator) # to ensure 'mediator' is a matrix
N <- ncol(mediator) # number of points to scan
Expand Down

0 comments on commit ac672b9

Please sign in to comment.