mergeCMs {diffHic} | R Documentation

## Merge ContactMatrix objects

### Description

Merge ContactMatrix objects into an InteractionSet object containing counts for pairs of interacting regions.

### Usage

    mergeCMs(..., deflate.args=list())

### Arguments

`...` | ContactMatrix objects containing read pair counts for the same area of the interaction space, usually defined as pairs of bins along a genomic interval.
`deflate.args` | A list of arguments to pass to `deflate`.

### Details

This function facilitates the conversion of multiple ContactMatrix objects into a single InteractionSet object. Each ContactMatrix corresponds to a sample and should contain read pair counts between the corresponding row/column regions. The dimensions of all ContactMatrix objects should be the same and the rows/columns should represent the same genomic regions.

The idea is to produce an object equivalent to the output of `squareCounts` when contact matrices are available instead of BAM files. This is done via the `deflate` method, where each ContactMatrix is converted to an InteractionSet using `deflate.args`. Entries of the ContactMatrix are equivalent to paired regions in an InteractionSet (which, in most cases, are bins of constant width).

The InteractionSet objects for all supplied samples are then combined into a single object for downstream input. This step will throw errors if the original ContactMatrix objects do not cover the same area of the interaction space. Column names are set to any names for `...`, and the total number of read pairs in each ContactMatrix is stored in `totals`.

The `width` value in the `metadata` of the output InteractionSet is set to the median width of the interacting regions. The `totals` field in the output `colData` is also set to be equal to the sum of the counts in each ContactMatrix (after removing redundant regions). Note that this only makes sense if the ContactMatrix objects contain interactions between non-overlapping genomic bins.

The `param` value is not set in the `metadata` of the output object. This depends on how the ContactMatrix objects were constructed in the first place, which is not known to the function.

### Value

An InteractionSet object containing counts for interacting regions.

### Author(s)

Aaron Lun

### See Also

`deflate`, `squareCounts`, `connectCounts`

### Examples

    example(ContactMatrix, echo=FALSE)
    mergeCMs(x, x2)

[Package diffHic version 1.18.0 Index]