circos 学习手册(十七)

2020-12-24  本文已影响0人  名本无名

link 和 relationships(二)

3. link formatting

通常,如果有多个数据文件,则每个文件都与自己的 <link> 块相关联

<links>

 # global parameters here
 ...

 <link>
  file = /path/to/file
  # local parameters for this data set
  ...
 </link>

 <link>
  file = /path/to/file
  # local parameters for this data set
  ...
 </link>

 ...

</links>

当在一个图像中组合多个 link 数据时,需要记住几件事

image.png

4. link rules - Part I

rules<plot><link> 块中特殊的块,它根据位置、值、格式或者与数据有关的任何其他属性

一般格式是

# for 2D plots
<plots>

 <plot>

 <rules>

  <rule>
  ...
  </rule>

 </rules>

 </plot>

</plots>

# for links
<links>

 <link>

 <rules>
  <rule>
  ...
  </rule>

 </rules>

 </link>

</links>

每个 <link> 块可以有一个关联的 <rules> 块,该块又包含一个或多个 <rule> 块。每个 <rule> 块都包含一个测试条件和格式参数。

link 通过测试条件,rule 块中的格式化参数将会应用于该 link

数据点被独立测试

rule 将独立应用于每个数据点。数据点可以是高亮显示、直方图,散点图或连接。

rule 被应用到一个数据点时,你可以访问数据点的属性,但是不能访问其他数据点。也就是说,没有直接的机制能够反问邻接数据点,但是你可以通过将一个 prevnext 参数与数据点关联起来

hs1 0 9 0.25 next=0.5
hs1 10 19 0.5 prev=0.25,next=0.75
hs1 20 29 0.75 prev=0.5,next=1.00
...

rule 语法

每个 rule 必须包含一个 condition 参数,用于测试每个数据点

4.1 rule 条件

条件的格式是 perl 代码,会被自动执行而不需要显式使用 eval() 函数。

可以使用一些辅助函数来简化对多个参数的测试(如 between)。你可以在条件表达式中任何数值后面加上 kbmbgb 表示碱基对乘子

有些特定的关键字在运行时被解析,例如 var(FIELD) 函数可以访问单个数据点的属性,其中 FIELD 可以是:

上述所说的跨度 n,表示连接的起始点和终止点,即 n=1(起始) 或 n=2(终止)

数字后缀仅应用于 link,并测试 link 的开始和结束,与单个坐标范围相关联的数据类型不使用数字后缀(eg,start

condition = var(chr1) eq "hs1"  # link starts on hs1
condition = var(size1) < 1mb    # link start span is shorter than 1Mb
condition = 1                   # always true for any link

4.2 条件测试

规则按以下顺序应用:

当规则通过测试时,它将应用于数据点,此时,规则链是否终止,取决于 flow 参数

默认情况下,通过第一条规则便终止规则链,当规则失败时,将在数据点上测试下一个规则。直到通过规则测试或者规则都测试完毕为止

规则级联

默认情况下,当通过规则,将终止规则链

<rule>
# if this rule passes
</rule>

<rule>
# all subsequent rules are not tested
</rule>

可以通过设置 flow 参数来更改此行为。如果 flow=continue,那么通过的规则不再使用级联短路。后续规则将被测试

<rule>
...
flow = continue # if this rule passes, continue testing
</rule>

flow 参数可以有四个不同的值

# continue testing
flow = continue { if true|false }
# continue testing, but start at top of rule chain
flow = restart  { if true|false }
# stop testing
flow = stop     { if true|false }
# goto rule associated with tag=TAG
flow = goto TAG { if true|false }

你可以有多个 flow 参数以满足不同的情况

<rule>
...
flow = stop if false
flow = goto otherrule if true
</rule>

<rule>
tag = otherrule
...
</rule>

如果存在 flow 指令,则规则可能缺少条件,你可以使用以下方法短路所有规则

<rule>
flow = stop
</rule>

使用 goto 跳过不想测试的规则

<rule>
flow = goto myrule
</rule>

... rules you don't want to use

<rule>
tag = myrule
...
</rule>

规则示例

下面是个简单的例子

<link>

 <link>

 file       = data/5/segdup.txt

 <rules>

  <rule>
   condition  = var(intrachr)
   show       = no
  </rule>

  <rule>
   condition  = between(hs1,hs2)
   color      = green
   z          = 10
   flow       = continue
  </rule>

  <rule>
   condition  = between(hs2,hs3)
   color      = blue
   thickness  = 2
   z          = 15
  </rule>

 </rules>

 </link>

</links>
image.png
上一篇 下一篇

猜你喜欢

热点阅读