R/matrix_transformations.R
cooler2sparse.Rd
Transform a .cool file to a sparse upper triangular matrix for input into hic_loess
cooler2sparse(cooler)
cooler | The plain text file from a .cool file loaded into an R data.frame object. See vignette for more details. |
---|
A Sparse upper triangular matrix or a list of sparse upper triangular matrices. If the .cool file contains data for more than one chromosome The function will split the data up into a list of matrices, one per chromosome.
The .cool format is linked a database of Hi-C experiments and allows access to many sets of Hi-C data which can be found at the Index of Coolers ftp://cooler.csail.mit.edu/coolers. Once a .cool file is dumped into a contact matrix in plain text it can be read into R. This function provides a method for converting the .cool matrix into a sparse upper triangular matrix ready to be entered into hic_loess.
#> $chr1 #> region1 region2 IF #> 1: 0 0 106 #> 2: 0 1000000 195 #> 3: 0 2000000 59 #> 4: 0 3000000 47 #> 5: 0 4000000 28 #> --- #> 26026: 247000000 248000000 5758 #> 26027: 247000000 249000000 721 #> 26028: 248000000 248000000 5823 #> 26029: 248000000 249000000 1001 #> 26030: 249000000 249000000 676 #> #> $chr10 #> region1 region2 IF #> 1: 0 0 15320 #> 2: 0 1000000 4407 #> 3: 0 2000000 1295 #> 4: 0 3000000 953 #> 5: 0 4000000 587 #> --- #> 8938: 133000000 134000000 2048 #> 8939: 133000000 135000000 262 #> 8940: 134000000 134000000 7008 #> 8941: 134000000 135000000 1094 #> 8942: 135000000 135000000 1338 #> #> $chr11 #> region1 region2 IF #> 1: 0 0 2115 #> 2: 0 1000000 802 #> 3: 0 2000000 237 #> 4: 0 3000000 110 #> 5: 0 4000000 87 #> --- #> 8901: 132000000 133000000 9131 #> 8902: 132000000 134000000 1703 #> 8903: 133000000 133000000 21444 #> 8904: 133000000 134000000 4716 #> 8905: 134000000 134000000 18131 #> #> $chr12 #> region1 region2 IF #> 1: 0 0 11094 #> 2: 0 1000000 6037 #> 3: 0 2000000 1482 #> 4: 0 3000000 646 #> 5: 0 4000000 610 #> --- #> 8717: 131000000 132000000 3784 #> 8718: 131000000 133000000 442 #> 8719: 132000000 132000000 6241 #> 8720: 132000000 133000000 1286 #> 8721: 133000000 133000000 3694 #> #> $chr13 #> region1 region2 IF #> 1: 19000000 19000000 2295 #> 2: 19000000 20000000 1435 #> 3: 19000000 21000000 340 #> 4: 19000000 22000000 246 #> 5: 19000000 23000000 208 #> --- #> 4741: 113000000 114000000 2991 #> 4742: 113000000 115000000 212 #> 4743: 114000000 114000000 6257 #> 4744: 114000000 115000000 1039 #> 4745: 115000000 115000000 699 #> #> $chr14 #> region1 region2 IF #> 1: 19000000 19000000 33 #> 2: 19000000 20000000 199 #> 3: 19000000 21000000 61 #> 4: 19000000 22000000 26 #> 5: 19000000 23000000 17 #> --- #> 3981: 105000000 106000000 602 #> 3982: 105000000 107000000 274 #> 3983: 106000000 106000000 2768 #> 3984: 106000000 107000000 2126 #> 3985: 107000000 107000000 1598 #>