2020-04-23 繪制Circos圖之二 測(cè)序深度

RNA轉(zhuǎn)錄組測(cè)序完成后,會(huì)進(jìn)行序列比對(duì),得到的結(jié)果是BAM格式的文件。
首先將生成的bam文件進(jìn)行排序,

samtools sort -@ 10 -o ./sort.bam/19-1.sorted.bam ./bam/19-1.bam ###將bam文件排序

查看bam文件,格式

samtools view -H /home/qinghai/my_first_circos/sort.bam/19-1.sorted.bam

hg19.genome數(shù)據(jù)的分布必須與下圖一致


圖片11.png

可以網(wǎng)上ucsc下載hg19.genome

sudo apt install mysql-client-core-8.0#
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -e "select chrom, size from hg19.chromInfo" > hg19.genome

別的物種也可以使用

http://genome.ucsc.edu/cgi-bin/hgGateway hgsid=1053922007_v51fhzoNz3YBAcyy1CIAVQtaeqM9

圖片2.png

人用hg19,鼠mm10,斑馬魚danRer11
如斑馬魚:mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -e "select chrom, size from danRer11
.chromInfo" > danRer11.genome

結(jié)果如下,和bam文件序列不一致,
圖片12.png

按照bam文件格式序列進(jìn)行修改,如果哪個(gè)染色體不需要,直接改為0,在這里我們只需要線粒體,其他都改為0


圖片12.png

bedtools makewindows 生成滑窗區(qū)域文本,可以理解-s -w 的區(qū)別,不清楚的可以直接輸入

bedtools makewindows獲取幫助信息

sudo apt install mysql-client-core-8.0#安裝
bedtools makewindows -g hg19.genome -w 10000000 #間隔1000000
chr1    0   10000000
chr1    10000000    20000000
chr1    20000000    30000000
chr1    30000000    40000000
$ bedtools makewindows -g hg19.genome -w 1000000 -s 500000
 chr1 0 1000000
 chr1 500000 1500000
 chr1 1000000 2000000
 chr1 1500000 2500000
 chr1 2000000 3000000
#bedtools makewindows -g hg19.genome -w 10000000 -s 1000000 > windows.bed
#or bedtools makewindows -g hg19.genome -w 100 -s 50 > windows.bed ##線粒體
bedtools makewindows -g hg19.genome -w 100  > windows.bed

> ### 注意需要?jiǎng)h掉genome文件第一行, 要不然會(huì)一直報(bào)錯(cuò)

chrom size
chr4 78093715
chr7 74282399
chr5 72500376
chr3 62628489
chr6 60270059
chr2 59640629
...

結(jié)果如下,三列


圖片12.png

bedtools makewindows用來自動(dòng)生成劃窗區(qū)間。-g genome.txt是要?jiǎng)澐值幕蚪M,格式為兩列:染色體、染色體長(zhǎng)度;-w 10000000為窗口大小為10M;-s 1000000為步長(zhǎng)為1M,即窗口在染色體上每次向右平移1M的距離;windows.bed為輸出文件,格式為三列:染色體、區(qū)間開始位點(diǎn)、區(qū)間結(jié)束位點(diǎn)。
自己編寫hg19.txt或genome容易出錯(cuò),需要通過mysql下載hg19.genome,然后根據(jù)需要進(jìn)行修改才行。
線粒體測(cè)序深度結(jié)果運(yùn)行

bedtools coverage -mean -sorted -g hg19.genome -a  windows.bed -b /home/qinghai/my_first_circos/sort.bam/19-1.sorted.bam> 19-1.depth.txt
#

生成結(jié)果如下:
圖片12.png

這個(gè)結(jié)果還無法導(dǎo)入到mitochondrion.conf文件中,需要修改為下面的圖。可通過excel編輯


圖片12.png
karyotype.tair10.txt 中的信息 為,需要與之對(duì)應(yīng),因此第一列改為NC_027757.2
chr - NC_027757.2 human_mito 0 16596 chr1

如果需要區(qū)分正負(fù)鏈

bedtools makewindows -g hg191.genome -w 10 -i winnum > windows.bed
需要加上-i winnum
-i winnum" - use the window number as the ID (e.g. 1,2,3,4...).

圖片12.png

再通過excel編輯,在后面加上兩列,特別是第六列改為+
圖片13.png

bedtools coverage -mean -sorted -g hg19.genome -a  windows.bed -b /home/qinghai/my_first_circos/sort.bam/19-1.sorted.bam -s> 19-1plus.depth.txt
###正鏈深度表
bedtools coverage -mean -sorted -g hg19.genome -a  windows.bed -b /home/qinghai/my_first_circos/sort.bam/19-1.sorted.bam -S> 19-1minus.depth.txt
###負(fù)鏈深度表
圖片12.png

