findIntersections {karyoploteR} | R Documentation

## findIntersections

### Description

Finds the intersections of a data line with a given threshold

### Usage

    findIntersections(data, thr)

### Arguments

`data` | (GRanges with y mcol) A GRanges with the data points
`thr` | (numeric) The value at wich we want to calculate the intersections

### Details

Given a GRanges with an mcol with name "y" representing the values. This function will return a GRanges with the points intersecting a specific value "thr".

### Value

A GRanges representing the intersection points between the data line and the threshold. It will return an empty GRanges if the line does not intersect the threshold.

### Note

Important: It will only return the intersection points where the line crosses the threshold but not if a data point lies exactly at the threshold.

### Examples

    d <- toGRanges(c("1:1-1", "1:5-5", "1:15-15"))
    d$y <- c(-2, 3, 1)

    findIntersections(d, 1.5)
    findIntersections(d, 0)
    findIntersections(d, 5)

[Package karyoploteR version 1.14.1 Index]