applyToCisPairs: Apply a function to a pair of genomic ranges.

Description Usage Arguments Value Examples

View source: R/genomicPairAply.R

Description

This function returns a vector with the resulting functin call for each pair..

Usage

1
applyToCisPairs(gp, rangesGR, datamat, fun = cor)

Arguments

gp

data.frame of pairs of genomic ranges. First two columns hold indices of the range in rangesGR.

rangesGR

GenomicRanges object with all ranges used in gp.

datamat

a matrix of with data values associated to each rang in rangesGR. Assumes the ranges in rows while row.names(datamat) are the names(rangesGR).

fun

A function that takes two numeric vectors as imput to compute a summary statsitic. Default is cor().

Value

A Numeric vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
rangesGR <- GRanges(
 rep(c("chr1", "chr2"), c(3,2)),
 IRanges(
      c(100, 200, 300, 100, 200),
      c(150, 250, 350, 150, 250)
   ))
gp <- data.frame(
 g1=c(1,4,2,1,4),
 g2=c(2,4,3,3,5)
)

datamat <- rbind(
    c(10, 20, 30),
    c(15, 26, 40),
    c(100, 2, 0),
    c(10, 20, 30),
    c(15, 26, 40)
  )
applyToCisPairs(gp, rangesGR, datamat)

ibn-salem/genepair documentation built on May 18, 2019, 1:30 a.m.