Skip to contents

This function normalizes the raw bulk average Hi-C contact scores using different methods.

Usage

normalizeHiCWeights(hicweight, normalizeMethod = "1", element)

Arguments

hicweight

A data.frame containing raw bulk average Hi-C contacts with columns: element1, element2, and score.

normalizeMethod

Method used to normalize the average Hi-C scores. Default is "1".

  • "1": Normalize by rank scores.

  • "2": Normalize by -log10 transformation.

  • "3": Binarize the scores (values > 0 become 1; values ≤ 0 become 0).

  • "4": Normalize by min-max scaling.

element

Vector of unique row or column elements present in the Hi-C matrix.

Value

A normalized Hi-C contact matrix.

Examples

hicweight <- data.frame(
  element1 = c(
    "CHN1", "CHN1", "CHN1", "CHN1", "CHN1", "chr2_174901074_174901475", "chr2_174901074_174901475",
    "chr2_174901074_174901475", "chr2_174901074_174901475", "chr2_174990102_174990619", "chr2_174990102_174990619",
    "chr2_174990102_174990619", "chr2_175048293_175048704", "chr2_175048293_175048704", "chr2_175167038_175169195"
  ),
  element2 = c(
    "chr2_174901074_174901475", "chr2_174990102_174990619", "chr2_175048293_175048704", "chr2_175167038_175169195",
    "chr2_175187467_175187717", "chr2_174990102_174990619", "chr2_175048293_175048704", "chr2_175167038_175169195",
    "chr2_175187467_175187717", "chr2_175048293_175048704", "chr2_175167038_175169195", "chr2_175187467_175187717",
    "chr2_175167038_175169195", "chr2_175187467_175187717", "chr2_175187467_175187717"
  ),
  score = c(
    0.0016062358, 0.0076253167, 0.0031021570, 0.0012148262, 0.0010788392, 0.0019968580, 0.0012957845,
    0.0009198567, 0.0011448870, 0.0023991885, 0.0010785481, 0.0009664508, 0.0012865316, 0.0012122647, 0.0057781939
  )
)
element <- unique(c(hicweight$element1, hicweight$element2))
weight <- normalizeHiCWeights(hicweight, "1", element)
head(weight)
#>                               CHN1 chr2_174901074_174901475
#> CHN1                     1.0000000                0.3571429
#> chr2_174901074_174901475 0.3571429                1.0000000
#> chr2_174990102_174990619 0.0000000                0.2857143
#> chr2_175048293_175048704 0.1428571                0.4285714
#> chr2_175167038_175169195 0.5714286                1.0000000
#> chr2_175187467_175187717 0.7857143                0.7142857
#>                          chr2_174990102_174990619 chr2_175048293_175048704
#> CHN1                                    0.0000000                0.1428571
#> chr2_174901074_174901475                0.2857143                0.4285714
#> chr2_174990102_174990619                1.0000000                0.2142857
#> chr2_175048293_175048704                0.2142857                1.0000000
#> chr2_175167038_175169195                0.8571429                0.5000000
#> chr2_175187467_175187717                0.9285714                0.6428571
#>                          chr2_175167038_175169195 chr2_175187467_175187717
#> CHN1                                   0.57142857               0.78571429
#> chr2_174901074_174901475               1.00000000               0.71428571
#> chr2_174990102_174990619               0.85714286               0.92857143
#> chr2_175048293_175048704               0.50000000               0.64285714
#> chr2_175167038_175169195               1.00000000               0.07142857
#> chr2_175187467_175187717               0.07142857               1.00000000