genomicDensity.Rd
Calculate genomic region density
genomicDensity( region, window.size = 1e7, n.window = NULL, overlap = TRUE, count_by = c("percent", "number"), chr.len = NULL)
region | Genomic positions. It can be a data frame with two columns which are start positions and end positions on a single chromosome. It can also be a bed-format data frame which contains the chromosome column. |
---|---|
window.size | Window size to calculate genomic density |
n.window | number of windows, if it is specified, |
overlap | Whether two neighbouring windows have half overlap |
count_by | How to count the value for each window, |
chr.len | the chromosome length. The value should be named vector |
It calculate the percent of each genomic windows that is covered by the input regions.
If the input is a two-column data frame, the function returns a data frame with three columns:
start position, end position and the overlapping (value depends on the count_by
argument). And if the input is a bed-format
data frame, there will be an additionally chromosome name column.
#> chr start end value #> 1 chr1 1 10000000 0.5174489 #> 2 chr1 5000001 15000000 0.5550511 #> 3 chr1 10000001 20000000 0.5354743 #> 4 chr1 15000001 25000000 0.5258289 #> 5 chr1 20000001 30000000 0.4530591 #> 6 chr1 25000001 35000000 0.5215807#> chr start end value #> 1 chr1 1 10000000 22 #> 2 chr1 5000001 15000000 28 #> 3 chr1 10000001 20000000 36 #> 4 chr1 15000001 25000000 36 #> 5 chr1 20000001 30000000 35 #> 6 chr1 25000001 35000000 32