美文网首页单细胞学习
小鼠和人的同源基因对应

小鼠和人的同源基因对应

作者: myshu | 来源:发表于2021-04-27 15:59 被阅读0次

在使用cellphoneDB和italk进行细胞通讯分析时,发现小鼠的结果很少或奇奇怪怪。查了下网上大家的一些解决办法,发现将小鼠的基因转成人的同源基因即可做。

这篇文章主要是使用biomart包的数据来进行转换的。通过下载两两物种的ID对应关系,然后写个代码替换就可以了。

1、首先打开下载页面

http://asia.ensembl.org/biomart/martview/b9f8cc0248e4714ba8e0484f0cbe4f02

2、选择对应基因组

3、选择属性

4、选择对应orthologs的物种(根据首字母)


5、最后下载


保存为mouse_human.txt,并修改文件header为human_id human_gene_name mouse_gene_name mouse_id

转换的代码:(输入的文件第一列是小鼠的gene symbol,大家根据自己的数据情况改代码~)

#!/usr/bin/python
# -*-coding:utf8 -*-
__author__ = 'myshu'
import sys
import os
import re
import argparse
sys.path.append(os.path.dirname(os.path.abspath(sys.argv[0])))

def rename_gene(ref, input_file, output_file):
    '''
        小鼠的基因name转成人的ortholog基因
    @param ref: 小鼠-人的ortholog基因对应表
    @param input_file: 输入文件,第一列为小鼠gene_name
    @param output_file: 输出替换后的文件
    @return:
    '''
    ref_file = os.path.abspath(ref)
    input_file = os.path.abspath(input_file)
    output_file = os.path.abspath(output_file)
    ref = {}
    for line in open(ref_file, "r"):
        # human_id human_gene_name mouse_gene_name mouse_id
        line = line.strip()
        line = line.split("\t")
        gene_syb = line[2]
        gene_id = line[1]
        ref[gene_syb] = gene_id

    fh = open(output_file, "w")
    num = 0
    for line0 in open(input_file, "r"):
        line = line0.strip()
        line = line.split("\t")
        # line.pop(0)
        if line0.startswith("\t") or line0.startswith("#"):
            fh.write(line0)
            fh.flush()
            continue
        result_id = line[0]
        if result_id in ref.keys():
            line.pop(0)
            fh.write(ref[result_id] + "\t" + "\t".join(line) + "\n")
            fh.flush()
            num += 1
    fh.close()
    if num == 0:
        print("all genes is pass!!!!!!!!!!!!!!!!!!!!!")
        # exit(1)


if (__name__ == "__main__"):
    parser = argparse.ArgumentParser(description=' rename mouse gene name to human orthologs gene name')
    parser.add_argument('--ref', '-r', required=False, help='biomart sub-database', default=f"mouse_human.txt")
    parser.add_argument('--input_file', '-i', required=True, help='sample.exp.txt')
    parser.add_argument('--output_file', '-p', required=True, help='"sample.exp.txt_new')
    args = parser.parse_args()
    rename_gene(**vars(args))

在R代码里面替换代码:

if (species == "Mus_musculus"){
    # 小鼠需要转ortholog基因
    ref_ortholog <- read.table("mouse_human.txt", header=T,sep="\t")
    # 筛选有的mouse基因名称
    b <- ref_ortholog[ref_ortholog$mouse_gene_name %in% colnames(iTalk_data),"mouse_gene_name"]
    data <- data[,b]
    # 替换为人的ortholog基因
    colnames(data) <- ref_ortholog[ref_ortholog$mouse_gene_name %in% colnames(data),"human_gene_name"]
}

如有任何建议欢迎评论~~

参考链接:

相关文章

  • 小鼠和人的同源基因对应

    在使用cellphoneDB和italk进行细胞通讯分析时,发现小鼠的结果很少或奇奇怪怪。查了下网上大家的一些解决...

  • biomaRt包实现不同物种之间同源基因转换

    可能常见的转换是小鼠和人之间的转换,因为小鼠的基因和人的基因的同源性,约80%的小鼠蛋白质在人类基因组中具有严格的...

  • 如何快速查找物种间对应的同源基因

    有时候,大家做实验以小鼠为模型,但希望查看与之对应的人同源基因。像这种情况,我们可以不需要进行序列比对来查找,因为...

  • 小鼠和人gene转换

    https://www.jianshu.com/p/05554a7aeaf8 快速实现人和小鼠之间的同源基因转换 ...

  • Gencode 数据库

    下载人/小鼠基因组和相对应的gtf/gff文件。。 官网 各类gff下载 点击:dakaiftp://ftp.eb...

  • 生物工程里的小鼠

    转基因小鼠 转基因小鼠一般用作基因的过表达研究,根据制备策略不同,分为随机转基因和定点转基因。随机转基因是将过表达...

  • 基因家族扩增与收缩分析

    基因家族扩张和收缩分析 基因家族的扩张和收缩分析一般会使用orthoMCL进行同源基因识别,然后选择直系同源基因进...

  • OrthoFinder寻找同源基因并建树(2)

    上一步我们已经获得了我们用来构树的同源基因集,这里就用这些基因构建系统发育树。我们所需的单拷贝基因和对应的每个Or...

  • 小鼠基因富集分析之任何通路

    今天忙里偷闲,自创了一套基于小鼠基因list的富集分析方法,主要原理是将之前用于人的基因富集分析方法搬运到小鼠上,...

  • 快速实现人和小鼠之间的同源基因转换

    我们知道小鼠是一个研究很多的模式生物,有很多生物学研究,以及一些临床研究都是在小鼠上做的。那么小鼠里面研究的这个基...

网友评论

    本文标题:小鼠和人的同源基因对应

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