EXCEL中刪除4,5,6列,并加上標(biāo)題


圖片12.png

編輯mitochondrion.conf, 運(yùn)行程序

circos -conf mitochondrion.conf --outputdir Figure -outputfile Single35
#  --outputdir Figure  輸出文件夾位置,
#   -outputfile Single35  輸出文件名字

最終mitochondrion.conf 文件內(nèi)容

#以下幾列和<ideogram>部分是畫染色體的
karyotype = single_chr.txt#karyotype.txt的路徑
chromosomes_order_by_karyotype = yes #是否按照karyotype.txt文件中的順序來畫染色體
chromosomes_units              = 20 #將1000000堿基看作一個(gè)染色體單元
chromosomes_display_default    = yes #是否展示全部染色體
                                     #如果是no,則需要重新設(shè)置染色體,比如: chromosomes = 染色體1名稱;染色體2名稱
#設(shè)置染色體顏色chromosomes_color = 染色體1名稱=red;染色體2名稱=vvdred;染色體3名稱=vvlred
#其實(shí)只要將karyotype.txt最后一列定義為chr1-chrN即可;當(dāng)然上面這種方法是可以的,不過很麻煩,且一時(shí)也想不到那么多顏色
######################################################
<ideogram>
show = yes
radius=0.9r###less than 1r
thickness = 0p #染色體的寬度0-30
fill = no #是否填充

#設(shè)定ideograms輪廓,就是在染色體外邊框加線
#stroke_thickness = 1
#stroke_color = black

#染色體外圈的標(biāo)簽,比如chr1A、chr2A......
show_label = yes
label_font = default
label_radius=1r+90p
label_size=40
label_parallel = yes

#染色體之間的間隔
<spacing>
default = 0.005r
#<pairwise "/chr1A/ /chr2A/"> #在特定的兩條染色體之間加上自定義的距離
#spacing = 3r
#</pairwise>
</spacing>
</ideogram>

######################################################
#下面就是plot部分了,比如我要畫一個(gè)snp密度圖,和gene密度圖
<plots>###########
<plot>###First circle
type = histogram###choose histogram not line chart
thickness = 0.0  # 控制線條的粗細(xì)
max_gap = 1u #每隔1個(gè)單位畫一條分割線
file = mitochondrion_plus_polya.txt
color = black#邊框顏色,控制線條的顏色
fill_color = black_a4 #控制填充色,在折線的下方進(jìn)行顏色填充
#orientation = in #orientation = in代表 y = 0 位于r1上;orientation = out表示y = 0位于r0 上
min    = 0
max    = 1000 #設(shè)置y軸的范圍,超過的部分顯示不了
r0     = 0.93r
r1     = 0.99r
<axes>
<axis>
color     = lgreen
thickness = 2
position  = 0.1   #通過position直接設(shè)置軸線的位置,適合指定單條軸線,such as different kind of line including color, thickness
###spacing=0.05r ## drawing multiple axes at equal intervals
</axis>
<axis>
color     = lred
thickness = 2
position  = 0.002###drawing a red axe in position 0.002
</axis>


<axis>
color     = lred
thickness = 1

#spacing   = 0.15r####間隔線用#y0, y1指定范圍,再用spacing參數(shù)設(shè)定間隔的用法, 這種用法可以方便的設(shè)置多條軸線
</axis>
</axes>
<backgrounds>
<background>
#background=transparent
color     = 0,255,255,0.5 #  透明度設(shè)置說明; RGB顏色由三位數(shù)三組組成(網(wǎng)頁可以查詢);0.2是0-1直接的一個(gè)數(shù)字,越趨于0,透明度越高
#y0        = 0.006
</background>
<background>
color     = vvlred
y1        = 0.002
</background>
</backgrounds>

#orientation控制y軸0點(diǎn)的位置,orientation = in代表 y = 0 位于r1上;orientation = out表示y = 0位于r0 上
</plot>
###############################################
<plot>#Second circle
thickness = 0.5p
# 3. 第2圈:形狀色塊
show = yes
type = line  # 類型:scatter/line/histogram/heatmap

