前期的时候,我们画ABcompartment 往往需要个性化嵌入以下代码:
ax.fill_between(mat['start'], 0, mat[eigen],where=mat[eigen]>= 0, facecolor=color1)
ax.fill_between(mat['start'], 0, mat[eigen],where=mat[eigen] < 0, facecolor=color2)
自从研究了pyGenomeTrack之后,发现pyGenomeTrack也能实现ABcompartment的画法,哈哈哈,真是方便呐~~
具体实现方法如下:
pyGenomeTracks --tracks config.ini --region chr10:0-150982314 --outFileName chr10_40000_AB_minus.pdf --width 22 --height 20
其核心需要配置config.ini ,那么我们来看一眼config的内容:
[x-axis]
where = top
#color = #0000FF
#color = #DE8BF9
#color = #0F99B2
[test bedgraph]
file = sam1_Acom.bg
height = 1
color=#F0EA3A
title = sam1
min_value=0
max_value=1.5
[test bedgraph]
file=sam1_Bcom.bg
height=1
color=#204BA0
min_value=-1.5
max_value=0
[test bedgraph]
file = sam2_Acom.bg
height = 1
color=#F0EA3A
title = sam2
min_value=0
max_value=1.5
[test bedgraph]
file=sam2_Bcom.bg
height=1
color=#204BA0
min_value=-1.5
max_value=0
[test bedgraph]
file = sam3_Acom.bg
height = 1
color=#F0EA3A
title = sam3
min_value=0
max_value=1.5
[test bedgraph]
file=sam3_Bcom.bg
height=1
color=#204BA0
min_value=-1.5
max_value=0
[test bedgraph]
file = sam2-sam1_Acom.bg
height = 1
color=#F0EA3A
title = sam2-sam1
min_value=0
max_value=2.5
[test bedgraph]
file=sam2-sam1_Bcom.bg
height=1
color=#204BA0
min_value=-2.5
max_value=0
[test bedgraph]
file = sam3-sam1_Acom.bg
height = 1
color=#F0EA3A
title = sam3-sam1
min_value=0
max_value=2.5
[test bedgraph]
file=sam3-sam1_Bcom.bg
height=1
color=#204BA0
min_value=-2.5
max_value=0
[test bedgraph]
file = sam2-sam1_Acom.bg
height = 1
color=#F0EA3A
title = sam3-sam2
min_value=0
max_value=2.5
[test bedgraph]
file=sam2-sam1_Bcom.bg
height=1
color=#204BA0
min_value=-2.5
max_value=0
config中核心文件 Acom.bg(pc1>0)格式如下:
总共4列 chr start end pc1
chr10 40000 80000 0.028098
chr10 80000 120000 0.115531
chr10 800000 840000 0.391115
chr10 3080000 3120000 0.288466
chr10 3200000 3240000 0.0274775
chr10 3320000 3360000 0.118719
chr10 6440000 6480000 0.0658824
chr10 6560000 6600000 0.05398390000000001
chr10 7000000 7040000 0.35875300000000004
chr10 7160000 7200000 0.233938
config中核心文件 B com.bg(pc1<0)格式如下:
总共4列 chr start end pc1
chr10 120000 160000 -0.060273000000000077
chr10 240000 280000 -0.006977999999999984
chr10 360000 400000 -0.32917830000000003
chr10 520000 560000 -0.082446
chr10 600000 640000 -0.120475
chr10 760000 800000 -0.08050699999999994
chr10 880000 920000 -0.06900700000000004
chr10 1240000 1280000 -0.08115699999999992
chr10 1360000 1400000 -0.181178
chr10 1400000 1440000 -0.008543000000000078
配置完成之后就大功告成了,来简单看一下效果~~