Learn R Programming

GenomicAlignments (version 1.2.2)

mapCoords-methods: Mapping ranges between sequences

Description

A method for translating a set of input ranges through a GAlignments object. Returns a GenomicRanges object.

NOTE: The mapCoords generic function is defined and documented in the IRanges package. A method for translating a set of input ranges through a GRangesList object is defined and documented in the GenomicRanges package.

Usage

"mapCoords"(x, to, ...)

Arguments

x
The input ranges to map, usually a GRanges.
to
The alignment between the sequences in x and the sequences in the result.
...
Arguments passed to other methods.

Value

A GRanges object of mapped coordinates with matching data as metadata columns (`queryHits` and `subjectHits`).Matching data are the result of calling findOverlaps with type `within` on ranges in x (the query) and the ranges in to (the subject). Matching can be many-to-one or one-to-many; one row is reported for each match.

Details

Each element in to is taken to represent the alignment of a (read) sequence. The CIGAR string is used to translate the input ranges to be relative to the read start. This is useful, for example, when determining the cycle (read position) at which a particular genomic mismatch occurs.

See Also

The generic mapCoords-methods in the IRanges package.

Examples

Run this code
bf <- system.file("extdata", "ex1.bam", package="Rsamtools", mustWork=TRUE)
gal <- readGAlignmentsFromBam(bf)
gr <- GRanges(c("seq1", "seq1", "seq2"), IRanges(c(3, 69, 1529), width=5)) 
mapCoords(gr, gal)

Run the code above in your browser using DataLab