ranges-chop: Group a GRanges object by introns or gaps

Description Usage Arguments Details Value Examples

Description

Group a GRanges object by introns or gaps

Usage

1
2
3

Arguments

x

a GenomicRanges object with a cigar string column

Details

Creates a grouped Ranges object from a cigar string column, for chop_by_introns() will check for the presence of "N" in the cigar string and create a new column called intron where TRUE indicates the alignment has a skipped region from the reference. For chop_by_gaps() will check for the presence of "N" or "D" in the cigar string and create a new column called "gaps" where TRUE indicates the alignment has a deletion from the reference or has an intron.

Value

a GRanges object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if (require(pasillaBamSubset)) {
   bamfile <- untreated1_chr4()
   # define a region of interest
   roi <- data.frame(seqnames = "chr4", start = 5e5, end = 7e5) %>%
            as_granges()
   # results in a grouped ranges object
   rng <- read_bam(bamfile) %>% 
            filter_by_overlaps(roi) %>%
            chop_by_gaps()
   # to find ranges that have gaps use filter with `n()`
   rng %>% filter(n() >= 2)
  
}

plyranges documentation built on Nov. 8, 2020, 7:36 p.m.