R/rnagage.R

Defines functions rnagage

Documented in rnagage

#' rnagage function
#'
#' Uses gage to find enriched pathways from the RNAseq differential gene analysis
#'
#' @param rnadeg data frame generated by topTable of limma output
#' @param lookup data frame of entrez ID and gene name pairs
#'
#' @import gage
#' @import data.table
#'
#' @return data frame of RNAseq values for only patients in the high and low gene expression groups
#'
#' @examples
#' data(skcm)
#' gene <- "SOX10"
#' sox10.pat <- rnasubset(pat, rna, gene, 10)
#' sox10.deg <- rnadeg(sox10.pat, rna)
#' sox10.gage <- rnagage(sox10.deg, lookup)
#'
#' @export
#'
rnagage <- function(deg, lookup) {
  data(kegg.gs)
  limma.fc <- deg$logFC
  names(limma.fc) <- lookup$entrez[match(deg$genes, lookup$gene)]
  gage.fc <- gage(limma.fc, gsets = kegg.gs, ref = NULL, samp = NULL)
  gage.fc.g <- data.table(pathway = rownames(gage.fc$greater), gage.fc$greater, enrichment = "greater")
  gage.fc.l <- data.table(pathway = rownames(gage.fc$less), gage.fc$less, enrichment = "less")
  rbind(gage.fc.g[ q.val < 0.1], gage.fc.l[ q.val < 0.1])
}
pcheng84/TCGAbrowser documentation built on Sept. 7, 2021, 8:28 p.m.