歡迎關注天下博客:http://blog.genesino.com/2012/04/circos-usage/
Circos
是繪制圈圖的神器,在http://circos.ca/images/頁面有很多CIRCOS可視化的示例。
[圖片上傳失敗...(image-9361b4-1517212240284)]
[圖片上傳失敗...(image-92969a-1517212240285)]
Circos可以在線使用,在線使用時是把表格轉為圈圖,不過只允許最大75行和75列;做一些簡單的示意圖會比較好,最后時會介紹下在線的tableviewer
的使用。
也可以安裝在本地,在本地可以繪制基于基因組的更復雜的圖。
Circos由Perl寫成,安裝相對簡單,只要Perl的包都裝好了就可以了。
Circos安裝
-
從http://circos.ca/software/download/circos/下載Circos安裝包,并解壓,把安裝包內的bin目錄加載到環境變量。
wget http://circos.ca/distribution/circos-0.69-6.tgz tar xvzf circos-0.69-6.tgz ln -s `pwd`/circos-0.69-6/bin/* ~/bin #make sure ~/bin is in $PATH or # 注意pwd兩側的反引號 export PATH=$PATH:`pwd`/circos-0.69/bin
-
安裝依賴的Perl包
-
配置CPANM (CPANM是一個文件,下載下來,增加可執行屬性,放到環境變量中即可使用)
# 若無根用戶權限,也可放入自己家目錄下在環境變量內的目錄中就可以 wget https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm -O /sbin/cpanm chmod +x /sbin/cpanm
-
獲得依賴的Perl包,
circos -module
ok 1.11 Carp missing Clone missing Config::General ok 3.3 Cwd ok 2.124 Data::Dumper ok 2.55 Digest::MD5 ok 2.77 File::Basename ok 3.3 File::Spec::Functions ok 0.22 File::Temp ok 1.50 FindBin missing Font::TTF::Font missing GD missing GD::Polyline ok 2.38 Getopt::Long ok 1.14 IO::File missing List::MoreUtils ok 1.21 List::Util missing Math::Bezier ok 1.60 Math::BigFloat missing Math::Round missing Math::VecStat ok 1.01_03 Memoize ok 1.17 POSIX missing Params::Validate ok 1.36 Pod::Usage missing Readonly missing Regexp::Common missing SVG missing Set::IntSpan missing Statistics::Basic ok 2.20 Storable ok 1.11 Sys::Hostname ok 2.0.0 Text::Balanced missing Text::Format ok 1.9721 Time::HiRes
-
獲取缺失模塊并安裝
# 第一句話的目的只是查看需要運行的命令,直接運行第二句就好 circos -module | grep 'missing' | awk '{a=a" "$2;}END{print "cpanm"a}' circos -module | grep 'missing' | awk '{a=a" "$2;}END{system("cpanm"a);}'
-
再運行
circos -module
發現GD
和GD::Polyline
沒安裝上,查看錯誤信息是No package 'gdlib' found
# 根用戶 yum install gd-devel
然后再用
cpanm
安裝GD
和GD::Polyline
。
-
最簡單出圖
把下面的內容存儲到任意目錄下的任意文件比如ehbio.conf
下,然后運行circos -conf ehbio.conf
就可以獲得circos的圖circos.png
和circos.svg
。
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>>
[圖片上傳失敗...(image-87531b-1517212240285)]
上述命令是怎么運行的呢?
# karyotype定義染色體的名字、ID、起始位置信息,是繪制圖的根本
karyotype = data/karyotype/karyotype.human.txt
# 必須的部分,控制染色體信息顯示
<ideogram>
# 定義染色體之間的間距,為圖形半徑的5% (r代表radius,半徑)
<spacing>
default = 0.005r
</spacing>
# 染色體區域的繪制位置,默認所有染色體都處于遠離圓心同樣距離的位置
# 這里設置的是圖形半徑的0.9倍的位置
# 也可以設置絕對像素值
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>>
最開始看CIRCOS的配置文件時,不理解其是如何查找用到的數據和配置目錄時,不過上面配置文件中被注釋掉的一句話泄露了天機look in etc/ in the Circos distribution
。配置文件和數據文件默認先在當前目錄查找,若沒有則去CIRCOS的安裝目錄下查找。
下面列出了CIRCOS搜索配置文件時查找的目錄(搜索數據時也類似)
.
./etc
/MPATHB/soft/circos-0.69-6/bin/etc
/MPATHB/soft/circos-0.69-6/bin/../etc
/MPATHB/soft/circos-0.69-6/bin/..
/MPATHB/soft/circos-0.69-6/bin
不得不敢寫CIRCOS的日志輸出,很詳細,每次都刷屏。當我們運行CIRCOS失敗時,看下日志信息,會得到很多提示。
數據和配置文件都在CIRCOS安裝目錄下,那么先看看它的目錄結構吧。
circos安裝目錄介紹
bin
: 目錄下是circos
可執行程序,加入環境變量即可
data
: 目錄下有一個文件夾karyotype
,里面收錄了幾個物種染色體信息文件。
karyotype.chimp.txt karyotype.arabidopsis.tair10.txt
karyotype.human.hg38.txt karyotype.human.hg19.txt
karyotype.mouse.mm10.txt karyotype.yeast.txt karyotype.zeamays.txt
這個是繪制CIRCOS圖所必須的一個文件 (文件的內容雖然通常是染色體的信息,但不局限于染色體信息,其它的區域信息、時間序列信息都可以使用)
文件內容如下 (#
后面是注釋,會被忽略)
前兩列是固定的,chr -
。chr
表示定義一條染色體;-
表示指定這個區域的父區域,染色體沒有父區域,用-
代替。
ID
是當前區域的名字,其子區域的父區域列都使用這個名字。如果同時繪制多個物種,可在ID中包含物種的代號。
LABEL
是當前區域顯示的名字。
START END
是當前區域的范圍,必須是整個的區域。如果想顯示部分區域,可在后續配置中修改。
COLOR
是當前區域的顏色,CIRCOS為每個染色體有定義好的顏色,存儲于etc/colors.conf
。除了預先定義了染色體的顏色,還定義了一些顏色變量可以直接使用。
#chr - ID LABEL START END COLOR
chr - hs1 1 0 248956422 chr1
chr - hs2 2 0 242193529 chr2
chr - hs3 3 0 198295559 chr3
chr - hs4 4 0 190214555 chr4
chr - hs5 5 0 181538259 chr5
chr - hs6 6 0 170805979 chr6
chr - hs7 7 0 159345973 chr7
chr - hs8 8 0 145138636 chr8
chr - hs9 9 0 138394717 chr9
etc
目錄下是配置文件,前面引用到了3個。
image.conf
內容如下
<<include image.generic.conf>>
<<include background.white.conf>>
image.generic.conf
內容如下,定義了輸出的圖形的名字、格式、大小等,這些都可以在自定義配置文件,即前面提到的ehbio.conf
中覆蓋。
dir = .
#dir = conf(configdir)
file = circos.png
png = yes
svg = yes
# radius of inscribed circle in image
radius = 1500p
# by default angle=0 is at 3 o'clock position
angle_offset = -90
#angle_orientation = counterclockwise
auto_alpha_colors = yes
auto_alpha_steps = 5
background.white.conf
只定義了背景是白色。
colors_fonts_patterns.conf
引用了顏色、字體、預定義的圖形文件信息的配置
<colors>
<<include etc/colors.conf>>
</colors>
<fonts>
<<include etc/fonts.conf>>
</fonts>
<patterns>
<<include etc/patterns.conf>>
</patterns>
colors.conf
及其引用文件內容摘錄如下,利用RGB組合設置了顏色變量、系列顏色和染色體的顏色。(染色體的名字全部使用小寫)
dpblue = 0,153,237
vdpblue = 0,136,220
vvdpblue = 0,120,204
vvlpurple = purples-7-seq-1
vlpurple = purples-7-seq-2
gpos100 = 0,0,0
gpos = 0,0,0
gpos75 = 130,130,130
chr1 = 153,102,0
chr2 = 102,102,0
chr3 = 153,153,30
patterns.conf
定義特殊小圖形的信息
# pattern fills for PNG files
vline = tiles/vlines.png
vline-sparse = tiles/vlines-sparse.png
hline = tiles/hlines.png
hline-sparse = tiles/hlines-sparse.png
checker = tiles/checkers.png
checker-sparse = tiles/checkers-sparse.png
dot = tiles/dots.png
dot-sparse = tiles/dots-sparse.png
solid = tiles/solid.png
housekeeping.conf
必須在最上層自定義配置文件中(也就是ehbio.conf
)中引用。這個文件名字起的很生物,持家配置,必須要,而且不建議修改。具體內容就不列出了,感興趣的自己去看。
染色體信息展示和調整
把前面的配置文件再拓展一些,給染色體加上名字,并且按照染色深淺上色。
karyotype
變量指定了繪制CIRCOS圖所必須的一個文件 (文件的內容雖然通常是染色體的信息,但不局限于染色體信息,其它的區域信息、時間序列信息都可以使用)
文件內容如下 (#
后面是注釋,會被忽略)
前兩列是固定的,chr -
。chr
表示定義一條染色體;-
表示指定這個區域的父區域,染色體沒有父區域,用-
代替。
ID
是當前區域的名字,其子區域的父區域列都使用這個名字。如果同時繪制多個物種,可在ID中包含物種的代號。
LABEL
是當前區域顯示的名字。
START END
是當前區域的范圍,必須是整個的區域。如果想顯示部分區域,可在后續配置中修改。
COLOR
是當前區域的顏色,CIRCOS為每個染色體有定義好的顏色,存儲于etc/colors.conf
。除了預先定義了染色體的顏色,還定義了一些顏色變量可以直接使用。
#chr - ID LABEL START END COLOR
chr - hs1 1 0 248956422 chr1
chr - hs2 2 0 242193529 chr2
chr - hs3 3 0 198295559 chr3
chr - hs4 4 0 190214555 chr4
chr - hs5 5 0 181538259 chr5
chr - hs6 6 0 170805979 chr6
chr - hs7 7 0 159345973 chr7
chr - hs8 8 0 145138636 chr8
chr - hs9 9 0 138394717 chr9
如果有cytogenetic band
信息,則寫到文件末尾。band
是固定的,DOMAIN
指定從屬信息,對應于上面染色體的ID
信息。其它列與上面解釋相同。
#band DOAMIN ID LABEL START END COLOR
band hs1 p36.33 p36.33 0 2300000 gneg
band hs1 p36.32 p36.32 2300000 5400000 gpos25
band hs1 p36.31 p36.31 5400000 7200000 gneg
band hs1 p36.23 p36.23 7200000 9200000 gpos25
band hs1 p36.22 p36.22 9200000 12700000 gneg
band hs1 p36.21 p36.21 12700000 16200000 gpos50
[圖片上傳失敗...(image-f380a4-1517212240285)]
# karyotype定義染色體的名字、ID、起始位置信息,是繪制圖的根本
karyotype = data/karyotype/karyotype.human.txt
# 必須的部分,控制染色體信息顯示
# http://circos.ca/documentation/tutorials/reference/ideogram/
<ideogram>
# 定義顯示的染色體之間的間距,為圖形半徑的0.5% (r代表radius,半徑)
<spacing>
default = 0.005r
</spacing>
# 染色體區域的繪制位置,默認所有染色體都處于遠離圓心同樣距離的位置
# 這里設置的是圖形半徑的0.9倍的位置
# 也可以設置絕對像素值
radius = 0.9r
# 染色體區域的寬度,可以是相對圖形半徑,也可以說絕對像素值
thickness = 20p
# 染色體區域填充顏色
fill = yes
# 染色體邊的顏色和寬度
stroke_thickness = 2
stroke_color = black
# 顯示染色體標簽名字
# 更多label的調整見
# http://circos.ca/documentation/tutorials/ideograms/labels/lesson
show_label = yes
label_font = default
# ideogram外圈再加總半徑的0.05
label_radius = dims(ideogram,radius_outer) + 0.005r
# 如果想把label標記在圈里可以寫,外圈半徑+內圈半徑除以2
# label_rdius = (dims(ideogram,radius_outer)+dims(ideogram,radius_inner))/2
label_size = 24
# label與圈平行
label_parallel = yes
label_case = upper
# 顯示karyotype中定義的細胞遺傳學條帶
# fill_bands=yes 表示使用預先定義的顏色
show_bands = yes
fill_bands = yes
band_transparency = 4
</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>>
file* = circos_label_band.png
</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>>
顯示染色體刻度信息,chromosome_units
定義染色體一個單位的大小,縮寫為u
。若chromosome_units=1000000
, 則10u=10000000
。
[圖片上傳失敗...(image-77a416-1517212240285)]
# karyotype定義染色體的名字、ID、起始位置信息,是繪制圖的根本
karyotype = data/karyotype/karyotype.human.txt
# 必須的部分,控制染色體信息顯示
# 更多解釋見
# http://circos.ca/documentation/tutorials/reference/ideogram/
<ideogram>
# 定義顯示的染色體之間的間距,為圖形半徑的0.5% (r代表radius,半徑)
<spacing>
default = 0.005r
</spacing>
# 染色體區域的繪制位置,默認所有染色體都處于遠離圓心同樣距離的位置
# 這里設置的是圖形半徑的0.9倍的位置
# 也可以設置絕對像素值
radius = 0.9r
# 染色體區域的寬度,可以是相對圖形半徑,也可以說絕對像素值
thickness = 20p
# 染色體區域填充顏色
fill = yes
# 染色體邊的顏色和寬度
stroke_thickness = 2
stroke_color = black
# 顯示染色體標簽名字
# 更多label的調整見
# http://circos.ca/documentation/tutorials/ideograms/labels/lesson
show_label = yes
label_font = default
# ideogram外圈再加總半徑的0.05
label_radius = dims(ideogram,radius_outer) + 0.05r
# 如果想把label標記在圈里可以寫,外圈半徑+內圈半徑除以2
# label_rdius = (dims(ideogram,radius_outer)+dims(ideogram,radius_inner))/2
label_size = 24
# label與圈平行
label_parallel = yes
label_case = upper
# 顯示karyotype中定義的細胞遺傳學條帶
# fill_bands=yes 表示使用預先定義的顏色
show_bands = yes
fill_bands = yes
band_transparency = 4
</ideogram>
chromosomes_units = 1000000
show_ticks = yes
show_tick_labels = yes
<ticks>
# ticks塊定義了全局水平的tick的屬性
# 更多解釋見http://circos.ca/documentation/tutorials/ticks_and_labels/basics/
# ticks出現的位置
radius = dims(ideogram,radius_outer)
# The label multiplier is the constant used to multiply the tick value to obtain the tick label. For example, if the multiplier is 1e-6, then the tick mark at position 10, 000, 000 will have a label of 10. The multiplier is applied to the raw tick value, regardless of the value of chromosomes_unit.
# multiplier是用于獲得ticks label的,當前ticks對應的染色體位置乘以multiplier就得到ticks label
# 這個值的設置與chromosomes_units是沒有任何關系的
# 比如當前位置是10,000,000, 乘以multiplier (1e-6)就是10
multiplier = 1e-6
# ticks顏色、粗細、大小
color = black
thickness = 2p
size = 15p
# 默認所有染色體都顯示, 放置在ticks塊中全局有效
chromosomes_display_default=yes
# 不在任何染色體顯示, 放置在tick塊中單個tick有效
# 單詞拼錯無效
#chromosomes_display_default=no
# 每個tick定義一種間隔,20u, 5u, 還可增加3u,4u等, 大的刻度會覆蓋小的刻度
# 20u的間隔,定義大的ticks,并顯示ticks_label
<tick>
# spacing定義多大間距一個tick
spacing = 20u
show_label = yes
label_size = 20p
# label的偏移量
label_offset = 10p
# %d, %.nf
format = %d
</tick>
# 5u的間隔,定義小的ticks
<tick>
spacing = 5u
color = grey
size = 10p
# 定義在哪些染色體顯示ticks,哪些區域不顯示
chromosomes=-hs1;-hs2:0-100;-hs3:100-)
</tick>
# 30u的間隔,定義中等的ticks
<tick>
chromosomes_display_default=no
spacing = 30u
color = red
size = 15p
chromosomes=hs1
</tick>
</ticks>
################################################################
# 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>>
file* = circos_label_band_tick.png
</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>>
在CIRCOS中chromosome
表示karyotype
文件中定義的染色體的序列結構信息。ideogram
是chromosome
信息的展示方式。一個染色體可以不展示,也有可能分成多段展示,可以選擇圖的位置,設置每個染色體的位置、相對大小。
# karyotype定義染色體的名字、ID、起始位置信息,是繪制圖的根本
karyotype = data/karyotype/karyotype.human.txt
# 必須的部分,控制染色體信息顯示
# 更多解釋見
# http://circos.ca/documentation/tutorials/reference/ideogram/
<ideogram>
# 定義顯示的染色體之間的間距,為圖形半徑的0.5% (r代表radius,半徑)
<spacing>
default = 0.005r
</spacing>
# 染色體區域的繪制位置,默認所有染色體都處于遠離圓心同樣距離的位置
# 這里設置的是圖形半徑的0.9倍的位置
# 也可以設置絕對像素值
radius = 0.9r
# 改變染色體在circos環中內半徑大小
# 染色體區域的寬度,可以是相對圖形半徑,也可以說絕對像素值
thickness = 20p
# 染色體區域填充顏色
fill = yes
# 染色體邊的顏色和寬度
stroke_thickness = 2
stroke_color = black
# 顯示染色體標簽名字
# 更多label的調整見
# http://circos.ca/documentation/tutorials/ideograms/labels/lesson
show_label = yes
label_font = default
# ideogram外圈再加總半徑的0.05
label_radius = dims(ideogram,radius_outer) + 0.05r
# 如果想把label標記在圈里可以寫,外圈半徑+內圈半徑除以2
# label_rdius = (dims(ideogram,radius_outer)+dims(ideogram,radius_inner))/2
label_size = 24
# label與圈平行
label_parallel = yes
label_case = upper
# 顯示karyotype中定義的細胞遺傳學條帶
# fill_bands=yes 表示使用預先定義的顏色
show_bands = yes
fill_bands = yes
band_transparency = 4
</ideogram>
# 染色體大小調整
chromosomes_scale = hs1=0.1r;hs14=0.06r;hs6=0.06r
# 個別染色體位置調整
chromosomes_radius = hs14:0.8r;hs6:0.8r;hs1:0.7r
chromosomes_units = 1000000
show_ticks = yes
show_tick_labels = yes
<ticks>
# ticks塊定義了全局水平的tick的屬性
# 更多解釋見http://circos.ca/documentation/tutorials/ticks_and_labels/basics/
# ticks出現的位置
radius = dims(ideogram,radius_outer)
# The label multiplier is the constant used to multiply the tick value to obtain the tick label. For example, if the multiplier is 1e-6, then the tick mark at position 10, 000, 000 will have a label of 10. The multiplier is applied to the raw tick value, regardless of the value of chromosomes_unit.
# multiplier是用于獲得ticks label的,當前ticks對應的染色體位置乘以multiplier就得到ticks label
# 這個值的設置與chromosomes_units是沒有任何關系的
# 比如當前位置是10,000,000, 乘以multiplier (1e-6)就是10
multiplier = 1e-6
# ticks顏色、粗細、大小
color = black
thickness = 2p
size = 15p
# 默認所有染色體都顯示, 放置在ticks塊中有效
chromosomes_display_default=yes
# 不在任何染色體顯示, 放置在ticks塊中有效
#chromosomes_display_default=no
# 每個tick定義一種間隔,20u, 5u, 還可增加3u,4u等, 大的刻度會覆蓋小的刻度
# 20u的間隔,定義大的ticks,并顯示ticks_label
<tick>
# spacing定義多大間距一個tick
spacing = 20u
show_label = yes
label_size = 20p
# label的偏移量
label_offset = 10p
# %d, %.nf
format = %d
chromosomes=-hs1;-hs14;-hs6
</tick>
# 5u的間隔,定義小的ticks
<tick>
spacing = 5u
color = grey
size = 10p
# 定義在哪些染色體顯示ticks,哪些區域不顯示
chromosomes=-hs1;-hs14;-hs6;-hs2:0-100;-hs3:100-)
</tick>
# 30u的間隔,定義中等的ticks
<tick>
chromosomes_display_default=no
spacing = 30u
color = red
size = 15p
chromosomes=hs1
</tick>
</ticks>
################################################################
# 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>>
file* = circos_label_band_tick_chromove.png
#畫圖起始的位置,相對于三點鐘方向
angle_offset* = 74
# 圖形大小
radius = 800p
</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>>
[圖片上傳失敗...(image-104f91-1517212240285)]
CIRCOS錯誤信息
-
Dimension [$DIMS->{'ideogram'}{'default'}{
' radius_outer'
}] isnot defined
in expression [dims(ideogram, default, radius_outer) + 0.05r]-
radius_outer
前面多了個空格
-
-
CONFIGURATION FILE ERROR; Circos could
not find
the configuration file [simple.confy]]- 配置文件不存在,或名字、路徑寫錯了
-
Config::General: Block "<ticks>" has no EndBlock statement (level: 2, chunk 4191)!
- 區塊標簽不成對
-
設置的效果沒有顯示也沒報銷
- 確認單詞拼寫是否有問題
- 確認是否寫入了正確的語句塊內
-
Circos::Error::fatal_error('configuration', 'multivalue', 'angle_offset', 'image')
- 沒有強制覆蓋默認值
CIRCOS增加熱圖、點圖、線圖和區塊屬性
CIRCOS圖在有了染色體信息界定繪圖區域后,就可以向里面添加離散數據如標記特定的區域或連續數據如展示修飾的豐度等。
經過前面部分對CIRCOS基本安裝,最簡單繪圖和調整各部分屬性的熟悉后,這些基本配置都可以寫入單獨的文件,供多次使用,就像下面主配置文件中的include
所示。
而我們每次繪圖主要修改的部分就在主配置文件里面,更換下對應圈的文件名、半徑和繪制屬性即可。
main circos configure (test.circos.conf)
<<include etc/colors_fonts_patterns.conf>>
# # 必須的部分,控制染色體信息顯示
# # 之前兩篇教程為了方便理解ideogram和ticks都是直接寫在主配置文件的
# # 但通常實際使用時會拆分成不同文件,方便管理,所以這里采用了引用方式
# # 具體解釋都見前面的文章
<<include ideogram.conf>>
<<include ticks.conf>>
# 定義輸出
<image>
<<include etc/image.conf>>
file*=test.circos.png
dir*=./
</image>
# karyotype定義染色體的名字、ID、起始位置信息,是繪制圖的根本
# 具體解釋看前面2篇文章
karyotype = test.chromsomes.circos_input.txt
# `chromosome_units`定義染色體一個單位的大小,縮寫為`u`。若`chromosome_units=1000000`,
則`10u=10000000`。
# 后面會用到這個單位,尤其是ticks中
chromosomes_units =1000000
chromosomes_display_default = yes
# 大標簽highlights,復數定義里面有多個highlight
<highlights>
# 高亮的區域放在 <highlight>標簽中,配置簡單,給定文件名和內外半徑就好
# 文件格式見下面解釋
<highlight>
file=HL1.bed.circos_input.txt
r0=0.914285714286r
r1=0.991428571429r
</highlight>
# 高亮的區域放在 <highlight>標簽中,配置簡單,給定文件名和內外半徑就好
# 文件格式見下面解釋
<highlight>
file=HL2.bed.circos_input.txt
r0=0.828571428571r
r1=0.905714285714r
</highlight>
# 高亮的區域放在 <highlight>標簽中,配置簡單,給定文件名和內外半徑就好
# 文件格式見下面解釋
<highlight>
file=HL3.bed.circos_input.txt
r0=0.742857142857r
r1=0.82r
</highlight>
</highlights>
# 定義繪制的線圖、點圖、熱圖、直方圖等,復數plots
<plots>
# 全局屬性定義
color = spectral-7-div-rev
stroke_thickness = 1
stroke_color = black
scale_log_base = 0.5
# 其中一個子圖,給定文件名,內外半徑,和繪制類型
# 文件格式見下面解釋
<plot>
file=Heatmap1.bed.circos_input.txt
type=line
r0=0.657142857143r
r1=0.734285714286r
</plot>
# 其中一個子圖,給定文件名,內外半徑,和繪制類型
# 文件格式見下面解釋
<plot>
file=Heatmap2.bed.circos_input.txt
type=scatter
r0=0.571428571429r
r1=0.648571428571r
</plot>
# 其中一個子圖,給定文件名,內外半徑,和繪制類型
# 文件格式見下面解釋
<plot>
file=Heatmap3.bed.circos_input.txt
type=histogram
r0=0.485714285714r
r1=0.562857142857r
</plot>
# 其中一個子圖,給定文件名,內外半徑,和繪制類型
# 文件格式見下面解釋
<plot>
file=Heatmap4.bed.circos_input.txt
type=heatmap
r0=0.4r
r1=0.477142857143r
</plot>
</plots>
<<include etc/housekeeping.conf>>
max_points_per_track* = 2500000
data_out_of_range* = trim
下面看下文件格式的要求
test.chromsomes.circos_input.txt
##chr - ID LABEL START END COLOR
chr - chr1 hs1 0 248956422 chr1
chr - chr2 hs2 0 242193529 chr2
chr - chr3 hs3 0 198295559 chr3
chr - chr4 hs4 0 190214555 chr4
chr - chr5 hs5 0 181538259 chr5
高亮文件的格式一致,選其中一個做例子 HL1.bed.circos_input.txt
#ParentID START END ATTRIBUTE
#ParentID對應于karyotype文件的ID(第3列)
#ATTRIBUTE列顏色的獲取看前面兩篇的介紹以獲知有多少可用顏色
chr1 0 6422000 fill_color=vlyellow
chr1 12447822 24895644 fill_color=vlpred
chr1 136926042 149373864 fill_color=vlppurple
chr1 236508618 248956422 fill_color=vlporange
chr2 0 2421000 fill_color=vlpred
chr2 36329031 48438708 fill_color=vlpgreen
chr2 193754832 205864509 fill_color=vlpred
chr2 133206447 145316124 fill_color=vlyellow
chr3 59488668 69403446 fill_color=vlpred
chr3 128892114 138806892 fill_color=vlpblue
chr3 1800000 198295559 fill_color=vlpred
chr4 0 2145550 fill_color=vlpgreen
chr4 95107280 104618008 fill_color=vlpblue
chr4 133150192 142660920 fill_color=vlppurple
chr4 190000000 190214555 fill_color=vlpgreen
chr5 0 1538259 fill_color=vlpblue
chr5 27230739 36307652 fill_color=vvlpgreen
chr5 72615304 81692217 fill_color=vvlyellow
chr5 127076782 136153695 fill_color=vvlporange
chr5 15382590 15392590 fill_color=vlpblue
數值文件格式也一致,只是給定不同的type
繪制不同屬性的圖,如線圖、熱圖等。
Heatmap1.bed.circos_input.txt
#ParentID START END Value
#ParentID對應于karyotype文件的ID (第3列)
#Value列為我們想展示的值
chr1 0 12447822 1
chr1 12447822 24895644 2
chr1 211612974 224060796 18
chr1 224060796 236508618 19
chr1 236508618 248956422 20
chr2 0 12109677 1
chr2 12109677 24219354 2
chr2 24219354 36329031 3
chr2 36329031 48438708 4
chr2 48438708 60548385 5
chr2 205864509 217974186 18
chr2 217974186 230083863 19
chr2 230083863 242193529 20
chr3 0 9914778 1
chr3 9914778 19829556 2
chr3 19829556 29744334 3
chr3 29744334 39659112 4
chr3 39659112 49573890 5
chr4 0 9510728 1
chr4 9510728 19021456 2
chr4 19021456 28532184 3
chr4 28532184 38042912 4
chr4 133150192 142660920 15
chr4 171193104 180703832 19
chr4 180703832 190214555 20
chr5 0 9076913 1
chr5 9076913 18153826 2
chr5 18153826 27230739 3
chr5 154307521 163384434 18
chr5 163384434 172461347 19
chr5 172461347 181538259 20
所有文件都準備好之后,運行circos -conf test.circos.conf
就可以獲得test.circos.svg
和test.circos.png
兩幅圖了。
如果有屬性不理解或還需修改屬性,請參考前兩篇及前兩篇提供的屬性修改文檔方便查找。
后臺回復circos,可獲取所有推文鏈接和本次的測試數據,直接體驗出圖。
生信寶典,一起學生信
http://mp.weixin.qq.com/s/i71OMaUu6QtcY0pt1njHQA
生信寶典,生物信息學習系列教程,轉錄組,宏基因組,外顯子組,R作圖,Python學習,Cytoscape視頻教程
http://mp.weixin.qq.com/s/d1KCETQZ88yaOLGwAtpWYg