R/transcriptDB_mod.R

Defines functions transcriptDB_mod

Documented in transcriptDB_mod

#' transcriptDB_mod
#' 
#' modifies the Gene model output from a transcriptDb object so that the intron intronic regions can be visualized on the plot
#' @param wh The genes of interest for this model
#' @param introns Data Frame of the regions of the genome that are intronic
#' @return object that specifies what the the genes of interest are
#' @import ggplot2
#' @import TxDb.Hsapiens.UCSC.hg19.knownGene
#' @export
#' @references Based off of the ggbio documentation available on bioconductor: 
#' http://bioconductor.org/packages/release/bioc/vignettes/ggbio/inst/doc/ggbio.pdf
#' Original Author: Tengfei Yin


transcriptDB_mod <- function(gene1, gene2, introns) {
  
  # input should be "BRCA1" and "NBR1" to test
  wh <- genesymbol[c(gene1, gene2)]
  wh <- range(wh, ignore.strand = TRUE)
  
  #creating a gene model from an example TranscriptDb object
  txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
  p <- autoplot(txdb, which = wh)
  print(p)
  
  #printing out modified plots with introns displayed
  p <- add_intron(p, introns)
  print(p)
  
  return(p)
}
cheejus2/Intron_Vis documentation built on Dec. 8, 2019, 10:35 a.m.