file =19-14plus.depth.txt  # 指定文件
r0 = 0.86r
r1 = 0.92r
max = 300000.0
min = 1000.0
orientation = out  # 方向:朝外
#glyph = rectangle  # 散點(diǎn)形狀:circle/triangle/rectangle
#glyph_size = 20  # 散點(diǎn)大小
fill_color = 0,0,0  # 填充色:紅色
stroke_color = 0,0,0  # 邊框色:紅色
stroke_thickness = 0.5
<backgrounds>
<background>
color     = 192,192,192,0.5
y0        = 0.006
</background>
<background>
color     = vvlgrey
y1        = 0.002
</background>
</backgrounds>
</plot>
###########################################################################
<plot>
type = highlight####高亮的區(qū)域type=histogram##數(shù)據(jù)展示情況,可以選擇直方圖、直線、散點(diǎn)、熱圖等
file = mitochondrion.txt
r1 = 0.8r
r0 = 0.85r
fill = no
stroke_color = green          # 邊框色:紅色
stroke_thickness = 0p###0 means none
fill_color = 255,255,0 #white填充顏色
</plot>
##################################################
<plot>
type = highlight
file = highligt.txt  # 高亮
fill_color = nothing  # RGB指定高亮顏色
r0 = 0.73r  # 內(nèi)徑
r1 = 0.78r  # 外徑
stroke_color = green          # 邊框色:紅色
stroke_thickness = 0.00###0 means none   
</plot>

##################################################
<plot>
thickness = 0.5p
# 3. 第三圈:形狀色塊
show = yes
type = line  # 類型:scatter/line/histogram/heatmap

file = 19-14plusminus.depth.txt  # 指定文件
r0 = 0.66r
r1 = 0.72r
max = 300000.0
min = 1000.0
orientation = in  # 方向:朝外
#glyph = rectangle  # 散點(diǎn)形狀:circle/triangle/rectangle
#glyph_size = 20  # 散點(diǎn)大小
fill_color = 0,0,0  # 填充色:紅色
stroke_color = 0,0,0  # 邊框色:紅色
stroke_thickness = 0.5
<backgrounds>
<background>
color     = 192,192,192,0.5
y0        = 0.006
</background>
<background>
color     = vvlgrey
y1        = 0.002
</background>
</backgrounds>
</plot>
###################################################
<plot>
type = histogram  

z = 2
max_gap = 0u
file = mitochondrion_minus_polya.txt  # 柱狀圖

color = black#邊框顏色,控制線條的顏色
fill_color = black_a4 #控制填充色,在折線的下方進(jìn)行顏色填充
r0 = 0.6r
r1 = 0.65r
orientation = in  # 方向:朝in
min    = 0
max    = 100 #設(shè)置y軸的范圍,超過的部分顯示不了
<backgrounds>
<background>
#background=transparent
color     = 0,255,255,0.5 #  透明度設(shè)置說明; RGB顏色由三位數(shù)三組組成(網(wǎng)頁可以查詢);0.2是0-1直接的一個(gè)數(shù)字,越趨于0,透明度越高
#y0        = 0.006
</background>
<background>
color     = vvlred
y1        = 0.002
</background>
</backgrounds>
</plot>
</plots>

##################################################
#<highlights>
    #z = 0
    #<highlight>
        #file = /home/qinghai/my_first_circos/highligt.txt  # 高亮
        #fill_color = 0,0,0  # RGB指定高亮顏色
        #r0 = 0.45r  # 內(nèi)徑
        #r1 = 0.5r  # 外徑
    #</highlight>
#</highlights>
######################################################
#以下部分是畫染色體刻度的
show_ticks = yes
show_tick_labels = yes
show_grid       = yes
<ticks>
z=5# z值越大,表明這個(gè)hightlights的優(yōu)先級(jí)越高,在與其他highlights重疊時(shí),優(yōu)先級(jí)越高的越先顯示。
tick_label_font  = light
radius=1.01r
radius=0.57r
color = black
thickness = 2p
multiplier = 1e-0 #multiplier = 1e-6物理位置乘以這個(gè)數(shù)來表示刻度位置,比如物理位置是10000000位堿基,則在刻度上為10
format=%d #刻度位置顯示為十進(jìn)制整數(shù)format的意思:%d 表示結(jié)果為整數(shù);%f 結(jié)果為浮點(diǎn)數(shù); %.1f 結(jié)果為小數(shù)點(diǎn)后保留1位; %.2f 結(jié)果為小數(shù)點(diǎn)后保留2位

#設(shè)置標(biāo)尺上的大刻度
<tick>

spacing = 50u #10個(gè)染色體單元,即10000000堿基長(zhǎng)度
size = 18p
show_label=no
#設(shè)置ticks'label離ticks的距離
label_offset = 30p
#設(shè)置ticks'label的字體大小
label_size = 30p
</tick>
#設(shè)置標(biāo)尺上的小刻度
<tick>
spacing = 5u
size = 8p
</tick>
<tick>
z=5
# 說明該設(shè)置只限于特定染色體,添加前后刻度連接線
chromosomes_display_default = yes
chromosomes         = chr1
spacing         = 5u
# 這里由于spacing設(shè)置的是5u,所以此時(shí)size會(huì)被tick1和tick2替換,故無需設(shè)置
size                = 0p
force_display           = yes
# grid起始位置
grid_start          = 0.59r
# grid終止位置,設(shè)置與外圈tick相同,使整體美觀
grid_end            = 1.01r
grid_color          = 232,232,232# grey
grid_thickness          = 2p
grid                = yes
</tick>

