R/read_magma_genes_out.R

Defines functions read_magma_genes_out

Documented in read_magma_genes_out

#' Read a \emph{.genes.out} file 
#' 
#' Read a \emph{.genes.out} file  generated by
#'  \link[MAGMA.Celltyping]{map_snps_to_genes} 
#'  as a \link[data.table]{data.table}.
#' @param path Path to a MAGMA \emph{.genes.out} file.
#' @param verbose Print messages.
#' @returns \link[data.table]{data.table}
#' 
#' @keywords internal
#' @importFrom data.table fread setnames :=
read_magma_genes_out <- function(path,
                                 verbose = TRUE){
    entrez <- NULL;
    messager("Importing genes.out file.",v=verbose)
    magma <- data.table::fread(path) 
    data.table::setnames(magma,"GENE","entrez") 
    magma[,entrez:=as.character(entrez)]
    magma <- merge(
        x = magma,
        y = MAGMA.Celltyping::hgnc2entrez_orthogene,
        by = "entrez"
    )
    return(magma)
}
NathanSkene/MAGMA_Celltyping documentation built on Oct. 11, 2024, 7:19 a.m.