P(s) will be approximated if no pairs are provided, or the exact P(s) will be computed if a .pairs file is added to the HiCExperiment object using pairsFile(x) <- "...".

distanceLaw(x, coords, ...)

# S4 method for GInteractions,missing
distanceLaw(x, by_chr = FALSE)

# S4 method for HiCExperiment,missing
distanceLaw(
  x,
  by_chr = FALSE,
  filtered_chr = c("XII", "chrXII", "chr12", "12", "Mito", "MT", "chrM")
)

# S4 method for PairsFile,missing
distanceLaw(
  x,
  by_chr = FALSE,
  filtered_chr = c("XII", "chrXII", "chr12", "12", "Mito", "MT", "chrM"),
  chunk_size = 1e+05
)

# S4 method for HiCExperiment,GRanges
distanceLaw(x, coords, chunk_size = 1e+05)

# S4 method for PairsFile,GRanges
distanceLaw(x, coords, chunk_size = 1e+05)

localDistanceLaw(x, coords = coords)

Arguments

x

A HiCExperiment object

coords

GRanges to specify which genomic loci to use when computing P(s)

...

Arguments passed to corresponding method

by_chr

by_chr

filtered_chr

filtered_chr

chunk_size

For pairs files which do not fit in memory, pick a number of pairs to parse by chunks (1e7 should be a good compromise)

Value

a tibble

Examples

contacts_yeast <- contacts_yeast()
#> see ?HiContactsData and browseVignettes('HiContactsData') for documentation
#> loading from cache
ps <- distanceLaw(contacts_yeast)
#> pairsFile not specified. The P(s) curve will be an approximation.
ps
#> # A tibble: 35 × 5
#>    binned_distance       p      norm_p norm_p_unity slope
#>              <dbl>   <dbl>       <dbl>        <dbl> <dbl>
#>  1               1 0.731   0.731        1470429.     0   
#>  2           15159 0.114   0.0000750        151.    -1.35
#>  3           29540 0.0525  0.0000178         35.8   -1.92
#>  4           47574 0.0272  0.00000572        11.5   -2.36
#>  5           63322 0.0157  0.00000248         4.99  -2.76
#>  6           76619 0.0100  0.00000131         2.63  -3.01
#>  7           92709 0.00690 0.000000745        1.50  -3.12
#>  8          101980 0.00507 0.000000497        1     -3.16
#>  9          123396 0.00399 0.000000323        0.651 -3.12
#> 10          135735 0.00323 0.000000238        0.478 -2.87
#> # ℹ 25 more rows
local_ps <- localDistanceLaw(
    contacts_yeast,
    GenomicRanges::GRanges(
        c("telomere" = "II:1-20000", "arm" = "II:300001-700000")
    )
)
#> pairsFile not specified. The P(s) curve will be an approximation.
local_ps
#> # A tibble: 54 × 6
#>    coords   binned_distance      p     norm_p norm_p_unity slope
#>    <chr>              <dbl>  <dbl>      <dbl>        <dbl> <dbl>
#>  1 arm                    1 0.680  0.680         926716.    0   
#>  2 telomere               1 0.636  0.636        1190885.    0   
#>  3 arm                15159 0.121  0.0000796        109.   -1.12
#>  4 telomere           15159 0.129  0.0000854        160.   -1.08
#>  5 arm                29540 0.0609 0.0000206         28.1  -1.80
#>  6 telomere           29540 0.0734 0.0000249         46.6  -1.73
#>  7 arm                47574 0.0321 0.00000675         9.21 -2.29
#>  8 telomere           47574 0.0342 0.00000720        13.5  -2.29
#>  9 arm                63322 0.0194 0.00000306         4.17 -2.72
#> 10 telomere           63322 0.0208 0.00000328         6.15 -2.92
#> # ℹ 44 more rows