Last data update: 2014.03.03

R: Hi-C calibration
calibrateR Documentation

Hi-C calibration

Description

A function for applying a calibration function to a given Hi-C contact matrix.

Usage

calibrate(hic, calib)

Arguments

hic

A numeric matrix/vector of pairwise Hi-C contact frequencies.

calib

A list with f, the calibration function, and params a list of parameters for f. This object can be generated with the function prepareCalib.

Value

A calibrated version of the input matrix (or vector), i.e. the result of applying the calibration function (f) on the values of 'hic'. Zero values represent discarded/missing information.

Author(s)

Yoli Shavit

References

Y. Shavit, F.K. Hamey, P. Lio', FisHiCal: an R package for iterative FISH-based calibration of Hi-C data, 2014 (submitted).

See Also

prepareCalib
conf
hic
match

Examples

 data(match) 
 data(hic)
 npoints = 10 # number of points to fit
 
 # prepareCalib computes threshold to fit 
 res = prepareCalib(match, npoints, useMax = FALSE)
 calib = res$calib
 calib$f # calibration function
 calib$params # the parametrs for f
 # note that calib could be refined by the user
 
 # now calibrate the hic matrix
 calibHiC = calibrate(hic, calib)
 plot(match$distances, calibHiC[upper.tri(calibHiC)],
 xlab = "distances", ylab = "calibrated distances")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(FisHiCal)
Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

Loading required package: RcppArmadillo
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FisHiCal/calibrate.Rd_%03d_medium.png", width=480, height=480)
> ### Name: calibrate
> ### Title: Hi-C calibration
> ### Aliases: calibrate
> 
> ### ** Examples
> 
>  data(match) 
>  data(hic)
>  npoints = 10 # number of points to fit
>  
>  # prepareCalib computes threshold to fit 
>  res = prepareCalib(match, npoints, useMax = FALSE)
>  calib = res$calib
>  calib$f # calibration function
function (m, params) 
{
    a = params[[1]]
    b = params[[2]]
    threshold = params[[3]]
    m = exp((log(m) - b)/a)
    m[m == Inf] = 0
    m[m > threshold] = 0
    return(m)
}
<environment: 0x32ac1b8>
>  calib$params # the parametrs for f
[[1]]
[1] -2

[[2]]
[1] 10

[[3]]
[1] 22.79646

>  # note that calib could be refined by the user
>  
>  # now calibrate the hic matrix
>  calibHiC = calibrate(hic, calib)
>  plot(match$distances, calibHiC[upper.tri(calibHiC)],
+  xlab = "distances", ylab = "calibrated distances")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>