R/whichtissues.R

Defines functions whichtissues

Documented in whichtissues

#' @title Identify the tissues where a set of genes are expressed
#'
#' @description Identifies which tissues express genes
#'
#' @param g gene list
#' @param refset reference map. developing (default) or adult
#' @return Tissue regions
#'
#' @examples
#' #brainImageR:::loadworkspace()
#' genes <- c("HOXB9", "HOXB10", "VIM")
#' #whichtissues(genes, refset = "developing")
#' @export whichtissues


whichtissues <- function(g, refset = c("developing", "adult")){
    refset <- tolower(match.arg(refset))
    if (refset == "developing"){
        abatissues <- .cache[["EH1445"]]
    }else if (refset == "adult"){
        abatissues <- .cache[["EH1446"]]
    }else{
        stop("Please choose refset = developing or adult.")
    }
    if (length(g) == 1){
        a2 <- colSums(abatissues[g,])
        a2 <- a2[a2 !=0]
    }else{
        a2 <- abatissues[g,]
        a2 <- stats::na.exclude(a2)
        a2 <- a2[,colSums(a2) != 0]
    }
    return(a2)
}

Try the brainImageR package in your browser

Any scripts or data that you put into this service are public.

brainImageR documentation built on May 6, 2019, 3:54 a.m.