Get sequential, potentially annotated regions of a fixed lengths (tiles) along chromosomes of a genome.
The genome to work on. Either a BSgenome
object, a character
scalar with the name of an installed BSgenome
or with a file path and name pointing to a fasta file with the genome sequence,
or a named numeric
vector giving the names and lengths of chromosomes.
numeric
scalar with the tile length.
Named list
s with
GRanges
or GRangesList
object(s) used to annotate genomic tiles. See annotateRegions
for details.
logical
scalar. If TRUE
and primary sequence
can be obtained from genome
, also add sequence composition features
for each tile to the annotations. Currently, the following features are
included: percent of G+C bases ("percGC"), CpG observed-over-expected ratio
("CpGoe").
A GRanges
object with genome tiling regions.
Optional tile annotations are contained in its metadata columns (mcols
).
The last tile in each chromosome is dropped if it would be shorter
than tileWidth
. Generated tiles are unstranded (*
) and
therefore overlaps or searching for nearest neighbors are ignoring
strands of annotations (ignore.strand=TRUE
).
tileGenome
and annotateRegions
used by getGenomicTiles
internally.
library(GenomicRanges)
tss <- GRanges("chr1", IRanges(c(1, 10, 30), width = 1,
names = paste0("t", 1:3)))
blacklist <- GRanges("chr1", IRanges(20, width = 5))
getGenomicTiles(c(chr1 = 45, chr2 = 12), tileWidth = 10,
hasOverlap = list(Blacklist = blacklist),
fracOverlap = list(Blacklist = blacklist),
numOverlap = list(TSS = tss),
nearest = list(TSS = tss))
#> Warning: ignoring 'addSeqComp' (sequence not available from 'genome')
#> GRanges object with 5 ranges and 6 metadata columns:
#> seqnames ranges strand | Blacklist.hasOverlap Blacklist.fracOverlap
#> <Rle> <IRanges> <Rle> | <logical> <numeric>
#> [1] chr1 1-10 * | FALSE 0.0
#> [2] chr1 11-20 * | TRUE 0.1
#> [3] chr1 21-30 * | TRUE 0.4
#> [4] chr1 31-40 * | FALSE 0.0
#> [5] chr2 1-10 * | FALSE 0.0
#> TSS.numOverlapWithin TSS.numOverlapAny TSS.nearestName
#> <integer> <integer> <character>
#> [1] 2 2 t1
#> [2] 0 0 t2
#> [3] 1 1 t3
#> [4] 0 0 t3
#> [5] 0 0 <NA>
#> TSS.nearestDistance
#> <integer>
#> [1] 0
#> [2] 0
#> [3] 0
#> [4] 0
#> [5] <NA>
#> -------
#> seqinfo: 2 sequences from an unspecified genome