calcPairs: Define function to calculate all paired interactions within a...

View source: R/calcPairs.R

calcPairsR Documentation

Define function to calculate all paired interactions within a windowSize

Description

calcPairs will calculate pairs of interactions within a rolling windowSize. By default, pairs of interactions are returned as StrictGInteractions where anchor1 <= anchor2 for all interactions (mode = 'strict'). For more information see (?InteractionSet::'GInteractions-class'). Self interactions (e.g. 1, 1 or 2, 2) and order (e.g. 1, 2 is the same as 2, 1) are ignored.

Usage

calcPairs(gr, windowSize, mode = "strict")

Arguments

gr

GRanges object

windowSize

integer defining the window

mode

If mode="strict", a StrictGInterctions object is returned with anchor indices swapped such that anchor1 <= anchor2 for all interactions. If mode="reverse", a ReverseStrictGInterctions object is returned with anchor indices swapped such that anchor1 >= anchor2.

Value

Returns a StrictGInterations object

Examples

## Load TxDb
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

## Generate 50Kb bins across hg19
library(GenomicRanges)
bins <- tileGenome(seqinfo(txdb), tilewidth = 50e3, cut.last.tile.in.chrom = TRUE)

## Calculate all 50Kb bin pairs within 1Mb
calcPairs(gr = bins, windowSize = 1e6)


EricSDavis/hictoolsr documentation built on Sept. 4, 2022, 12:36 a.m.