TADs

Plot TAD(topologically associated domains)s in upon Hi-C contact matrix.

[1]:
import coolbox
from coolbox.api import *
[2]:
coolbox.__version__
[2]:
'0.3.0'

TAD file should store as BED6 format:

[3]:
!head -n 10 ../../../tests/test_data/tad_chr9_4000000_6000000.bed
chr9    4060000 4170000 .       0       .
chr9    4290000 4370000 .       0       .
chr9    4370000 4590000 .       0       .
chr9    4590000 5790000 .       0       .
chr9    4660000 5620000 .       0       .
chr9    4660000 4750000 .       0       .
chr9    4750000 5620000 .       0       .
chr9    4750000 5120000 .       0       .
chr9    4750000 4980000 .       0       .
chr9    4920000 4980000 .       0       .
[4]:
example_cool = "../../../tests/test_data/cool_chr9_4000000_6000000.mcool"
example_tads = "../../../tests/test_data/tad_chr9_4000000_6000000.bed"

test_region = "chr9:4000000-6000000"

frame = XAxis() + \
    Cool(example_cool) + \
    TADCoverage(example_tads, border_only=True, alpha=1.0)

frame.plot(test_region)
[4]:
../_images/_gallery_TADs_5_0.png
[5]:
frame = XAxis() + \
    Cool(example_cool, style="matrix") + \
    TADCoverage(example_tads, alpha=0.2, color="blue", border_width=0)

frame.plot(test_region)
[5]:
../_images/_gallery_TADs_6_0.png

CLI code

[6]:
%%bash

cool="../../../tests/test_data/cool_chr9_4000000_6000000.mcool"
tads="../../../tests/test_data/tad_chr9_4000000_6000000.bed"

coolbox add XAxis - \
add Cool $cool - \
add TADCoverage $tads --border_only True --alpha 1.0 - \
goto "chr9:4000000-6000000" - \
plot /tmp/test_coolbox.png
[W::hts_idx_load2] The index file is older than the data file: ../../../tests/test_data/tad_chr9_4000000_6000000.bed.bgz.tbi
[7]:
%%bash

cool="../../../tests/test_data/cool_chr9_4000000_6000000.mcool"
tads="../../../tests/test_data/tad_chr9_4000000_6000000.bed"

coolbox add XAxis - \
add Cool $cool --style matrix - \
add TADCoverage $tads --color blue --border_width 0 --alpha 0.2 - \
goto "chr9:4000000-6000000" - \
plot /tmp/test_coolbox.png
[W::hts_idx_load2] The index file is older than the data file: ../../../tests/test_data/tad_chr9_4000000_6000000.bed.bgz.tbi