Circos
What is Circos ? Circos is a software package for visualizing data and information. It visualizes data in a circular layout — this makes Circos ideal for exploring relationships between objects or positions. There are other reasons why a circular layout is advantageous, not the least being the fact that it is attractive.
Circos is ideal for creating publication-quality infographics and illustrations with a high data-to-ink ratio, richly layered data and pleasant symmetries. You have fine control each element in the figure to tailor its focus points and detail to your audience [1].
上面应用了Circos官网的一段简介,简单来说Circos就是一个用于“画圈”的工具。期初该工具主要是为展现染色体数据所设计的(接下来的例子就是以 数据为例的),当然你也可以运用到任何其他的领域,只要数据格式没错。
Circos是基于perl开发的,并且需要大量的package来支持,如果你是windows用户,建议你先利用PPM将相关的包安装好,如果你是linux用户,例如ubuntu用户,则可以利用
“sudo apt-get install lib[package_name]-perl” 这种形式进行安装。Circos工具可以从官网下载 (建议你把tools和tutorial压缩包也下下来以便自己学习)。
1. 安装
tar zxvf circos-0.69.tgz
cd circos-0.69/exmaple
./run
这主要是为了测试该工具能否运行
如果出错,则可能是你系统perl所在路径和circos中所设置的不同,这个时候有两种解决策略:
1) cd circos-0.69/bin 将circos文件中头表改成你的perl所在路径,例如(你的perl在/usr/bin/目录下)#!/usr/bin/env perl 或 #!/usr/bin/perl
2) ln -s /usr/bin/perl /bin/perl
之后再一次cd circos-0.69/example,运行./run
这一次你依旧会出错。你会在example/目录下发现run.out文件,里面记录了你出错的原因,其实就是缺包,因此你只要把这些包全装一遍就可以了(当然有些包可能不存在了,这时你可以选择其他包代替,或者是忽略,如果还是不能运行那就再找我吧,这里就不详细描述这些包了)。对于linux用户,例如ubuntu用户可以利用
“sudo apt-get install lib[package_name]-perl” 方式来安装相应的包,如果是windows用户可以利用PPM来安装。
2. 运用
大图先放上!
这个图中包含了很多模块,例如(1)染色体构图,(2)染色体上的标尺,(3)染色体之间的连接,(4)histogram, line, heatmap plots, text (基因注释) 等。对于每个模块中的细节(颜色的设置,哪些染色体需要展示等等)则需要另外一些模块来控制。是不是有点晕?好我们先看总体框架吧:
main –> genome, ideogram, ticks, links, plots
links –> rules
plots –> rules,backgrounds,axes等
这里main就是一个大模块,它把其他模块都加入其中。运行时也只需要指出该文件。
genome 模块中设置了勾画染色体所需要的数据,及一些基本设置例如颜色之类的。
ideogram 用于对整个图像布局,以及细节的处理进行一些设置。
ticks 就是对 genome勾画出来的染色体上加入标尺之类的。
links 则用用加载不同染色体之间的连接所依据的数据以及相应的设置,这些设置的一部分可以通过加载rules模块来完成。
plots 可用于勾画直方图,曲线图,热图等等,当然你需要提供相应的数据,部分设置需要通过加载rules, background, axes等模块来完成(如果你闲麻烦也可以把这些模块中的代码直接写入plots中就可以了,这样就无需加载这些模块了,但是这样并不利于后期的维护,而且也不利用代码的高效利用)。
rules 可以设定一些规则,来控制一些设置。
backgrounds和axes模块主要是服务于plots模块的,比如添加作图背景,添加预警线之类的。
另外还有一些其他模块是circos自带的,这些模块主要是用于定义颜色,字体之类的,运用时只需加载一下即可。下面为main的主要代码:
可以看出main就是用来加载你所需要的所有模块,之后通过命令:./circos -conf main.conf 就可以运行出结果了(我的代码中main.conf文件为conf文件)。
3. 部分代码展示
genome.conf
ideogram.conf
ticks.conf
links.conf
plots.conf
代码下载:http://download.csdn.net/detail/lexwoefm/9383317
具体代码细节我都做了注释,再此就不多说了
Reference
[1] http://circos.ca/