美文网首页
基因家族分析(4):基因家族蛋白质模体鉴定与可视化

基因家族分析(4):基因家族蛋白质模体鉴定与可视化

作者: 逐鸿 | 来源:发表于2023-03-13 16:23 被阅读0次

本文主要工作

  1. 使用meme鉴定了SBT家族的蛋白质模体组成
  2. 对meme鉴定结果进行处理并用ggplot2进行可视化

4.蛋白质与基因结构可视化分析

4.1 蛋白质模体预测

Protein Motif这个概念比较混乱,需要在这里特别说明。在生物化学中,一个比较清晰的英文定义是这样给出的:

”Protein motifs are small regions of protein three-dimensional structure or amino acid sequence shared among different proteins. They are recognizable regions of protein structure that may (or may not) be defined by a unique chemical or biological function.” (https://bio.libretexts.org/Bookshelves/Cell_and_Molecular_Biology/Book%3A_Basic_Cell_and_Molecular_Biology_(Bergtrom)/03%3A_Details_of_Protein_Structure/3.06%3A_Protein_Domains_Motifs_and_Folds_in_Protein_Structure))

翻译成中文即为 “蛋白质模体是不同蛋白质中共有的、小区域的蛋白质三维结构或是氨基酸序列。它们是蛋白质结构中可被识别的区域,可能(或可能不)具备生物学功能。”因此,我们可以大致理解为结构特别、可能具备一定功能的小的氨基酸序列,这个适用范围是所有的蛋白质的。而在基因家族分析中,它所适应的范围是我们所鉴定的基因家族内部的所有蛋白质,需要得到的模体短而保守,并可能具备一定的功能,从而借此呈现不同蛋白质间的进化关系。

在明细概念后,我们就可以进行分析了。这里使用meme这款软件在使用conda安装后进行本地化分析,当然它也有网页版的,但是灵活度上讲我个人还是推荐本地分析。在这里的脚本中,我们使用之前鉴定得到的SBT家族蛋白质序列。但是同样为了美观,我们要把蛋白质序列中的序列号“.1”删去。随后使用meme鉴定motif。输出的结果存放地址可以通过参数指定。此外,我在这里还通过seqtk comp生成了一个统计各个蛋白质长度的文件,这是为之后我们可视化蛋白质模体分布服务的。

在meme输出的文件夹中存放了不同类型的文件。其中以.png结尾的即为各个模体的seqlogo图。模体的网页版报告可以通过.html结尾文件查看。而我们需要的信息存放在以.txtx结尾的文件中。由于该文件十分复杂,而我们想要提取想要的信息,需要依靠特殊的脚本解决,这里提供一个思路(python 处理):

#!/usr/bin/env python

import re
import argparse

parser = argparse.ArgumentParser(description='meme file stat')
parser.add_argument('-i', '--input_file', type=str, required=True, metavar='<file name>',
                    help='Input txt file the meme outputs, i.e., meme.txt')
parser.add_argument('-o', '--output_file', type=str, required=True, metavar='<file name>', help='output stat file')
args = parser.parse_args()

content = []
motif_order = 1
pattern1 = "Motif ([A-Z]+) MEME-[0-9]+ sites sorted by position p-value"
pattern2 = "Aco[0-9]+\s+[0-9]+\s+[0-9]+\.[0-9]+e-[0-9]+\s+[A-Z]+\s+[A-Z]+\s+[A-Z]+"
Motif_info_dict = {}
Motif_sample_dict = {}
seq_motif_info_all = []

with open(args.input_file) as f:
    while True:
        content_list = f.readline()

        if not content_list:
            break
        else:
            content_list = content_list.replace("\t", "").replace("\n", "")
            if re.search("\+s", content_list):
                continue

        if re.search(pattern1, content_list):
            match = re.findall(pattern1, content_list)
            Motif_name = "Motif" + str(motif_order)
            motif_order = int(motif_order) + 1
            Motif_sample_dict["seq"] = match[0]
            Motif_sample_dict["length"] = len(match[0])
            Motif_info_dict[Motif_name] = Motif_sample_dict

        if re.search(pattern2, content_list):
            protein_motif_info_list = re.split("\s+", content_list)
            seq_name = protein_motif_info_list[0]
            seq_start = int(protein_motif_info_list[1])
            seq_end = int(Motif_sample_dict["length"]) + int(seq_start) - 1
            seq_motif = Motif_name
            seq_motif_seq = str(protein_motif_info_list[4])
            seq_motif_info = [seq_name, seq_motif, seq_start, seq_end, seq_motif_seq]
            seq_motif_info_all.append(seq_motif_info)

for i in seq_motif_info_all:
    output = i[0] + "\t" + i[1] + "\t" + str(i[2]) + "\t" + str(i[3]) + "\t" + i[4] + "\n"
    with open(args.output_file, "a") as f:
        f.write(output)

得到处理好的文件后,为了呈现文章中的效果,我们可以用ggplot2进行可视化,结合我之前的文件在这里提供一个思路:

library(data.table)
library(tidyverse)

# 载入文本
pep_meme <- fread("./DATA/test.txt", header = F)
new_pep <- pep_meme %>%
  arrange(V1) %>%
  group_by(V1) 

pep_length <- fread("./DATA/length.stat.pep.txt", header = F)
pep_length <- mutate(pep_length, V3=0)

# 画图
ggplot() +
  geom_segment(data = new_pep, 
               aes(x = as.numeric(V3), 
                   y = V1,
                   xend = as.numeric(V4),
                   yend = V1,
                   color = V2),
               linewidth = 2.5, 
               position = position_nudge(y = 0.2)) +
  scale_color_brewer(palette = "Set3") +
  geom_segment(data = pep_length, 
               aes(x = as.numeric(V3),
                   y = V1,
                   xend = as.numeric(V2),
                   yend = V1),
               color = "grey",
               linewidth = 1) +
  scale_x_continuous(expand = c(0,0)) +
  labs(y = "Family",
       x = "Length",
       color = "Motif") +
  theme_classic()

最终效果还是不错的。

| 基因家族分析系列(持续更新)

0.基因家族分析(0):概念明晰

1.基因家族分析(1):数据下载与处理

2.基因家族分析(2):基因家族鉴定与蛋白质性质简单分析

3.基因家族分析(3):序列比对与进化树构建

相关文章

  • 练习:基因家族

    基因家族鉴定分析操作手册: 基因家族 基因家族鉴定 基因家族鉴定分析总结 1.下载基因组信息文件,gff,cds,...

  • 基因家族分析(五)

    共线性分析(Synteny analysis)及可视化 基因家族流程:基因家族分析(一) 基因家族流程:基因家族分...

  • 目录

    1.基因家族分析专题 • 基因家族概念• 数据库检索与成员鉴定• 蛋白成员基本特性和基因结构分析• ...

  • 基因家族鉴定及分析

    单个基因家族分析方法基因家族鉴定及分析 | Wutianzhen (wu-tz.github.io)[https:...

  • 基因家族分析(四)

    基因家族流程:基因家族分析(一) 基因家族流程:基因家族分析(二) 基因家族流程:基因家族分析(三) ======...

  • 基因家族分析(三)

    基因家族流程:基因家族分析(一) 基因家族流程:基因家族分析(二) =======================...

  • 基因家族分析 | 番茄Nramp基因家族分析(二)

    系列目录:基因家族分析 | 番茄Nramp基因家族分析(一)基因家族分析 | 番茄Nramp基因家族分析(二) 通...

  • 基因家族分析(一)

    基本分析内容 • 基因家族概念• 数据库检索与成员鉴定• 蛋白成员基本特性和基因结构分析• 多序列...

  • 基因家族分析(七)

    第六部分暂时发现一点问题,改天补充~ 基因家族流程:基因家族分析(一) 基因家族流程:基因家族分析(二) 基因家族...

  • 基因家族分析(二)

    基因家族流程:基因家族分析(一) ========================================...

网友评论

      本文标题:基因家族分析(4):基因家族蛋白质模体鉴定与可视化

      本文链接:https://www.haomeiwen.com/subject/eqrcrdtx.html