if (interactive()){
##Display the list of genomes available at UCSC:
#library(rtracklayer)
#ucscGenomes()[, "db"]
## Display the list of Tracks supported by makeTxDbFromUCSC()
#supportedUCSCtables()
##Retrieving a full transcript dataset for Human from UCSC
##TranscriptDb <-
## makeTxDbFromUCSC(genome="hg19", tablename="ensGene")
if(require(TxDb.Hsapiens.UCSC.hg19.knownGene)){
TxDb <- TxDb.Hsapiens.UCSC.hg19.knownGene
exons <- exons(TxDb, columns=NULL)
fiveUTRs <- unique(unlist(fiveUTRsByTranscript(TxDb)))
Feature.distribution <-
assignChromosomeRegion(exons, nucleotideLevel=TRUE, TxDb=TxDb)
barplot(Feature.distribution$percentage)
assignChromosomeRegion(fiveUTRs, nucleotideLevel=FALSE, TxDb=TxDb)
data(myPeakList)
assignChromosomeRegion(myPeakList, nucleotideLevel=TRUE,
precedence=c("Promoters", "immediateDownstream",
"fiveUTRs", "threeUTRs",
"Exons", "Introns"),
TxDb=TxDb)
}
}
Run the code above in your browser using DataLab