python画circos图_手把手教你画Circos图

导读

Circos是一个由加拿大科学家Martin Krzywinski利用perl语言开发的用于描述关系型数据和可视化多维度数据的软件。Circos凭借输入简单,不需要太多的数据处理技巧就能调整到要求的输入格式,输出美观、快捷等特点在比较基因组学和基因组绘图中非常受欢迎。下面用自己敲出来的小数据展示Circos基本绘图方法。

软件:Circos

文献:Circos: An information aesthetic for comparative genomics

杂志:Genome Research 2009

引用:~5000

官网:http://circos.ca/

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

下载安装后,查看依赖perl模块:

circos -modules

# 全部OK就能用circos画图了。

ok 1.36 Carp

ok 0.38 Clone

ok 2.63 Config::General

ok 3.56 Cwd

ok 2.173 Data::Dumper

ok 2.55 Digest::MD5

ok 2.85 File::Basename

ok 3.56 File::Spec::Functions

ok 0.2304 File::Temp

ok 1.51 FindBin

ok 0.39 Font::TTF::Font

ok 2.71 GD

ok 0.2 GD::Polyline

ok 2.45 Getopt::Long

ok 1.16 IO::File

ok 0.428 List::MoreUtils

ok 1.41 List::Util

ok 0.01 Math::Bezier

ok 1.9997 Math::BigFloat

ok 0.07 Math::Round

ok 0.08 Math::VecStat

ok 1.03 Memoize

ok 1.53_01 POSIX

ok 1.29 Params::Validate

ok 1.64 Pod::Usage

ok 2.05 Readonly

ok 2017060201 Regexp::Common

ok 2.84 SVG

ok 1.19 Set::IntSpan

ok 1.6611 Statistics::Basic

ok 2.53_01 Storable

ok 1.20 Sys::Hostname

ok 2.03 Text::Balanced

ok 0.61 Text::Format

ok 1.9726 Time::HiRes

第一圈:染色体

底料:file.karyotype

#chr bar contig rank start end col

chr - one 1 1 10 purple

chr - two 2 1 10 purple

chr - three 3 1 10 purple

# 可以根据最后一列的信息给染色体上色

模具:circos.conf

<> # 导入配置文件:颜色

<> ## 导入管家参数

<>

karyotype = file.karyotype # 指定文件:染色体

chromosomes_units = 100000 # 指定距离单位u

chromosomes_display_default = yes # 显示所有的染色体(no的话需要自己指定)

# 1. 第一圈:染色体

default = 0.005r

# 设置圈图中染色体之间的空隙大小,我们设置为0.005r的意思是每个染色体之间的空

radius = 1r # 初始圈半径

thickness = 40p # 圈厚度

fill = yes # 圈颜色,使用指定颜色

stroke_color = 160,32,240 #染色体外边框轮廓颜色,十进制RGB

stroke_thickness=2p #轮廓厚度

塑型:circos

mkdir Figure

circos-0.69-9/bin/circos -conf circos.conf --outputdir Figure -outputfile 1

成品:染色体

1.png

第二圈:高亮

新材料:file.highlight

# chr start end label

one 1 5 nothing

two 1 5 nothing

three 1 5 nothing

模具:【追加到】circos.conf

# 2. 第二圈:高亮

z = 0

file = file.highlight # 高亮

fill_color = 0,0,0 # RGB指定高亮颜色

r0 = 0.90r # 内径

r1 = 0.95r # 外径

塑型:circos

circos-0.69-9/bin/circos -conf circos.conf --outputdir Figure -outputfile 2

成品:染色体+高亮

2.png

第三圈:散点

新材料:file.scatter

# chr start end label

one 1 5 nothing

two 1 5 nothing

three 1 5 nothing

模具:【追加】其中的【到】circos.conf

thickness = 1p

# 3. 第三圈:形状色块

show = yes

type = scatter # 类型:scatter/line/histogram/heatmap

file = file.scatter # 指定文件

r0 = 0.80r

r1 = 0.85r

max = 1.0

min = 0.0

glyph = triangle # 散点形状:circle/triangle/rectangle

glyph_size = 60 # 散点大小

fill_color = 0,0,255 # 填充色:红色

stroke_color = 0,0,255 # 边框色:红色

stroke_thickness = 1

塑型:circos

circos-0.69-9/bin/circos -conf circos.conf --outputdir Figure -outputfile 3

成品:染色体+高亮+散点

3.png

第四圈:柱状图

新材料A:file.histogram.in

# chr start end size

one 4 5 1

one 3 4 0.5

one 2 3 0.1

two 4 5 1

two 3 4 0.5

two 2 3 0.1

three 4 5 1

three 3 4 0.5

three 2 3 0.1

新材料B:file.histogram.out

# chr start end size

one 1 2 1

one 2 3 0.5

one 3 4 0.1

two 1 2 1

two 2 3 0.5

two 3 4 0.1

three 1 2 1

three 2 3 0.5

three 3 4 0.1

模具:【追加】新的【到】circos.conf中的

type = histogram

z = 2

max_gap = 0u

file = file.histogram.out # 柱状图

color = red # 上色

fill_color = 255,0,0

r0 = 0.70r

r1 = 0.75r

orientation = out # 方向:朝外

type = histogram

z = 2

max_gap = 0u

file = file.histogram.in # 柱状图

color = blue # 上色

fill_color = 0,0,255

r0 = 0.65r

r1 = 0.70r

orientation = in # 方向:朝圆心

塑型:circos

circos-0.69-9/bin/circos -conf circos.conf --outputdir Figure -outputfile 4

成品:染色体+高亮+散点+柱形图

4.png

结束语:

利用以上方法,可对宏基因组Bin的数据进行Circos绘图,能得到下面的结果:

bin.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值