R/interaction.R
addCovCor.Rd
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.
addCovCor(gi, datacol = "chip", colname = "cor_chip", maxDist = NULL, use = "everything", method = "pearson")
gi | A sorted |
---|---|
datacol | a string matching an annotation column in |
colname | A string that is used as columnname for the new column in
|
maxDist | maximal distance of pairs in bp as numeric. If maxDist=NULL,
the maximal distance is computed from input interactions gi by
|
use | an optional character string giving a method for computing
covariances in the presence of missing values. See |
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 |
A GInteractions
similar to gi
just with an additional column added.
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) }#> DataFrame with 2808 rows and 2 columns #> dist cor_chip #> <integer> <numeric> #> 1 19119 0.339540495724593 #> 2 52360 -0.104691613939358 #> 3 53000 0.885072700379391 #> 4 53639 -0.170960689666582 #> 5 61058 -0.104691613939358 #> ... ... ... #> 2804 49248 NA #> 2805 61304 NA #> 2806 29898 NA #> 2807 41954 NA #> 2808 12056 NA