plots
这个block 中,支持许多的图表类型,scatter plot
是最常用的一种。用法如下:
关于file
文件的内容,在之前的文章中已经详细介绍过。r0
和r1
定义圆环的位置,max
和min
定义y轴的最小值和最大值,剩余的几个参数控制散点的外观。
glyph
表示点的形状,circle
代表圆形,triangle
代表三角形,rectangle
代表矩形;glyph_size
控制点的大小;fill_color
控制点的填充色,stroke_color
控制边框的颜色。
关于scatter plot
, 在软件的安装目录下,有对应的默认配置
etc/tracks/scatter.conf
oritenation
表示方向,in
表示从r0到r1, out
表示从r1到r0
在plot
中,可以插入backgrounds
, axes
, rules
3种block
1. backgrounds
用法如下:
backgrounds
定义背景色,每个定义一个区域的背景色,这个区域由y0
和y1
定义。
在plot
中, max
和min
分别定义了y轴的最大值和最小值,这里的y0
和y1
对应的就是y轴的值;y0
代表起始位置,y1
代表终止位置;如果只指定了y0
和y1
中的一个,需要参考邻近区域和max,min的值作出判断
在上图的第一个background
中,只指定了y0 = 0.006
,从其他结果background
的设置可以推测出,此时的y1 = max
;
上面的例子中,根据y轴的值划分了3个区域,定义了3种不同 的背景色
- min到0.002,背景色为
vvlred
- 0.002到0.006,背景色为
vlgrey
- 0.006到max, 背景色为
vvlgreen
2. axes
用法如下:
axes
定义y轴的刻度线,由多个axis
构成。和backgrounds
一样,根据y0
和y1
定义区域,spacing
定义刻度线的间隔。
刻度线的外观由thickness
和color
两个参数控制,thickness
控制线条的粗细程度,color
控制线条的颜色。
3. rules
用法如下:
rules
代表规则,由多个rule
构成;在每个rule
中,conditioon
设置规则,var(value) > 0.006
表示 y轴的值大于0.006,当满足这个条件时,执行rule
中的其他语句,下面的示例中,调整了value > 0.006
的点的外观。
最后看一个实例
这张图中,除了染色体的圆环外,还有3圈圆环,每一个圆环都是一张scatter plot
, 而且都设置了背景色和刻度线。
结合整幅图的结构和散点图的用法,理解下面的配置文件就非常简单了
代码语言:javascript复制<<include colors_fonts_patterns.conf>><<include ideogram.conf>>
<<include ticks.conf>><image>
<<include etc/image.conf>>
</image>karyotype = data/karyotype/karyotype.human.txtchromosomes_units = 1000000
chromosomes = hs1;hs2;hs3
chromosomes_display_default = no################################################################
#
# define 3 scatter plots, using the same data file
#<plots># all are scatter plotstype = scatter
stroke_thickness = 1# first plot shows all points and selectively formats points at small/large
# y-axis values to be red/green and triangles/rectangles<plot>file = data/6/snp.density.txt
fill_color = grey
stroke_color = black
glyph = circle
glyph_size = 10max = 0.013
min = 0
r1 = 0.95r
r0 = 0.65r# optional y0/y1 values (absolute or relative) in <background> blocks
# define the start/end limits of background color
#
# y0 = 0.006
# y0 = 0.75r<backgrounds>
<background>
color = vvlgreen
y0 = 0.006
</background>
<background>
color = vlgrey
y1 = 0.006
y0 = 0.002
</background>
<background>
color = vvlred
y1 = 0.002
</background>
</backgrounds><axes>
<axis>
color = lgreen
thickness = 1
spacing = 0.05r
y0 = 0.006
</axis>
<axis>
color = dgreen
thickness = 2
spacing = 0.1r
y0 = 0.006
</axis><axis>
color = lgrey
thickness = 1
spacing = 0.05r
y1 = 0.006
y0 = 0.002
</axis>
<axis>
color = dgrey
thickness = 2
spacing = 0.1r
y1 = 0.006
y0 = 0.002
</axis><axis>
color = lred
thickness = 1
spacing = 0.05r
y1 = 0.002
</axis><axis>
color = dred
thickness = 2
spacing = 0.1r
y1 = 0.002
</axis></axes><rules><rule>
condition = var(value) > 0.006
stroke_color = dgreen
fill_color = green
glyph = rectangle
glyph_size = 8
</rule><rule>
condition = var(value) < 0.002
stroke_color = dred
fill_color = red
glyph = triangle
</rule></rules></plot># the second plot is a crop of the first plot, placed outside
# the ideogram circle, showing only points with large y-values<plot>file = data/6/snp.density.txt
fill_color = green
stroke_color = dgreen
glyph = rectangle
glyph_size = 8max = 0.013
min = 0.007
r1 = 1.175r
r0 = 1.075r<backgrounds>
# you can stack backgrounds by using transparent color
<background>
color = vlgreen_a4
y0 = 0.75r
</background>
<background>
color = vlgreen_a4
y0 = 0.5r
</background>
<background>
color = vlgreen_a4
y0 = 0.25r
</background>
<background>
color = vlgreen_a4
</background>
</backgrounds><axes>
<axis>
color = green_a3
thickness = 2
spacing = 0.1r
</axis>
</axes><rules><rule>
condition = var(value) < 0.007
show = no
</rule></rules></plot># the third plot is a crop of the first plot, placed closer to the
# center of the circle, showing only points with small y-values<plot>file = data/6/snp.density.txt
fill_color = red
stroke_color = dred
glyph = rectangle
glyph_size = 8max = 0.0015
min = 0.000
r1 = 0.60r
r0 = 0.35r<backgrounds>
<background>
color = vlred_a4
y1 = 0.25r
</background>
<background>
color = vlred_a4
y1 = 0.5r
</background>
<background>
color = vlred_a4
y1 = 0.75r
</background>
<background>
color = vlred_a4
</background>
</backgrounds><axes>
<axis>
color = red_a5
thickness = 1
spacing = 0.025r
</axis>
<axis>
color = red_a3
thickness = 2
spacing = 0.1r
</axis>
</axes><rules>
<rule>
condition = var(value) > 0.002
show = no
</rule>
</rules></plot></plots><<include etc/housekeeping.conf>>