Circos系列教程(三)突出标记Highlight 6

这一节的目标是画出下面的图

亮显强调

亮显强调

所谓突出标记,或者说亮显强调,多是通过大的反差明显或者符合色彩心理学的色块来将数据分组强调出来。在使用circos绘制基因组时,可以使用这一办法,将不同区域同一组内的基因亮显出来。

circos流程图

circos流程图

首先需要定义数据结构。这里还需要上一节的关于染色体组型(karyotypes)数据结构的知识。

数据结构

ID START END

这里的ID对应的是karyotypes数据文件当中的ID,start和end分别定义起始和终止的位置。下面就是具体的例子:

hs1 0 259871
hs1 669458 2686613
hs1 2727905 3991852
hs1 5645456 6816208
hs1 7553915 14224162
hs1 15152815 16859159
hs1 16973585 17838807
hs1 18630086 29725898
hs1 30758584 34604030
hs1 34793307 35631322

数据保存在文本文件当中就可以了,之后由conf文件调用。

当然这一数据文件可以更复杂,用于定义每个highlight的位置,色彩,以及宽度等等。比如

hs1 1298972 1300443 fill_color=blue
hs1 1311738 1324571 fill_color=red,r0=0.6r,r1=0.6r+50p
hs1 1397026 1421444 fill_color=green,r0=1.1r,r1=1.15r
hs1 1437417 1459927 fill_color=green,r0=1.1r,r1=1.15r
hs1 1540746 1555847 fill_color=yellow
hs1 1560962 1645635 fill_color=purple
hs1 1624179 1645623 fill_color=grey

设置文件

与之前一致的,我们需要设置好circos的设置文件,它需要包括前一节介绍的全部:circos.conf, ideogram.conf,和ticks.conf来定义一,数据源,二如何画染色体,三如何画坐标。而highlight的部分,直接定在circos.conf文件当中也好,或者写在highlight.conf当中,由circos.conf来调用也是一样的。我们来看具体circos.conf的示例:

<colors>
<<include etc/colors.conf>>
<<include etc/brewer.conf>>
</colors>
 
<fonts>
<<include etc/fonts.conf>>
</fonts>
 
<<include ideogram.conf>>
<<include ticks.conf>>
 
<image>
<<include etc/image.conf>>
</image>
 
karyotype   = data/karyotype/karyotype.human.hg19.txt
 
chromosomes_units           = 1000000
chromosomes_display_default = no
chromosomes                 = hs1;hs2;hs3

这一部分,与之前一节别而二致。其下的内容就是如何载入highlight的数据了:

################################################################
#
# define highlights within <highlights> block
#
# note that the radial axis grid is drawn on top of the highlights
 
<highlights>
 
# the default value for z-depth and fill_color for all highlights
 
z = 0
fill_color = green
 
# drawn from 60% radius to inner edge of ideogram
# radius and will be green (default color)
<highlight>
file       = data/3/genes.large.txt
r0         = 0.6r
r1         = dims(ideogram,radius_inner)
</highlight>
 
# the second set will be drawn on top of the first (higher z-depth)
# and will be 100px wide in the radial direction, starting at 0.7x of
# the ideogram radius
<highlight>
file       = data/3/genes.large.txt
r0         = 0.7r
r1         = 0.7r + 100p
z          = 5
fill_color = red
</highlight>
 
# by drawing black with transparency, you can darken the color
# in the track below
<highlight>
file       = data/3/genes.large.txt
r0         = 0.7r + 100p
r1         = 0.7r + 200p
z          = 10
fill_color = black_a5
</highlight>
 
# the third set will be outside the circle (r0,r1>1) and will be
# blue with dark blue border around each highlight
 
<highlight>
file         = data/3/genes.large.txt
r0           = 1.075r
r1           = 1.125r
fill_color   = blue
stroke_color = vdblue
stroke_thickness = 2
</highlight>
 
# orange strip in the middle
 
<highlight>
file         = data/3/genes.large.txt
r0           = 1.09r
r1           = 1.11r
fill_color   = orange
z            = 5
</highlight>
 
</highlights>

我们注意到,在highlights的定义当中,首先定义了两个默认属性z-depth和fill_color。而每个highlight都可以自定义自己的属性,而在数据文件中,也可以定义得更加具体。
其它可定义的属性有:

r0 - highlight的内径
r1 - highlight的外径
offset - 内外径的偏移值
fill_color - highlight slice的填充色
stroke_color - highlight边框颜色,如果指定的边框大小的话
stroke_thickness - 边框大小
z - z轴,决定着划图的先后次序,后画的可能会盖住先画的
ideogram - toggles the position of the highlight to be within the ideogram extent

设置好设置文件之后,就可以使用circos出图了。

/path/to/circos/bin/circos -conf path/to/circos.conf

注意,这里include会从circos所在的目录开始寻找,而不是当前目录。

高亮图

高亮图

上面的画出来的图,使用的是最简单的数据结构。如果我们需要对每一节的高显部分都分明定义色彩,位置等属性,那就需要使用上面提到的复杂的数据结构了。其效果如下:

highlight_fill_color

使用不同填充色

highlight_r

不同的r0,r1值呈现的效果

highlight_z_index

设置不同的z值呈现叠加效果

本节所使用的代码下载highlight

6 thoughts on “Circos系列教程(三)突出标记Highlight

  1. Reply Jane 3月 11,2014 7:41 上午

    你好!circos安装问题已解决,谢谢!但今天画highlight时遇到问题,circos的安装路径是/usr/bin/circos,我在/usr/bin下建立了data文件夹存放circos.conf等数据文件,然后在该路径下运行circos -conf ./data/circos.conf,提示如下错误:
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 1.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 1.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 1.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 2.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 2.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 2.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 3.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 3.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 3.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 4.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 4.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 4.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 5.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 5.
    Use of uninitialized value in bitwise or (|) at /usr/share/perl5/Graphics/ColorNames.pm line 328, line 5.
    Missing color name at /usr/share/perl5/Graphics/ColorObject.pm line 1902
    Compilation failed in require at /usr/share/perl5/Circos/Colors.pm line 96.
    BEGIN failed–compilation aborted at /usr/share/perl5/Circos/Colors.pm line 96.
    Compilation failed in require at /usr/share/perl5/Circos.pm line 99.
    BEGIN failed–compilation aborted at /usr/share/perl5/Circos.pm line 99.
    Compilation failed in require at /usr/bin/circos line 184.
    BEGIN failed–compilation aborted at /usr/bin/circos line 184.

    请问如何解决?谢谢!

  2. Reply mike 8月 8,2014 1:37 上午

    请问博主,为什么我有许多颜色没有呢,比如green,red,orange,但是有blue.我的配色方案肯定有问题,问题是我该如何诊断并纠错呢。
    另外,Z的值越大是不是越上层(越靠近观察者方向)?如果在circos.conf中和组型文件,例如gene.large.txt中有同样的设置,比如circos.conf设置fill_color=blue而在组型文件中的某个或某些段点设置为fill_color=black,会以组型文件中为准,是这样的吧。

  3. Reply Sandy 1月 6,2015 12:30 上午

    请问为何我在include颜色配置的时候,加入colors.ucsc.conf就没问题,加入colors.conf就会报错。

    • Reply admin 1月 6,2015 4:03 下午

      我不知道你这两个文件的唯一区别就是文件名,还是有其它的不同。如果只是文件名不同,那这个问题就比较奇怪了。

  4. Reply bingyu 4月 25,2016 10:56 上午

    楼主你好,我想在上面画SNP分布,不知要怎么转换?

Leave a Reply

  

  

  

%d 博主赞过: