Description Usage Arguments Details Value Author(s) References See Also Examples
Splits a GRanges
object into a
GRangesList
1 2 | ## S4 method for signature 'GRanges,GRangesList'
split(x, f)
|
x |
object of class |
f |
object of class |
This function splits a GRanges
object
x
along a GRangesList
object f
.
More specifically, each region in x
is checked for overlaps
with every list component of f
. The function returns a
GRangesList
object each component of which
contains all overlaps of x
with one of the components of
f
. If the overlap is empty, this component is discarded.
This function is mainly made for splitting regions of interests (transcripts, exons, regions targeted by exome capturing) along chromosomes (and pseudoautosomal regions).
The returned object inherits sequence infos (chromosome names,
chromosome lengths, genome, etc.) from the
GRangesList
object f
.
For greater universality, the function takes strand information
into account. If overlaps should not be determined in a
strand-specific manner, all strand information must be discarded from
x
and f
before calling split
.
a GRangesList
object (see details above)
Ulrich Bodenhofer bodenhofer@bioinf.jku.at
http://www.bioinf.jku.at/software/podkat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## set up toy example
chr1 <- GRanges(seqnames="chr1", ranges=IRanges(start=1, end=200000))
chr2 <- GRanges(seqnames="chr2", ranges=IRanges(start=1, end=180000))
grL <- GRangesList(list(chr1=chr1, chr2=chr2))
seqlevels(grL) <- c("chr1", "chr2")
seqlengths(grL) <- c(chr1=200000, chr2=180000)
grL
## split set of regions given as 'GRanges' object
gr <- GRanges(seqnames=c("chr1", "chr1", "chr2", "chr2", "chr2"),
ranges=IRanges(start=c(1, 30000, 10000, 51000, 110000),
end=c(340, 37000, 10100, 61000, 176000)))
gr
split(gr, grL)
## consider transcripts on the X chromosome, but with pseudoautosomal
## regions treated separately
if (require(TxDb.Hsapiens.UCSC.hg38.knownGene))
{
data(hg38Unmasked)
hg38tr <- transcripts(TxDb.Hsapiens.UCSC.hg38.knownGene)
strand(hg38tr) <- "*"
split(hg38tr, hg38Unmasked[c("chrX", "X.PAR1", "X.PAR2", "X.XTR")])
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.