convertGRanges2GPos: Convert GRanges with scores to GPos

Description Usage Arguments Value Examples

View source: R/convert.R

Description

Converts a GRanges to a GPos, correctly expanding the score column. This is useful is nearby CTSSs with the same count are grouped in the same range (see example).

Usage

1

Arguments

object

GRanges object with a score column

Value

GPos with score column

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Example GRanges
gr <- GRanges(Rle(c("chr2", "chr2", "chr3", "chr4")),
              IRanges(start=c(1, 10, 5, 3),
              end=c(5L, 10L, 5L, 4L)),
              strand="+",
              score=c(2, 1, 3, 11))

# Expand to proper GPos / CTSS format:
gp <- convertGRanges2GPos(gr)

# Double check that the total number of counts remains the same
stopifnot(sum(score(gr) * width(gr)) == sum(score(gp)))

MalteThodberg/CAGEfightR documentation built on Sept. 11, 2021, 4:42 a.m.