Linearize interactions {InteractionSet} | R Documentation

## Linearize 2D interactions into 1D ranges

### Description

Convert interactions in two-dimensional space to one-dimensional ranges on the linear genome.

### Usage

    ## S4 method for signature 'GInteractions,numeric'
    linearize(x, ref, internal=TRUE)

    ## S4 method for signature 'GInteractions,GRanges'
    linearize(x, ref, ..., internal=TRUE)

    # Equivalent calls for InteractionSet objects.

### Arguments

`x` | A GInteractions or InteractionSet object
`ref` | A numeric vector or a GRanges object, specifying the reference region(s) to use for linearization. If numeric, the entries should be indices pointing to a genomic interval in `regions(x)`.
`internal` | A logical scalar specifying whether interactions within `ref` should be reported.
`...` | Other arguments, passed to `overlapsAny` in the GRanges methods.

### Details

This method identifies all interactions with at least one anchor region overlapping the specified region(s) in `ref`. When `x` is a GInteractions object, the method returns a GRanges object with one entry per identified interaction, where the coordinates are defined as the other anchor region, i.e., the one that does not overlap the reference region.

If both of the anchor regions for an interaction overlap the reference regions, the genomic interval spanned by both anchor regions is returned. This is because it is not clear which region should be defined as the "other" anchor in such circumstances. Note that this will fail if the reference regions occur across multiple chromosomes. If `internal=FALSE`, interactions with both overlapping anchor regions are removed from the output.

When `x` is an InteractionSet object, a RangedSummarizedExperiment object is returned. Each entry corresponds to an identified interaction with the non-overlapping anchor region stored in the `rowRanges`. Experimental data associated with each identified interaction is stored in the various assays.

This method effectively converts two-dimesional interaction data into one-dimensional coverage across the linear genome. It is useful when a particular genomic region is of interest - this can be used as `ref`, to examine the behaviour of all other regions relative to it. For example, Hi-C data in `x` can be converted into pseudo-4C contact frequencies after linearization.

Disjoint ranges across multiple chromosomes are supported when `ref` is a GRanges object. However, it usually only makes sense to use continguous ranges as a single bait region. Similarly, if `ref` is numeric, it should refer to consecutive entries in `regions(x)` to specify the bait region.

### Value

A GRanges when `x` is a GInteractions object, and a RangedSummarizedExperiment when `x` is an InteractionSet object.

### Examples

    example(InteractionSet, echo=FALSE)

    # With integers
    out <- linearize(iset, 1)
    linearize(iset, 10)
    linearize(iset, 20)

    # With ranges
    linearize(iset, regions(iset)[1], type="equal")
    linearize(iset, regions(iset)[10], type="equal")
    linearize(iset, regions(iset)[20], type="equal")

[Package InteractionSet version 1.10.0 Index]