R/p_screen.R

Defines functions p_screen

Documented in p_screen

#' Compute screening P-value for one gene
#'
#' The function runs a modified version of P_ACT to test
#' hypothesis of at least one gene-transcript association
#'
#' @param teststat numeric, vector of TWAS Z-scores or P-values
#' @param mode character, is the teststat Z-scores or P-values?
#'
#' @return screen P-value for one gene
#'
#'
#' @importFrom mvtnorm pmvnorm
#' @importFrom ACAT ACAT
#'
#'
#' @export
p_screen <- function(teststat,
                     mode = 'P'){


    if (mode == 'Z'){

        P = 2*pnorm(-abs(teststat))

    } else {
        P = teststat
    }

    return(ACAT::ACAT(P))



}
bhattacharya-a-bt/isoTWAS documentation built on Jan. 9, 2025, 10:25 p.m.