-
Notifications
You must be signed in to change notification settings - Fork 2
/
Ensembl_ID to gene_symbol
46 lines (23 loc) · 1.21 KB
/
Ensembl_ID to gene_symbol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
######################################################################
################### Ensembl_ID转gene_symbol #####################
######################################################################
library(BiocManager)
library(tidyverse)
library(dplyr)
library(DESeq2)
library(DESeq2)
test1=read.table("./ENS-genetype-genename.txt",sep="\t",header=T)
test2=read.table("./joined_counts.txt",sep="\t",header=T)
merge <- inner_join(test1, test2,by = "ID") %>% dplyr::select(-1)
write.table(merge,file="symbol.txt",sep="\t",quote=F,row.names=F)
datagene<- merge[merge$Gene.type=="protein_coding",]
datalncrna<- merge[merge$Gene.type=="lncRNA",]
datamirna<- merge[merge$Gene.type=="miRNA",]
datagene<- datagene[,-1]
# 以变量x去重,返回所有变量
avereps(datagene[,-1],ID=data1$id) #重复序列取均值,前半部分为只保留矩阵,后半部分设id(基因名)列为被查找的重复列
datagene<-datagene[!duplicated(data1$id),] #合并删除重复序列
##用函数将Ensembl_ID转gene_symbol##
library(clusterprofiler)
library(org.Hs.eg.db)
df<-bitr(rownames(DEG),fromType="SYMBOL",toType=c("ENTREZID"),orgDb=org.Hs.eg.db