Learn R Programming

methylKit (version 0.9.5)

regionCounts: Get regional counts for given GRanges or GRangesList object

Description

Convert methylRaw, methylRawList or methylBase object into regional counts for a given GRanges or GRangesList object.

Usage

regionCounts(object,regions,cov.bases=0,strand.aware=FALSE)

Arguments

object

a methylRaw or methlRawList object

regions

a GRanges or GRangesList object. Make sure that the GRanges objects are unique in chr,start,end and strand columns.You can make them unique by using unique() function.

cov.bases

number minimum bases covered per region (Default:0). Only regions with base coverage above this threshold are returned.

strand.aware

if set to TRUE only CpGs that match the strand of the region will be summarized. (default:FALSE)

Value

a new methylRaw,methylBase or methylRawList object. If strand.aware is set to FALSE (default). Even though the resulting object will have the strand information of regions it will still contain methylation information from both strands.

Examples

Run this code
# NOT RUN {
data(methylKit)

# get the windows of interest as a GRanges object, this can be any set
# of genomic locations
library(GenomicRanges)
my.win=GRanges(seqnames="chr21",
ranges=IRanges(start=seq(from=9764513,by=10000,length.out=20),width=5000) )

# getting counts per region
regional.methylRaw=regionCounts(object=methylRawList.obj, regions=my.win,
cov.bases=0,strand.aware=FALSE)
# }

Run the code above in your browser using DataLab