跟著Nature Genetics學(xué)作圖:R語(yǔ)言ggplot2頻率分布圖展示TE的identity

論文

High-quality de novo assembly of the apple genome and methylome dynamics of early fruit development

https://www.nature.com/articles/ng.3886/

蘋果基因組ng.3886.pdf

今天的推文我們來(lái)試著復(fù)現(xiàn)一下論文中的Figure3c

image.png

論文中對(duì)應(yīng)的圖注

Distribution of sequence identity values between genomic copies and consensus repeats in the GDDH13 assembly (based on 2,198,722 data points). The relative frequencies per percentage of identity of the Helitron, TIR, LTR, LINE, SINE and unclassified TEs (NoCat) are represented in different colors.

論文中的部分?jǐn)?shù)據(jù)存儲(chǔ)在這個(gè)鏈接

https://iris.angers.inra.fr/gddh13/the-apple-genome-downloads.html

image.png

這個(gè)TE注釋里有identity這個(gè)值(這里我不太確定是不是用到的這個(gè)值來(lái)畫圖)

文件的格式

image.png

寫個(gè)腳本把SINE LINE 和Helitron的值提取出來(lái)

import sys
import re

input_txt = sys.argv[1]
output_txt = sys.argv[2]



pattern01 = sys.argv[3]

regexp01 = re.compile(pattern01)

pattern02 = "ID=\S+;"

regexp02 = re.compile(pattern02)

fr = open(input_txt,'r')

ID_list = []

for line in fr:
    if 'TargetDescription' in line and len(regexp01.findall(line)) >= 1:
        ID_list.append(regexp02.findall(line)[0].replace("ID=","").replace(";",""))
        
        
print(len(ID_list))

fr.close()

fr = open(input_txt,'r')

pattern03 = "Parent=\S+;"
regexp03 = re.compile(pattern03)

pattern04 = "Identity=\S+"
regexp04 = re.compile(pattern04)

fw = open(output_txt,'w')
for line in fr:
    if "Parent" in line and regexp03.findall(line)[0].replace("Parent=","").replace(";","") in ID_list:
        if len(regexp04.findall(line)) >= 1:
            fw.write("%s=%s\n"%(regexp04.findall(line)[0],pattern01))

fw.close()

運(yùn)行腳本

python appleNG.py GDDH13_1-1_TE.gff3 line_identity.txt LINE
python appleNG.py GDDH13_1-1_TE.gff3 sine_identity.txt SINE
python appleNG.py GDDH13_1-1_TE.gff3 helitron_identity.txt Helitron

輸出文件格式

image.png

接下來(lái)是畫圖代碼

library(tidyverse)

dfsine<-read_delim("sine_identity.txt",
               delim = "=",
               col_names = FALSE)
dfline<-read_delim("line_identity.txt",
                   delim = "=",
                   col_names = FALSE)
dfhelitron<-read_delim("helitron_identity.txt",
                   delim = "=",
                   col_names = FALSE)

df<-bind_rows(dfsine,dfline,dfhelitron)



ggplot(data=df,aes(x=X2,stat(density),color=X3))+
  geom_freqpoly(binwidth=1,linewidth=3)+
  theme_classic()+
  scale_x_continuous(expand = expansion(mult = c(0,0)),
                     limits = c(60,100))+
  scale_y_continuous(expand = expansion(mult = c(0,0)),
                     limits = c(0,0.1))+
  labs(y="Frequency",x="Identity")+
  scale_color_manual(values = c("#2d2884","#c2a20c","#6497d0"),
                     name="Element")
image.png

和論文中的圖并不能完全對(duì)應(yīng)上,不太清楚論文中是怎么來(lái)統(tǒng)計(jì)這個(gè)值的

怎么根據(jù)這個(gè)identity的值算插入時(shí)間暫時(shí)還沒(méi)有搞明白

這個(gè)圖的峰和binwidth的值設(shè)置是有關(guān)系焦辅,binwidth如果改動(dòng)债查,line的第二個(gè)峰也會(huì)有影響蛤吓,不太明白這個(gè)參數(shù)應(yīng)該怎么設(shè)置

論文中對(duì)這個(gè)圖的描述文字

