R/detect_genes.R

Defines functions detect_genes

Documented in detect_genes

#' Detect QTL genes in full summary stats file
#'
#' Allows summary stats from different genes to be
#' fine-mapped separately.
#' 
#' @param loci (Named) character vector of locus names.
#' @param verbose Print messages. 
#' 
#' @export
#' @importFrom dplyr n_distinct
#' @examples
#' #### No genes (names) ####
#' loci <- c("BST1","LRKR2","MEX3C")
#' detect_genes(loci)
#' 
#' #### Genes (names) ####
#' loci <- c(BST1="BST1", LRRK2="LRRK2", MEX3C="MEX3C")
#' echodata::detect_genes(loci)
detect_genes <- function(loci,
                         verbose=FALSE){
  if(!is.null(names(loci))){
    messager("Fine-mapping",dplyr::n_distinct(loci),
             "gene:Locus pairs.", v=verbose)
    return(TRUE)
  } else {
      messager("Fine-mapping",dplyr::n_distinct(loci),
                   "loci.", v=verbose) 
      return(FALSE)
  }
}
RajLabMSSM/echodata documentation built on Nov. 21, 2023, 8 a.m.