FLOPART_data {FLOPART}R Documentation

Convert data for input to FLOPART

Description

FLOPART needs at most one label per coverage data row, which may not be the case for arbitrary coverage/labels.

Usage

FLOPART_data(coverage, label)

Arguments

coverage

data frame of coverage with columns chromStart, chromEnd, count

label

data frame of labels with with columns chromStart, chromEnd, annotation

Value

named list: coverage_dt is data table representing a run-length encoding of the input coverage data, with additional rows if there are label chromStart/chromEnd values not in the set of coverage positions; label_dt is a data table with one row per label, and additional columns firstRow/lastRow which refer to row numbers of coverage_dt, 0-based for passing to C++ code.

Author(s)

Toby Dylan Hocking

Examples

library(data.table)
d <- function(chromStart, chromEnd, count){
  data.table(chromStart, chromEnd, count)
}
(cov.dt <- rbind(
  d(0, 10, 53),
  d(10, 20, 124)))
l <- function(chromStart, chromEnd, annotation){
  data.table(chromStart, chromEnd, annotation)
}
lab.dt <- rbind(
  l(2, 7, "noPeaks"),
  l(8, 15, "peakStart"))
FLOPART::FLOPART_data(cov.dt)
FLOPART::FLOPART_data(cov.dt, lab.dt)
data("Mono27ac", package="FLOPART")
sapply(Mono27ac, dim)
converted <- with(Mono27ac, FLOPART::FLOPART_data(coverage, labels))
sapply(converted, dim)

[Package FLOPART version 2023.8.31 Index]