Skip to contents

For each inversion flagged by flagInversions(), returns the region of the target genome between the left flank of the inversion triplet (the range carrying the flag) and its central range.

Usage

leftInversionGaps(gb, detect = TRUE)

Arguments

gb

A GBreaks object.

detect

Run again flagInversions() if TRUE, else reuse the inv flag. If the flag is absent, no gap is returned.

Value

Returns a GenomicRanges::GRanges object representing the left-side gaps in the GBreaks object, one per inversion. Its flagIndex metadata column contains the position in gb of the left flank of each inversion.

Note

When these two ranges are adjacent or overlap on the target genome, the gap is a zero-width range that starts after the end of the left flank.

Examples

leftInversionGaps(exampleInversion)
#> GRanges object with 1 range and 1 metadata column:
#>       seqnames    ranges strand | flagIndex
#>          <Rle> <IRanges>  <Rle> | <integer>
#>   [1]     chrA   191-209      * |         1
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome

# Reuse flags computed with a tolerance threshold
exampleInversion |> flagInversions(tol = 19) |> leftInversionGaps(detect = FALSE)
#> GRanges object with 1 range and 1 metadata column:
#>       seqnames    ranges strand | flagIndex
#>          <Rle> <IRanges>  <Rle> | <integer>
#>   [1]     chrA   191-209      * |         1
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome
exampleInversion |> flagInversions(tol = 18) |> leftInversionGaps(detect = FALSE)
#> GRanges object with 0 ranges and 1 metadata column:
#>    seqnames    ranges strand | flagIndex
#>       <Rle> <IRanges>  <Rle> | <integer>
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome