getAnnotationLevels: Assign each genomic range a non-overlapping level value

View source: R/helpers.R

getAnnotationLevelsR Documentation

Assign each genomic range a non-overlapping level value

Description

This function takes a set of genomic ranges in GRanges-class object and assign to each range a unique level such that each range or group of ranges (if 'annotation.group' is defined) resides on different levels.

Usage

getAnnotationLevels(
  annot.gr = NULL,
  offset = NULL,
  annotation.group = NULL,
  direction = "positive"
)

Arguments

annot.gr

A GRanges-class object with a set of ranges to report unique non-overlapping levels for.

offset

A numeric value from which unique annotation levels start from.

annotation.group

A name of an extra field present in 'annot.gr' to be used to report unique levels for a set of ranges that belong to the same group.

direction

Set to 'positive' or 'negative' to make sure reported levels are either decreasing or increasing from the defined 'offset' (default: 'positive').

Value

A numeric vector of unique levels corresponding to submitted ranges via 'annot.gr'.

Author(s)

David Porubsky

Examples

## Define random set of ranges grouped by gene name
test.gr1 <- GenomicRanges::GRanges(
    seqnames = "target.region",
    ranges = IRanges::IRanges(
        start = c(19000000, 19030000, 19070000),
        end = c(19010000, 19050000, 19090000)
    )
)
test.gr1$ID <- "gene1"
test.gr2 <- GenomicRanges::shift(test.gr1, shift = 10000)
test.gr2$ID <- "gene2"
test.gr3 <- GenomicRanges::shift(test.gr1, shift = 90000)
test.gr3$ID <- "gene3"
test.gr <- c(test.gr1, test.gr2, test.gr3)
## Obtain unique annotation levels grouped by ID
getAnnotationLevels(annot.gr = test.gr, offset = 1, annotation.group = "ID")


daewoooo/SVbyEye documentation built on Oct. 15, 2024, 6:12 a.m.