genomicElementDistribution: Genomic Element distribution

Description Usage Arguments Details Value Examples

View source: R/genomicElementDistribution.R

Description

Plot pie chart for genomic element distribution

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
genomicElementDistribution(
  peaks,
  TxDb,
  seqlev,
  nucleotideLevel = FALSE,
  ignore.strand = TRUE,
  promoterRegion = c(upstream = 2000, downstream = 100),
  geneDownstream = c(upstream = 0, downstream = 1000),
  labels = list(geneLevel = c(promoter = "Promoter", geneDownstream = "Downstream",
    geneBody = "Gene body", distalIntergenic = "Distal Intergenic"), ExonIntron = c(exon
    = "Exon", intron = "Intron", intergenic = "Intergenic"), Exons = c(utr5 = "5' UTR",
    utr3 = "3' UTR", CDS = "CDS", otherExon = "Other exon"), group = c(geneLevel =
    "Gene Level", promoterLevel = "Promoter Level", Exons = "Exon level", ExonIntron =
    "Exon/Intron/Intergenic")),
  labelColors = c(promoter = "#D55E00", geneDownstream = "#E69F00", geneBody =
    "#51C6E6", distalIntergenic = "#AAAAAA", exon = "#009DDA", intron = "#666666",
    intergenic = "#DDDDDD", utr5 = "#0072B2", utr3 = "#56B4E9", CDS = "#0033BF",
    otherExon = "#009E73"),
  plot = TRUE,
  promoterLevel
)

Arguments

peaks

peak list, GRanges object or a GRangesList.

TxDb

an object of TxDb

seqlev

sequence level should be involved. Default is all the sequence levels in intersect of peaks and TxDb.

nucleotideLevel

Logical. Choose between peak centric and nucleotide centric view. Default=FALSE

ignore.strand

logical. Whether the strand of the input ranges should be ignored or not. Default=TRUE

promoterRegion

numeric. The upstream and downstream of genes to define promoter region.

geneDownstream

numeric. The upstream and downstream of genes to define gene downstream region.

labels

list. A list for labels for the genomic elements.

labelColors

named character vector. The colors for each labels.

plot

logic. Plot the pie chart for the genomic elements or not.

promoterLevel

list. The breaks, labels, and colors for divided range of promoters. The breaks must be from 5' -> 3' and the percentage will use the fixed precedence 3' -> 5'

Details

The distribution will be calculated by geneLevel, ExonIntron, and Exons The geneLevel will be categorized as promoter region, gene body, gene downstream and distal intergenic region. The ExonIntron will be categorized as exon, intron and intergenic. The Exons will be categorized as 5' UTR, 3'UTR and CDS. The precedence will follow the order of labels defination. For example, for ExonIntron, if a peak overlap with both exon and intron, and exon is specified before intron, then only exon will be incremented for the same example.

Value

Invisible list of data for plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (interactive() || Sys.getenv("USER")=="jianhongou"){
  data(myPeakList)
  if(require(TxDb.Hsapiens.UCSC.hg19.knownGene)){
  seqinfo(myPeakList) <- 
  seqinfo(TxDb.Hsapiens.UCSC.hg19.knownGene)[seqlevels(myPeakList)]
  myPeakList <- GenomicRanges::trim(myPeakList)
  myPeakList <- myPeakList[width(myPeakList)>0]
    genomicElementDistribution(myPeakList, 
        TxDb.Hsapiens.UCSC.hg19.knownGene)
    genomicElementDistribution(myPeakList, 
        TxDb.Hsapiens.UCSC.hg19.knownGene,
        nucleotideLevel = TRUE)
    genomicElementDistribution(myPeakList, 
        TxDb.Hsapiens.UCSC.hg19.knownGene,
        promoterLevel=list(
        #from 5' -> 3', fixed precedence 3' -> 5'
        breaks = c(-2000, -1000, -500, 0, 100),
        labels = c("upstream 1-2Kb", "upstream 0.5-1Kb", 
                   "upstream <500b", "TSS - 100b"),
        colors = c("#FFE5CC", "#FFCA99", 
                   "#FFAD65", "#FF8E32")))
  }
}

ChIPpeakAnno documentation built on April 1, 2021, 6:01 p.m.