shiftTranscriptToGenomic | R Documentation |
GRanges
coordinates based on another GRanges
objectshiftGenomicToTranscript
shifts positions of a
GRanges
object based on coordinates of another GRanges
object. The most common
application is to shift genomic coordinates to transcript coordinates, which
is reflected in the name. shiftTranscriptToGenomic
implements the
reverse operation.
Matches are determined by
findOverlaps
for
shiftGenomicToTranscript
and by
findMatches
for
shiftTranscriptToGenomic
using the seqnames
of the
subject
and the names
of tx
.
shiftTranscriptToGenomic(subject, tx)
shiftGenomicToTranscript(subject, tx)
## S4 method for signature 'GRanges,GRangesList'
shiftTranscriptToGenomic(subject, tx)
## S4 method for signature 'GRangesList,GRangesList'
shiftTranscriptToGenomic(subject, tx)
## S4 method for signature 'GRanges,GRangesList'
shiftGenomicToTranscript(subject, tx)
## S4 method for signature 'GRangesList,GRangesList'
shiftGenomicToTranscript(subject, tx)
subject |
a |
tx |
a named |
a GRanges
or
GRangesList
object depending
on the type of subject
library(GenomicRanges)
# Construct some example data
subject1 <- GRanges("chr1", IRanges(3, 6),
strand = "+")
subject2 <- GRanges("chr1", IRanges(c(17,23), width=3),
strand = c("+","-"))
subject3 <- GRanges("chr2", IRanges(c(51, 54), c(53, 59)),
strand = "-")
subject <- GRangesList(a=subject1, b=subject2, c=subject3)
tx1 <- GRanges("chr1", IRanges(1, 40),
strand="+")
tx2 <- GRanges("chr1", IRanges(10, 30),
strand="+")
tx3 <- GRanges("chr2", IRanges(50, 60),
strand="-")
tx <- GRangesList(a=tx1, b=tx2, c=tx3)
# shift to transcript coordinates. Since the third subject does not have
# a match in tx it is dropped with a warning
shifted_grl <- shiftGenomicToTranscript(subject,tx)
# ... and back
shifted_grl2 <- shiftTranscriptToGenomic(shifted_grl,tx)
# comparison of ranges work. However the seqlevels differ
ranges(shifted_grl2) == ranges(subject[list(1,c(1,1),c(1,2))])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.