</ticks>

######################################################
#以下部分可以不用更改
<image>
<<include etc/image.conf>>
</image>
<<include etc/colors_fonts_patterns.conf>>
<<include etc/housekeeping.conf>>

single_chr.txt 內(nèi)容

chr - NC_027757.2 human_mito 0 16596 chr1
mitochondrion_plus_polya.txt 內(nèi)容
ID Start End Count
NC_027757.2 36 41 0
NC_027757.2 71 76 0
NC_027757.2 106 111 0
NC_027757.2 141 146 0
NC_027757.2 183 188 2
NC_027757.2 211 216 7
NC_027757.2 246 251 0
NC_027757.2 281 286 0
NC_027757.2 316 321 0
NC_027757.2 351 356 0
NC_027757.2 386 391 0
NC_027757.2 421 426 0
NC_027757.2 456 461 0
NC_027757.2 491 496 0
NC_027757.2 567 572 3
...............

mitochondrion.txt 內(nèi)容

NC_027757.2 577 647 fill_color=vlpred
NC_027757.2 648 1601 fill_color=vlppurple
NC_027757.2 1602 1670 fill_color=vlporange
NC_027757.2 1671 3229 fill_color=vlyellow
NC_027757.2 3220 3304 fill_color=vlpred
NC_027757.2 3307 4262 fill_color=vlppurple
NC_027757.2 4263 4331 fill_color=vlporange
NC_027757.2 4402 4469 fill_color=vlyellow
NC_027757.2 4470 5511 fill_color=vlpred
NC_027757.2 5512 5579 fill_color=vlppurple
NC_027757.2 5904 7445 fill_color=vlporange
NC_027757.2 7518 7585 fill_color=vlyellow
NC_027757.2 7586 8269 fill_color=vlpred
NC_027757.2 8295 8364 fill_color=vlppurple
NC_027757.2 8366 8572 fill_color=vlporange
NC_027757.2 8527 9207 fill_color=vlyellow
NC_027757.2 9207 9990 fill_color=vlpred
NC_027757.2 9991 10058 fill_color=vlppurple
NC_027757.2 10059 10404 fill_color=vlporange
NC_027757.2 10405 10469 fill_color=vlyellow
NC_027757.2 10470 10766 fill_color=vlpred
NC_027757.2 10760 12137 fill_color=vlppurple
NC_027757.2 12138 12206 fill_color=vlporange
NC_027757.2 12207 12265 fill_color=vlyellow
NC_027757.2 12266 12336 fill_color=vlpred
NC_027757.2 12337 14148 fill_color=vlppurple
NC_027757.2 14747 15887 fill_color=vlporange
NC_027757.2 15883 15953 fill_color=vlyellow

highligt.txt 內(nèi)容

NC_027757.2 4339 4400 fill_color=vlporange
NC_027757.2 5587 5655 fill_color=vlporange
NC_027757.2 5657 5729 fill_color=vlppurple
NC_027757.2 5761 5826 fill_color=vlporange
NC_027757.2 5827 5891 fill_color=vlpurple
NC_027757.2 7446 7514 fill_color=vlporange
NC_027757.2 14149 14673 fill_color=vlppurple
NC_027757.2 14674 14742 fill_color=vlporange
NC_027757.2 15956 16023 fill_color=vlppurple

19-14plusminus.depth.txt 內(nèi)容

ID Start End Count
NC_027757.2 0 10 3276.399902
NC_027757.2 10 20 4897.100098
NC_027757.2 20 30 6683.700195
NC_027757.2 30 40 9275.700195
NC_027757.2 40 50 13224.40039
NC_027757.2 50 60 14929.7002
NC_027757.2 60 70 17682.69922
NC_027757.2 70 80 19832
NC_027757.2 80 90 20589.80078
NC_027757.2 90 100 20817.90039
NC_027757.2 100 110 21192.30078
NC_027757.2 110 120 21874.40039
NC_027757.2 120 130 22982
NC_027757.2 130 140 23440.5
................

mitochondrion_minus_polya.txt 內(nèi)容

ID Start End Count
NC_027757.2 16551 16546 7
NC_027757.2 16522 16517 3
NC_027757.2 16488 16483 2
NC_027757.2 16461 16456 3
NC_027757.2 16417 16412 3
NC_027757.2 16394 16389 0
NC_027757.2 16347 16342 2
NC_027757.2 16324 16319 0
NC_027757.2 16289 16284 0
NC_027757.2 16254 16249 0
NC_027757.2 16219 16214 0
NC_027757.2 16184 16179 0
NC_027757.2 16149 16144 0
NC_027757.2 16110 16105 1
NC_027757.2 16062 16057 12

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容