To investigate the evolutionary history of TEs in the apple genome, we plotted the distribution of identity values between genomic copies and their consensus sequences (Fig. 3c). Distributions for all classes of repeats showed a peak at 77% identity. By considering the mutation rate that has been reported for LTR-RTs in plants (1.3 × 10?8 base substitutions per site per year40,41), we estimated the age of those insertions as described by the International Human Genome Sequencing Consortium42. We concluded that the peak at 77% identity corresponded to an insertion age of around 21 million years ago (Mya) (Fig. 3c).
We also noted a second peak, particularly for LINE elements, at 98% identity that corresponded to a TE burst at ~1.6 Mya

TEs also have an important role in structuring genomes. The in-depth TE annotation we performed showed a major TE burst in apple that we estimated to have happened around 21 Mya. This affected all types of TEs, suggesting that the precursor of the modern apple underwent environmental changes with resulting stresses that led to the activation of these TEs50. The observed TE burst corresponds to the Miocene epoch (23 Mya to 5 Mya) and may coincide with two events: the divergence between pear and apple48 and an uplift event occurring at the Tian Shan mountains51, which cover the region where the ancestor of the apple originates from52. We hypothesize that these TE bursts, which presumably must have been very different in the predecessor of pear and apple, have contributed to the diversification, and possibly even speciation, of these plants.

推文記錄的是自己的學(xué)習(xí)筆記原献,很可能存在錯(cuò)誤,請(qǐng)大家批判著看

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末棚品,一起剝皮案震驚了整個(gè)濱河市艺栈,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌放妈,老刑警劉巖北救,帶你破解...
    沈念sama閱讀 206,013評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件荐操,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡珍策,警方通過(guò)查閱死者的電腦和手機(jī)托启,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,205評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)膛壹,“玉大人驾中,你說(shuō)我怎么就攤上這事∧A” “怎么了肩民?”我有些...
    開封第一講書人閱讀 152,370評(píng)論 0 342
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)链方。 經(jīng)常有香客問(wèn)我持痰,道長(zhǎng),這世上最難降的妖魔是什么祟蚀? 我笑而不...
    開封第一講書人閱讀 55,168評(píng)論 1 278
  • 正文 為了忘掉前任工窍,我火速辦了婚禮,結(jié)果婚禮上前酿,老公的妹妹穿的比我還像新娘患雏。我一直安慰自己,他們只是感情好罢维,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,153評(píng)論 5 371
  • 文/花漫 我一把揭開白布淹仑。 她就那樣靜靜地躺著,像睡著了一般肺孵。 火紅的嫁衣襯著肌膚如雪匀借。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 48,954評(píng)論 1 283
  • 那天平窘,我揣著相機(jī)與錄音吓肋,去河邊找鬼。 笑死瑰艘,一個(gè)胖子當(dāng)著我的面吹牛是鬼,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播磅叛,決...
    沈念sama閱讀 38,271評(píng)論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼屑咳,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了弊琴?” 一聲冷哼從身側(cè)響起兆龙,我...
    開封第一講書人閱讀 36,916評(píng)論 0 259
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后紫皇,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體慰安,經(jīng)...
    沈念sama閱讀 43,382評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,877評(píng)論 2 323
  • 正文 我和宋清朗相戀三年聪铺,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了化焕。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 37,989評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡铃剔,死狀恐怖撒桨,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情键兜,我是刑警寧澤凤类,帶...
    沈念sama閱讀 33,624評(píng)論 4 322
  • 正文 年R本政府宣布,位于F島的核電站普气,受9級(jí)特大地震影響谜疤,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜现诀,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,209評(píng)論 3 307
  • 文/蒙蒙 一夷磕、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧仔沿,春花似錦坐桩、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,199評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至烘浦,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間萍鲸,已是汗流浹背闷叉。 一陣腳步聲響...
    開封第一講書人閱讀 31,418評(píng)論 1 260
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留脊阴,地道東北人握侧。 一個(gè)月前我還...
    沈念sama閱讀 45,401評(píng)論 2 352
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像嘿期,于是被迫代替她去往敵國(guó)和親品擎。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,700評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容