convert_collapsed_coord {seqsetvis} | R Documentation

## convert_collapsed_coord

### Description

(preliminary implementation, sub-optimal)

### Usage

    convert_collapsed_coord(genome_gr, x)

### Arguments

`genome_gr` | non-contiguous regions to collapse a la `collapse_gr`
`x` | numeric, positions within genome_gr to convert to collapsed coordinates.

### Details

see `collapse_gr` for explanation of intended uses. this function translates all values of x from original genomic coordinates to new coordinate space created by `collapse_gr`.

### Value

numeric, positions of every value of x within collapse coordinates. values outside of collapsed regions (an intron or outside range) will be NA.

### Examples

    library(data.table)
    library(GenomicRanges)
    dev_dat = data.table(seqnames = "chrTest",
                         transcript_id = c(1, 1,  2, 2, 3, 3, 3),
                         start = c(5,  30,  8, 30, 2, 30, 40),
                         end = c(10, 35, 15, 38, 7, 35, 45),
                         strand = "+")

    genome_gr = GRanges(dev_dat)
    convert_collapsed_coord(genome_gr, start(genome_gr))
    convert_collapsed_coord(genome_gr, end(genome_gr))

[Package seqsetvis version 1.12.0 Index]