addCovCor {sevenC} | R Documentation

## Add correlation of anchor signals to pairs of close genomic regions.

### Description

This function adds a vector with correlation values for each input interaction. Only works for input interaction within the given `maxDist` distance. Note, this function does not work on windows because reading of bigWig files is currently not supported on windows.

### Usage

    addCovCor(gi, datacol = "chip", colname = "cor_chip", maxDist = NULL,
      use = "everything", method = "pearson")

### Arguments

`gi` | A sorted `GInteractions` object.
`datacol` | a string matching an annotation column in `regions(gi)`. This column is assumed to hold the same number of values for each interaction as a `NumericList`.
`colname` | A string that is used as columnname for the new column in `gi`.
`maxDist` | maximal distance of pairs in bp as numeric. If maxDist=NULL, the maximal distance is computed from input interactions gi by `max(pairdist(gi))`.
`use` | an optional character string giving a method for computing covariances in the presence of missing values. See `cor` for more details.
`method` | a character string indicating which correlation coefficient (or covariance) is to be computed. One of "pearson" (default), "kendall", or "spearman": can be abbreviated. See `cor` for more details.

### Value

A `GInteractions` similar to `gi` just with an additional column added.

### Examples

    if (.Platform$OS.type != "windows") {

      # use internal motif data on chromosome 22
      motifGR <- sevenC::motif.hg19.CTCF.chr22

      # use example bigWig file
     exampleBigWig <- system.file("extdata",
         "GM12878_Stat1.chr22_1-30000000.bigWig", package = "sevenC")

      # add coverage from bigWig file
      motifGR <- addCovToGR(motifGR, exampleBigWig)

      # get all pairs within 1Mb
      gi <- getCisPairs(motifGR, 1e5)

      # compute correaltion of coverge for each pair
      gi <- addCovCor(gi)

      # addCovCor adds a new metadata column:
      mcols(gi)

    }

[Package sevenC version 1.4.0 Index]