Load data

Create reflection of IS

Apply preciseTAD on IS curve to find TAD

Window = 5000

Full Window

window_resolution <- 43458

IS_bound.preciseTAD_fullW <- unique(c(all.tads.arm2.bp$left_TAD, all.tads.arm2.bp$right_TAD))
overlap_bound = intersect(boundaryIS_ch1$Start, IS_bound.preciseTAD_fullW)

overlap_bound
##   [1]   1920000   3900000   6700000   7955000   8875000  13645000  13815000
##   [8]  15105000  15520000  18870000  21200000  22960000  24640000  25815000
##  [15]  28240000  29230000  30705000  36470000  37435000  38020000  38835000
##  [22]  45300000  46375000  46730000  47170000  48525000  50350000  56585000
##  [29]  56830000  58695000  59760000  59970000  62155000  62430000  64255000
##  [36]  64820000  66240000  66450000  66920000  67510000  68110000  70125000
##  [43]  70515000  71085000  74755000  75810000  77535000  78130000  85275000
##  [50]  87110000  87325000  88640000  90000000  91940000  92830000  93910000
##  [57]  94810000  95070000  96845000  99720000 100890000 107775000 111775000
##  [64] 112365000 112710000 113075000 113680000 113975000 116500000 117060000
##  [71] 117975000 153990000 159090000 161765000 162840000 163350000 165595000
##  [78] 165920000 166835000 167215000 171465000 172440000 172735000 173415000
##  [85] 174745000 175000000 177945000 178525000 179020000 179380000 179840000
##  [92] 180500000 181175000 181425000 182585000 187000000 192465000 200530000
##  [99] 203030000 203865000 204375000 209830000 211255000 211675000 214680000
## [106] 218275000 219960000 220800000 222460000 223115000 224110000 224505000
## [113] 225470000 226620000 229235000 230325000 231210000 231615000 233290000
## [120] 235095000 235505000 236095000 236605000 237805000 241485000 242015000
## [127] 243325000 244290000 244455000 244795000 245070000 246005000 246485000
plot(overlap_bound)

Compare preciseTAD_IS vs boundry_IS

Number of TAD

## IS boundary found by preciseTAD
IS_bound.preciseTAD <- unique(c(report1$left_TAD, report1$right_TAD))
length(IS_bound.preciseTAD)
## [1] 146
length(boundaryIS_ch1$Start)
## [1] 663

Loops for different e

Window = 5000

Indentify length of boundaries from minima of IS and preciseTAD of IS

## number of boundaries from IS minima
length(boundaryIS_ch1$Start)
## [1] 663
## IS boundary found by preciseTAD
IS_bound.preciseTAD.e0.1 <- unique(c(results_list$"0.1"$report$left_TAD, results_list$"0.1"$report$right_TAD))
length(IS_bound.preciseTAD.e0.1)
## [1] 143
IS_bound.preciseTAD.e0.2 <- unique(c(results_list$"0.1"$report$left_TAD, results_list$"0.1"$report$right_TAD))
length(IS_bound.preciseTAD.e0.2)
## [1] 143
IS_bound.preciseTAD.e0.3 <- unique(c(results_list$"0.1"$report$left_TAD, results_list$"0.1"$report$right_TAD))
length(IS_bound.preciseTAD.e0.3)
## [1] 143
IS_bound.preciseTAD.e0.4 <- unique(c(results_list$"0.1"$report$left_TAD, results_list$"0.1"$report$right_TAD))
length(IS_bound.preciseTAD.e0.4)
## [1] 143
IS_bound.preciseTAD.e0.5 <- unique(c(results_list$"0.1"$report$left_TAD, results_list$"0.1"$report$right_TAD))
length(IS_bound.preciseTAD.e0.5)
## [1] 143

Check which boundaries from preciseTAD algorithm overlap with boundaries from minima of insulation score curve

## count how many are same
overlap_bound.2 = intersect(boundaryIS_ch1$Start, IS_bound.preciseTAD.e0.1)
overlap_bound.2_is = is_ch1$Insulation_score[is_ch1$bp %in% overlap_bound.2]
overlap_bound.df <- data.frame(bp = overlap_bound.2, insulation_score = overlap_bound.2_is)

datatable(overlap_bound.df)
plot(x = is_ch1$bp, y = is_ch1$Insulation_score, type = 'l')
points(x=overlap_bound.df$bp, y= overlap_bound.df$insulation_score, col = 'blue')