#Firstly, get data in a format: .cool, .mcool, .hic, .hicpro, .homer, .h5
#Usually the data is in the 4DNucleome repository
%%bash
wget -o <new name of .cool> <url>
#To work with the mustache (micro-c data analysis, especially -- loops calling), cooltools (hi-c data analysis by Mirny lab) -- .cool format is required
#We have a format converter working: by means of HiCExplorer
#It is available in the R_nor_old_nor_new conda environment
#The h5, cool, hic, homer, hicpro formats can be converted into cool, h5, homer, ginteractions, mcool
#You need to specify the resolution or the output file will be multiresolutional
%%bash
hicConvertFormat -m <path to your matrix> -o <output name> --inputFormat --outputFormat -r <resolution>
#We also have graphic interface program -- GenomeFlow, it's avaliable via X2Go
#You can annotate your hi-c data, get simple 3D models, call different structures with it
#It works with sparse matrix input
#You can make a sparse matrix file from .cool file using Bioconductor package -- HiCcompare
#However firstly you have to dump .cool file as a text file
#Switch to the coolenv conda environment
%%bash
cooler dump --join -r <f.e: chr1:10,000,000-11,000,000> <path to your .cool> > <name of dump result - txt file>
#It's very important -- check style of chrom names by cooler dump -t chroms, it can be that 1,2,3...X,Y,Mt are used instead of chr1,chr2,chr3,...,chrX,chrY,chrM.
library(HiCcompare)
#If there is no such library as HiCcompare use the following:
if (!requireNamespace("BiocManager", quietly=TRUE))
install.packages("BiocManager")
BiocManager::install("HiCcompare")
#Now you can conver it into sparse format
#Switch to the R_nor_old_nor_new conda environment
<name of sparse matrix> <- read.table("<name of dumped txt file>", header = FALSE)
sparse <- cooler2sparse(<name of sparse matrix>)
head(sparse)
#We have DistMan script -- it allows to perform basic data analysis of Hi-C (Micro-C) data
#Also it can create a distance map and a heatmap visualisation of it
#Output of this script can be streamed into GraphDom script
#Input of the DistMan -- Hi-C data in the bedpe text format
#You can get data in this format using cooler dump as described before
#Also you can get bedpe table from .cool file using HiCExplorer (R_nor_old_nor_new environment)
<name of bedpe file> <- cooler2bedpe(path = "your_cool_file.cool")
sink(file = 'name')
<name of bedpe file>
sink(file = NULL)
#GenomicInteractions Bioconductor package can be used to get genomic distances from contact map
#It is also available in the the R_nor_old_nor_new conda environment
#It could be better to use terminal in place of jupyter
#Package works with the .homer data so you need to convert your data using HiCExplorer
hic_file <- system.file('<your .homer file>',
package="GenomicInteractions")
hic_data <- makeGenomicInteractionsFromFile(hic_file,
type="homer",
experiment_name = "<name>",
description = "<some description")
calculateDistances(hic_data, method = "midpoint", floor = TRUE)