Location on server: /space/chen-syn01/1/data/cinliu/data/entrezID_to_gene_symb
Convert from entrez ID to gene symbol
We want to convert GIANT from entrazID to gene symbol . I did this while working with the netcoloc and localization notebook. WE wanted to use the GIANT network https://hb.flatironinstitute.org/
The brain top edge download file comes in entrez ID. We want it in gene symbol
rm(list = ls())
# convert from entrez ID to gene symbol
#following instructions from: https://www.biostars.org/p/69647/
#it is using a combination of the "annotate" package :https://www.bioconductor.org/packages/release/bioc/manuals/annotate/man/annotate.pdf
#and "org.Hs.eg.db" package : https://bioconductor.org/packages/release/data/annotation/manuals/org.Hs.eg.db/man/org.Hs.eg.db.pdf
#if (!requireNamespace("BiocManager", quietly = TRUE)) #using r version 4 and higher
# install.packages("BiocManager")
#BiocManager::install("annotate")
library(annotate)
#BiocManager::install("org.Hs.eg.db")
library(org.Hs.eg.db)
name <- "GIANT_025_cutoff"
#name <- "brain_top-1"
dw <- "~/Documents/Nini/Brin/"
setwd(dw)
interactome<- read.delim(paste0(dw, name), header=FALSE)
df <- interactome
node1 <- as.character(df$V1)
df$V1 <- getSYMBOL(node1, data='org.Hs.eg') #replace node 1
node2 <- as.character(df$V2)
df$V2 <- getSYMBOL(node2, data='org.Hs.eg')
write.table(df, paste0(dw,name,"_(gene_symbol_format)"), col.names=F, row.names = F,quote = F)
#double check
getSYMBOL(c('5498','8703','9507','4720'), data= 'org.Hs.eg')# should return "PPOX" "B4GALT3" "ADAMTS4" "NDUFS2"
summary(is.na(node1)) #check conversion didn't produce any NAs
summary(is.na(node2)) #check conversion didn't produce any NAs