Circos绘图—基础

之前看过一张关于人口迁徙的图,感觉很惊艳,后面了解到Circos这个工具,虽然主要是用于染色体基因组的图的绘制,但是在其他方面也是有着很好的可视化效果

汽车交易中的用户行为模式追踪

How do customers "flow" between brands and car segments?

 城市规划

 

 人类迁移模式

 政治辩论

 1 网页可视化绘制

http://mkweb.bcgsc.ca/tableviewer/    准备好其标准的txt文件,上传后可视化,较为简单

 上传txt文件:(格式参考:http://mkweb.bcgsc.ca/tableviewer/samples/

 

 2 基础

可以自定义化的东西比较多 

1.安装circos与Perl

为了能运行circos,还需安装Perl,它是一种解释性语言,我们不需要了解这种语言

Windows用户应该下载 Strawberry Perl (推荐)或者 ActiveState Perl.

随后打开perl command line进行模块安装

# 在命令行下输入以下代码
cpan Carp Clone Config::General Cwd Data::Dumper Digest::MD5 File::Basename File::Spec::Functions File::Temp FindBin Font::TTF::Font GD GD::Image Getopt::Long IO::File List::MoreUtils List::Util Math::Round Math::Trig Math::VecStat Memoize Params::Validate Pod::Usage POSIX Readonly Regexp::Common Statistics::Basic Storable Sys::Hostname Text::Balanced Text::Format Time::HiRes

 circos没有用户界面,所有操作都是在命令行进行,在UNIX和Windows系统均可运行

在命令检验是否安装好:

下载circos http://circos.ca/software/download/

 选择最新版本即可 直接解压下载

 接下来可以通过PowerShell进行测试,验证是否可以作图。

关于Pwershell: 使用windows+r 输入 powershell 即可打开

PowerShell是跨平台的,cmd是Windows专用的。有面向对象的管道,能够调用.NET的很多功能。

PS D:\Circos\circos-0.69-6> cd .\example\
PS D:\Circos\circos-0.69-6\example> ls


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        7/31/2019     07:32                data
d-----        7/31/2019     07:32                etc
-a----        6/17/2017     07:36        3693061 circos.png
-a----        6/17/2017     07:37         258048 circos.svg
-a----         6/4/2017     09:05           1476 README
-a----         6/4/2017     09:05            202 run
-a----         6/4/2017     09:05          37130 run.out


PS D:\Circos\circos-0.69-6\example> ..\bin\circos -conf .\etc\circos.conf

可以出图 在example文件夹下

2.运行circos

使用PS检查所需模块是否都已经安装成功。

PS D:\Circos\circos-0.69-6\example> cd D:\Circos\circos-0.69-6\bin
PS D:\Circos\circos-0.69-6\bin> ./circos -module
ok       1.23 Carp
ok       0.31 Clone
ok       2.60 Config::General
ok       3.36 Cwd
ok      2.131 Data::Dumper
ok       2.51 Digest::MD5
ok       2.82 File::Basename
ok       3.33 File::Spec::Functions
ok       0.22 File::Temp
ok       1.50 FindBin
ok       0.39 Font::TTF::Font
ok       2.46 GD
ok        0.2 GD::Polyline
ok       2.38 Getopt::Long
ok       1.15 IO::File
ok       0.33 List::MoreUtils
ok       1.23 List::Util
ok       0.01 Math::Bezier
ok      1.997 Math::BigFloat
ok       0.06 Math::Round
ok       0.08 Math::VecStat
ok       1.02 Memoize
ok       1.24 POSIX
ok       1.05 Params::Validate
ok       1.36 Pod::Usage
ok       1.03 Readonly
ok 2013031301 Regexp::Common
ok       2.50 SVG
ok       1.19 Set::IntSpan
ok     1.6611 Statistics::Basic
ok       2.30 Storable
ok       1.16 Sys::Hostname
ok       2.02 Text::Balanced
ok       0.59 Text::Format
ok     1.9724 Time::HiRes
PS D:\Circos\circos-0.69-6\bin>

http://www.circos.ca/documentation/tutorials/quick_start/  可以从这个开始

作图模式:

 

使用最少的配置文件,先把图片画出来。下面的案例将展示人类上色后的24条染色体,随后也可以加入一些额外参数

可以在记事本里编写代码,将后缀名改为.conf

# circos.conf

karyotype = data/karyotype/karyotype.human.txt

<ideogram>

<spacing>
default = 0.005r
</spacing>

radius    = 0.9r
thickness = 20p
fill      = yes

</ideogram>

################################################################
# The remaining content is standard and required. It is imported 
# from default files in the Circos distribution.
#
# These should be present in every Circos configuration file and
# overridden as required. To see the content of these files, 
# look in etc/ in the Circos distribution.

<image>
# Included from Circos distribution.
<<include etc/image.conf>>
</image>

# RGB/HSV color definitions, color lists, location of fonts, fill patterns.
# Included from Circos distribution.
<<include etc/colors_fonts_patterns.conf>>

# Debugging, I/O an dother system parameters
# Included from Circos distribution.
<<include etc/housekeeping.conf>>

KARYOTYPE

karyotype文件一般来说都是需要的,它定义了染色体的名称,大小,颜色。但是circos可以展示很多其它的数据,所以该文件的参数也并不限定针对染色体。

在安装好的circos/data/karyotype/文件夹下已经自带了数个常见生物的序列信息:人类,小鼠,大鼠,果蝇。

当参数karyotype指定了一个文件的位置的时候,文件路径可以是绝对路径或者是相对路径,相对路径的意思就是如果在运行目录没有找到指定文件,就会在circos文件夹下寻找,这也是为什么此处我们只需要指定data/karyotype的原因。

IDEOGRAMS

一旦circos有了染色体信息可以用来作图的时候,核型模式图信息就会被需要来告诉circos在哪里进行标记。

ideogram区块的参数可以指定,例如radius, thickness, fill,除此之外,<spacing>参数也可以指定两条染色体之间的间隔。

运行

将以上代码保存为circos.conf,powershell进入该文件所在位置,调用circos即可作图;

 

 结果如下:

 

 

 

参考:

http://circos.ca/intro/general_data/  多种领域应用

http://mkweb.bcgsc.ca/tableviewer/samples/ 案例图

http://www.circos.ca/software/download/circos/ 主页下载

http://genomevisualization.com/documentation/tutorials/configuration/distribution_and_installation/ 安装运行

 http://genomevisualization.com/documentation/tutorials/configuration/runtime_parameters/

https://www.jianshu.com/p/3ff6b91dfb19

posted @ 2020-02-14 23:29  icydengyw  阅读(6373)  评论(0编辑  收藏  举报