{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Firstly, get data in a format: .cool, .mcool, .hic, .hicpro, .homer, .h5\n", "#Usually the data is in the 4DNucleome repository\n", "%%bash\n", "wget -o " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#To work with the mustache (micro-c data analysis, especially -- loops calling), cooltools (hi-c data analysis by Mirny lab) -- .cool format is required\n", "#We have a format converter working: by means of HiCExplorer\n", "#It is available in the R_nor_old_nor_new conda environment\n", "#The h5, cool, hic, homer, hicpro formats can be converted into cool, h5, homer, ginteractions, mcool\n", "#You need to specify the resolution or the output file will be multiresolutional\n", "%%bash\n", "hicConvertFormat -m -o --inputFormat --outputFormat -r " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#We also have graphic interface program -- GenomeFlow, it's avaliable via X2Go\n", "#You can annotate your hi-c data, get simple 3D models, call different structures with it\n", "#It works with sparse matrix input\n", "#You can make a sparse matrix file from .cool file using Bioconductor package -- HiCcompare\n", "#However firstly you have to dump .cool file as a text file\n", "#Switch to the coolenv conda environment \n", "%%bash\n", "cooler dump --join -r > \n", "#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.\n", "library(HiCcompare)\n", "#If there is no such library as HiCcompare use the following:\n", "if (!requireNamespace(\"BiocManager\", quietly=TRUE))\n", " install.packages(\"BiocManager\")\n", "BiocManager::install(\"HiCcompare\")\n", "#Now you can conver it into sparse format\n", "#Switch to the R_nor_old_nor_new conda environment\n", " <- read.table(\"\", header = FALSE)\n", "sparse <- cooler2sparse()\n", "head(sparse)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#We have DistMan script -- it allows to perform basic data analysis of Hi-C (Micro-C) data\n", "#Also it can create a distance map and a heatmap visualisation of it\n", "#Output of this script can be streamed into GraphDom script\n", "#Input of the DistMan -- Hi-C data in the bedpe text format\n", "#You can get data in this format using cooler dump as described before\n", "#Also you can get bedpe table from .cool file using HiCExplorer (R_nor_old_nor_new environment)\n", " <- cooler2bedpe(path = \"your_cool_file.cool\")\n", "sink(file = 'name')\n", "\n", "sink(file = NULL)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#GenomicInteractions Bioconductor package can be used to get genomic distances from contact map\n", "#It is also available in the the R_nor_old_nor_new conda environment\n", "#It could be better to use terminal in place of jupyter\n", "#Package works with the .homer data so you need to convert your data using HiCExplorer\n", "hic_file <- system.file('', \n", " package=\"GenomicInteractions\")\n", "hic_data <- makeGenomicInteractionsFromFile(hic_file, \n", " type=\"homer\", \n", " experiment_name = \"\", \n", " description = \"