This function can covert a contact matrix (x, y, counts) format into a short with score format.

convertJuicer(contactMatrix, chr1, chr2)

Arguments

contactMatrix

A contact matrix, the first column is the first chromosome location, and second column is the second chromosome location, the third column is count number

chr1

The first chromosome name. For example, 1 or 'chr1'.

chr2

The second chromosome name. For example, 1 or 'chr1'

Value

A data.frame has 9 columns, and it can be used directly by juicer Pre.

See also

Examples

## Create a random contact matrix contactMatrix <- structure( c(0L, 0L, 50L, 0L, 50L, 100L, 0L, 50L, 50L, 100L, 100L, 100L, 526L, 123L, 499L, 36L, 213L, 562L), .Dim = c(6L, 3L), .Dimnames = list(NULL, c('x', 'y', 'counts'))) contactMatrix
#> x y counts #> [1,] 0 0 526 #> [2,] 0 50 123 #> [3,] 50 50 499 #> [4,] 0 100 36 #> [5,] 50 100 213 #> [6,] 100 100 562
## chromosomes names chr1 = 'chr1' chr2 = 'chr2' ## Convert to hic df = convertJuicer(contactMatrix, chr1, chr2) head(df)
#> str1 chr1 pos1 frag1 str2 chr2 pos2 frag2 score #> 1 0 chr1 0 0 0 chr2 0 1 526 #> 2 0 chr1 0 0 0 chr2 50 1 123 #> 3 0 chr1 50 0 0 chr2 50 1 499 #> 4 0 chr1 0 0 0 chr2 100 1 36 #> 5 0 chr1 50 0 0 chr2 100 1 213 #> 6 0 chr1 100 0 0 chr2 100 1 562