bash
chromosight detect --pattern loops Share/HiC/HiC_G2M.cool HiC_loops
chromosight detect --pattern borders Share/HiC/HiC_G2M.cool HiC_bordersWe will use the chromosight software in the terminal to annotate chromatin loops and borders.
chromosight help to understand how to use it.loops and borders from the Hi-C contact map in Share/HiC/HiC_G2M.coolusing chromosight detect with the --pattern option.bash
chromosight detect --pattern loops Share/HiC/HiC_G2M.cool HiC_loops
chromosight detect --pattern borders Share/HiC/HiC_G2M.cool HiC_borderstsv files generated for loops and borders.We have a set of Hi-C pairs stored in the ~/Share/HiC/HiC.pairs file.
vroom package to import the file in R
plyinteractions to coerce the data frame into a GInteractions objectr
library(vroom)
library(plyinteractions)
df <- vroom("~/Share/HiC/HiC_filtered.pairs", col_names = c("readid", "seqnames1", "start1", "seqnames2", "start2", "strand1", "strand2", "pair_type"), comment = "#")
gi <- as_ginteractions(df, end1 = start1, end2 = start2)pairdist distance between each anchor of every interaction in the GInteractions object.HiContacts::plotPs.r
library(tidyverse)
gi <- add_pairdist(gi)
df <- as_tibble(gi) |>
mutate(strands = paste0(strand1, strand2)) |>
group_by(strands, pairdist) |>
tally() |>
mutate(prob = n / sum(n))
p <- ggplot(df, aes(x = pairdist, y = prob, color = strands)) +
geom_smooth() +
scale_x_log10(limits = c(100, NA)) +
scale_y_log10() +
theme_bw()We will use the HiContacts package in R to visualize Hi-C contact maps.
Share/HiC/HiC_G2M.cool file in R.cool file.plotContactMap function to visualize the Hi-C contact map.r
library(HiContacts)
cf <- CoolFile("Share/HiC/HiC_G2M.cool")
availableChromosomes(cf)
availableResolutions(cf)
hic <- import(cf, focus = 'IV')
plotMatrix(hic)