Is there an easy way to plot only exons, not introns? Consider:
gr <- GenomicRanges::GRanges(17, IRanges(start = c(5,20,30,50), end = c(10,25,40,60))) mcols(gr)$transcript <- "test" tr <- Gviz::GeneRegionTrack(gr) Gviz::plotTracks(tr)
Which plots this:

How could I plot this without the introns? With the exons "smacked together", so to speak? I was imagining something like this:
Gviz::plotTracks( tr, ranges = gr )


Hey, I just want to comment a convenient way to do this, for anyone who might look at it. It can be done with:
And this is just the intended transformation of the exons.
GRangesList object of length 1: $42 GRanges object with 13 ranges and 3 metadata columns: seqnames ranges strand | exon_id exon_name exon_rank <Rle> <IRanges> <Rle> | <integer> <character> <integer> [1] chr1 [861302, 861393] + | 36 <NA> 1 [2] chr1 [865535, 865716] + | 37 <NA> 2 [3] chr1 [866419, 866469] + | 38 <NA> 3 [4] chr1 [871152, 871276] + | 39 <NA> 4 [5] chr1 [874420, 874509] + | 42 <NA> 5 ... ... ... ... . ... ... ... [9] chr1 [877790, 877868] + | 51 <NA> 9 [10] chr1 [877939, 878438] + | 53 <NA> 10 [11] chr1 [878633, 878757] + | 54 <NA> 11 [12] chr1 [879078, 879188] + | 55 <NA> 12 [13] chr1 [879288, 879961] + | 58 <NA> 13 ------- seqinfo: 93 sequences (1 circular) from hg19 genomeGRanges object with 13 ranges and 2 metadata columns: seqnames ranges strand | xHits transcriptsHits <Rle> <IRanges> <Rle> | <integer> <integer> [1] 42 [ 1, 92] + | 1 1 [2] 42 [ 93, 274] + | 2 1 [3] 42 [275, 325] + | 3 1 [4] 42 [326, 450] + | 4 1 [5] 42 [451, 540] + | 5 1 ... ... ... ... . ... ... [9] 42 [ 930, 1008] + | 9 1 [10] 42 [1009, 1508] + | 10 1 [11] 42 [1509, 1633] + | 11 1 [12] 42 [1634, 1744] + | 12 1 [13] 42 [1745, 2418] + | 13 1 ------- seqinfo: 1 sequence from an unspecified genome; no seqlengths