Learn R Programming

trackViewer (version 1.8.4)

GRoperator: GRanges operator

Description

GRanges operations (add, aubtract, multiply, divide)

Usage

GRoperator(A, B, col="score", operator = c("+", "-", "*", "/", "^", "%%"))

Arguments

A
an object of GRanges
B
an object of GRanges
col
colname of A and B to be calculated
operator
operator, "+" means A + B, and so on.

Value

an object of GRanges

Examples

Run this code
    gr2 <- GRanges(seqnames=c("chr1", "chr1"),
               ranges=IRanges(c(7,13), width=3),
               strand=c("-", "-"), score=3:4)
    gr3 <- GRanges(seqnames=c("chr1", "chr1"),
               ranges=IRanges(c(1, 4), c(3, 9)),
               strand=c("-", "-"), score=c(6L, 2L))
    GRoperator(gr2, gr3, col="score", operator="+")
    GRoperator(gr2, gr3, col="score", operator="-")
    GRoperator(gr2, gr3, col="score", operator="*")
    GRoperator(gr2, gr3, col="score", operator="/")

Run the code above in your browser using DataLab