collapse_gr {seqsetvis} | R Documentation

## collapse_gr

### Description

collapse non-contiguous regions (i.e. exons) into a contiguous coordinate starting at 1. this is strand sensitive and intended for use with all exons of a single gene.

### Usage

    collapse_gr(genome_gr)

### Arguments

`genome_gr` | a GRanges of regions on a single chromosome. Regions are intended to be non-contiguous and may even overlap.

### Value

a new GRanges object with same mcols as input with all intervals starting at 1 and no empty space between syntenic regions.

### 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)
    collapse_gr(genome_gr)

    neg_gr = genome_gr
    strand(neg_gr) = "-"
    collapse_gr(neg_gr)

[Package seqsetvis version 1.7.5 Index]