Calculates expected partiton overlap based on contribution of each feature (partition) to genome size. Expected and observed overlaps are then compared.

calcExpectedPartitions(
  query,
  partitionList,
  genomeSize = NULL,
  remainder = "intergenic",
  bpProportion = FALSE
)

Arguments

query

GRanges or GRangesList with regions to classify.

partitionList

An ORDERED (if bpProportion=FALSE) and NAMED list of genomic partitions GRanges. This list must be in priority order; the input will be assigned to the first partition it overlaps. However, if bpProportion=TRUE, the list does not need ordering.

genomeSize

The number of bases in the query genome. In other words, the sum of all chromosome sizes.

remainder

Which partition do you want to account for 'everything else'?

bpProportion

logical indicating if overlaps should be calculated based on number of base pairs overlapping with each partition. bpProportion=FALSE does overlaps in priority order, bpProportion=TRUE counts number of overlapping base pairs between query and each partition.

Value

A data.frame assigning each element of a GRanges object to a partition from a previously provided partitionList.The data.frame also contains Chi-square p-values calculated for observed/expected overlaps on each individual partition.

Examples

partitionList = genomePartitionList(geneModels_hg19$genesGR,
                                    geneModels_hg19$exonsGR,
                                    geneModels_hg19$threeUTRGR,
                                    geneModels_hg19$fiveUTRGR)
chromSizes = getChromSizes('hg19')
genomeSize = sum(chromSizes)
calcExpectedPartitions(vistaEnhancers, partitionList, genomeSize)
#> Warning: Chi-squared approximation may be incorrect
#>       partition observed   expected     log10OE Chi.square.pval
#> 1: promoterCore        5   0.801438  0.79510006         0.18400
#> 2: promoterProx       12  15.218192 -0.10318181         0.66900
#> 3:     threeUTR       12  16.693035 -0.14335406         0.48800
#> 4:      fiveUTR       11   4.461866  0.39187614         0.15800
#> 5:         exon       30  18.931636  0.19993312         0.14600
#> 6:       intron      441 510.750772 -0.06377044         0.00551
#> 7:   intergenic      828 772.143061  0.03033256         0.03060
#>                                                          method
#> 1: Pearson's Chi-squared test with Yates' continuity correction
#> 2: Pearson's Chi-squared test with Yates' continuity correction
#> 3: Pearson's Chi-squared test with Yates' continuity correction
#> 4: Pearson's Chi-squared test with Yates' continuity correction
#> 5: Pearson's Chi-squared test with Yates' continuity correction
#> 6: Pearson's Chi-squared test with Yates' continuity correction
#> 7: Pearson's Chi-squared test with Yates' continuity correction