i18928471899的个人博客分享 http://blog.sciencenet.cn/u/i18928471899

博文

技术贴 | 手把手教你如何画Circos图

已有 2316 次阅读 2021-5-8 08:24 |系统分类:科研笔记

本文由阿童木根据实践经验而整理,希望对大家有帮助。

原创微文,欢迎转发转载。


导读


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


软件:Circos

 

>官网:http://circos.ca/

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

>文献:Circos: An information aesthetic for comparative genomics. GenomeResearch 2009

>引用:近5000

>下载安装后,查看依赖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

<<include etc/colors_fonts_patterns.conf>>  # 导入配置文件:颜色
<<include etc/housekeeping.conf>>  ## 导入管家参数
<image>    
    <<include etc/image.conf>>
</image>

karyotype = file.karyotype  # 指定文件:染色体
chromosomes_units = 100000  # 指定距离单位u
chromosomes_display_default = yes  # 显示所有的染色体(no的话需要自己指定)

#
 1. 第一圈:染色体

<ideogram>

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

    </spacing>

    radius = 1r  # 初始圈半径
    thickness = 40p  # 圈厚度
    fill = yes  # 圈颜色,使用指定颜色
    stroke_color = 160,32,240  #染色体外边框轮廓颜色,十进制RGB
    stroke_thickness=2p  #轮廓厚度
</ideogram>

>塑型:circos

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

>成品:染色体

图片


第二圈:高亮


>新材料:file.highlight

# chr start end label
one 1 5 nothing
two 1 5 nothing
three 1 5 nothing


>模具:【追加到】circos.conf

# 2. 第二圈:高亮

<highlights>
    z = 0
    <highlight>
        file = file.highlight  # 高亮
        fill_color = 0,0,0  # RGB指定高亮颜色
        r0 = 0.90r  # 内径
        r1 = 0.95r  # 外径
    </highlight>
</highlights>


>塑型:circos

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


>成品:染色体+高亮

图片


第三圈:散点


>新材料:file.scatter

# chr start end label
one       1   5   nothing
two       1   5   nothing
three       1    5    nothing


>模具:【追加】<plots>其中的<plot>【到】circos.conf

<plots>
thickness = 1p
# 3. 第三圈:形状色块

    <plot>
        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
    </plot>
</plots>


>塑型:circos

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

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

图片


第四圈:柱状图


>新材料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

>模具:【追加】新的<plot>【到】circos.conf中的<plots>

<plot>
        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  # 方向:朝外
    </plot>

    <plot>
        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  # 方向:朝圆心
    </plot>


>塑型:circos

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

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

图片


结束语:


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

图片



感谢阅读~ 


图片你可能还喜欢图片

技术贴 | 16S专题 | 简单介绍如何用自己的笔记本处理高通量16S数据

2 技术贴 | 宏基因组专题 | 组装工具盘点和比较

3 技术贴 | R语言菌群Alpha多样性分析和绘图

技术贴 | 宏转录组专题 | DDBJ数据库:宏转录组测序数据下载

技术贴 | R语言pheatmap聚类分析和热图



微生态科研学术群期待与您交流更多微生态科研问题

(联系微生态老师即可申请入群)

图片

了解更多菌群知识,请关注“微生态”。


图片


微信扫一扫
关注该公众号




https://blog.sciencenet.cn/blog-3474220-1285527.html

上一篇:作者解读 | JHM:利用MICP(微生物诱导碳酸钙沉淀)技术修复铅污染对土壤物理结构的影响
下一篇:综述 | SBB:来源于植物还是微生物?综述土壤稳定有机质的分子组成(下)
收藏 IP: 183.240.41.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-21 13:36

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部