R/check_entrez_genes.R

Defines functions check_entrez_genes

Documented in check_entrez_genes

#' Check ENTREZ genes
#' 
#' Check percentage of gene genes in \code{geneset} that have 
#' corresponding ENTREZ IDs. 
#' 
#' @keywords internal
check_entrez_genes <- function(geneset){
    n_valid <- sum(
        geneset %in% MAGMA.Celltyping::hgnc2entrez_orthogene$hgnc_symbol)
    if ((n_valid / length(geneset)) < 0.5) {
        stopper(
            "<50% of the geneset are recognised HGNC symbols",
            "with corresponding Entrez IDs.",
            "Check that ctd_species and geneset_species are set correctly."
        )
    }
}
NathanSkene/MAGMA_Celltyping documentation built on Aug. 21, 2023, 8:55 a.m.