Returns p-values and Z-scores for CpGs in a set of regions, compared to a local null background distribution.

getRegionScores(ranks, regions,  chromDictObj)

Arguments

ranks

getPCRanks output data.frame, only necessary if chromDictObj=NULL

regions

A three-column dataframe containing a set of regions to test. Columns = chrom, start, end.

chromDictObj

chromDict() output object, recommended input instead of ranks.

Value

Returns a data.frame with significance scores for all input regions.

Examples

ranks <- getPCRanks(eigen, IDs = c("trt", "ctl"), PC = 1)
DMLs <- addRanks(ranks)

# data.frame of regions to test:
regions <- data.frame(chr=c("chr3", "chr3", "chr1"),
                      s=c(4920450, 3961576, 300000),
                      e=c(4923267, 3963805, 302900),
                      ID=c("Hypo-DMR", "partial Hyper-DMR", "random"))
                
getRegionScores(DMLs, regions)
#> Creating chromDict Object. If you plan to run the getRegionScores() function multiple times, it is strongly recommended to generate a chromDict Object with the chromDict() function, and specify it with getRegionScores(..., chromDictObj=OBJECT). This is the most computationally intensive part of most PCBS functions, and only needs to be done once per dataset.
#> Getting Background Sites...
#> Checking significance at 3 sites...
#>   chrom   start     end           feature       meanPC nCpG          Z
#> 1  chr3 4920450 4923267          Hypo-DMR -0.020963435   24 -4.5222576
#> 2  chr3 3961576 3963805 partial Hyper-DMR  0.008092709    8  1.8522800
#> 3  chr1  300000  302900            random -0.003612135    8 -0.9741492
#>              p
#> 1 9.146579e-08
#> 2 1.373174e-06
#> 3 9.043174e-04