Interaction binding {InteractionSet} | R Documentation

## Interaction combining

### Description

Methods to combine InteractionSet or GInteractions objects.

### Usage

    ## S4 method for signature 'GInteractions'
    c(x, ..., recursive=FALSE)

    ## S4 method for signature 'InteractionSet'
    rbind(..., deparse.level=1)
    ## S4 method for signature 'InteractionSet'
    cbind(..., deparse.level=1)

### Arguments

`x` | A GInteractions or InteractionSet object.
`...` | For `rbind` and `c`, `...` contains GInteractions or InteractionSet objects to be combined row-wise. All objects must be of the same class. For `c`, any objects are additional to that already specified in `x`. For `cbind`, `...` contains InteractionSet objects to be combined column-wise.
`deparse.level` | An integer scalar; see `?base::cbind` for a description of this argument.
`recursive` | An integer scalar, ignored.

### Value

A combined object of the same class as `x`.

### Details for GInteractions

`c` will concatenate GInteractions objects. It will check whether the `regions` slot of all supplied objects are the same, in which case the regions and anchor indices are used directly. Otherwise, the `regions` slot is set to a new GRanges object consisting of the (sorted) union of all `regions` across the input objects. Anchor indices in each object are refactored appropriately to refer to the relevant entries in the new GRanges.

Note that the column names in `mcols` must be identical across all supplied objects. The column names of `mcols` for the `regions` slot must also be identical across objects. If GInteractions objects of different strictness (i.e., StrictGInteractions and ReverseGInteractions) are concatenated, the returned object will be of the same class as the first supplied object.

### Details for InteractionSet

`cbind` will combine objects with the same interactions but different samples. Errors will occur if the interactions are not identical between objects (i.e., must have same values in the `interactions` slots). Additional restrictions apply on the column and assay names - see `cbind,SummarizedExperiment-method` for details.

`rbind` will combine objects with the same samples but different interactions. In this case, the interactions need not be identical, and will be concatenated using the methods described above for GInteractions objects. Again, additional restrictions apply - see `rbind,SummarizedExperiment-method` for details.

### Author(s)

Aaron Lun

### See Also

`InteractionSet-class` `GInteractions-class`

### Examples

    example(GInteractions, echo=FALSE)
    c(gi, gi)

    new.gi <- gi
    regions(new.gi) <- resize(regions(new.gi), width=20, fix="start")
    c(gi, new.gi)

    #################
    # Same can be done for an InteractionSet object:

    example(InteractionSet, echo=FALSE)
    cbind(iset, iset)
    rbind(iset, iset)

    new.iset <- iset
    regions(new.iset) <- resize(regions(new.iset), width=20, fix="start")
    rbind(iset, new.iset)

[Package InteractionSet version 1.12.0 Index]