bed2mat: converting 3-column contact matrix to squared HiC matrix

Description Usage Arguments Value References Examples

View source: R/bed2mat.R

Description

converting 3-column contact matrix to squared HiC matrix

Usage

1
bed2mat(bed, resol = "NONE")

Arguments

bed

the 3-column contact matrix; first and second columns are genome coordinates or bin index.

resol

resolution in base pair unit. Set it to "NONE" if the first two columns are bin indices.

Value

a squared HiC matrix that can be recongnized by get.scc.

References

HiCRep: assessing the reproducibility of Hi-C data using a stratum-adjusted correlation coefficient. Tao Yang, Feipeng Zhang, Galip Gurkan Yardimci, Fan Song, Ross C Hardison, William Stafford Noble, Feng Yue, Qunhua Li. Genome Research 2017. doi: 10.1101/gr.220640.117

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 # making up an example
   nbin = 50
   bed <- matrix(0, nbin^2, 3)
   bed[,1] = rep(seq_len(nbin), nbin)
   bed[,2] = rep(seq_len(nbin), each = nbin)
   bed[,3] = sample(1:10000, nbin^2,replace = TRUE)
   mat <- bed2mat(bed, resol = "NONE") 
  
   # assume "hic.coordinate.txt" is a 3-column contact matrix 
   # indexed by chromosome coordinates, and resolution = 4K base pair
   ## Not run: 
       bed <- read.delim(hic.coordinate.txt)
       mat <- bed2mat(bed, resol = 40000) # resol specifies the bin size in base pair
    
## End(Not run)

MonkeyLB/hicrep documentation built on Dec. 15, 2020, 12:47 a.m.