前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >跟着Nature Genetics学作图:R语言ggplot2频率分布图展示TE的identity

跟着Nature Genetics学作图:R语言ggplot2频率分布图展示TE的identity

作者头像
用户7010445
发布2023-08-23 10:47:24
1600
发布2023-08-23 10:47:24
举报

论文

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

今天的推文我们来试着复现一下论文中的Figure3c

image.png

论文中对应的图注

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.

论文中的部分数据存储在这个链接

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

image.png

这个TE注释里有identity这个值(这里我不太确定是不是用到的这个值来画图)

文件的格式

image.png

写个脚本把SINE LINE 和Helitron的值提取出来

代码语言:javascript
复制
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()

运行脚本

代码语言:javascript
复制
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

接下来是画图代码

代码语言:javascript
复制
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

和论文中的图并不能完全对应上,不太清楚论文中是怎么来统计这个值的

怎么根据这个identity的值算插入时间暂时还没有搞明白

这个图的峰和binwidth的值设置是有关系,binwidth如果改动,line的第二个峰也会有影响,不太明白这个参数应该怎么设置

论文中对这个图的描述文字

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.

推文记录的是自己的学习笔记,很可能存在错误,请大家批判着看

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023-06-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 小明的数据分析笔记本 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 论文
  • 接下来是画图代码
  • 论文中对这个图的描述文字
相关产品与服务
数据保险箱
数据保险箱(Cloud Data Coffer Service,CDCS)为您提供更高安全系数的企业核心数据存储服务。您可以通过自定义过期天数的方法删除数据,避免误删带来的损害,还可以将数据跨地域存储,防止一些不可抗因素导致的数据丢失。数据保险箱支持通过控制台、API 等多样化方式快速简单接入,实现海量数据的存储管理。您可以使用数据保险箱对文件数据进行上传、下载,最终实现数据的安全存储和提取。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档