Entering edit mode
Tim Smith
★
1.1k
@tim-smith-1532
Last seen 10.2 years ago
Hi,
I wanted a table that provides a mapping from Entrez Ids to Gene
Symbols for homo sapiens. To do this, I used the following code:
----------------------------------------------------------------------
--------------------------------------------
library(org.Hs.eg.db)
x <- org.Hs.egSYMBOL
# Get the gene symbol that are mapped to an entrez gene identifiers
mapped_genes <- mappedkeys(x)
# Convert to a list
xx <- as.list(x[mapped_genes])
eids <- ''
ENTREZID2GENESYMBOL <- matrix(0,length(xx),2)
colnames(ENTREZID2GENESYMBOL) <- c('ENTREZ_IDS','GENE_SYMBOLS')
for(k in 1:length(xx)){
if(k==1){
eids <- unlist(xx[k])
goids <- names(xx[k])
}
if(k>1){
eids <- c(eids,unlist(xx[k]))
goids <- c(goids,names(xx[k]))
}
dd <- ''
for(m in 1:length(unlist(xx[k]))){
if(m==1)
dd <- unlist(xx[k])[m]
if(m>1)
dd <- paste(dd,unlist(xx[k])[m],sep=',')
}
ENTREZID2GENESYMBOL[k,2] <- dd
}
ENTREZID2GENESYMBOL[,1] <- rownames(ENTREZID2GENESYMBOL) <- goids
idx <-
unlist(sort(as.numeric(rownames(ENTREZID2GENESYMBOL)),index=TRUE)[2])
ENTREZID2GENESYMBOL <- ENTREZID2GENESYMBOL[idx,]
write.table(ENTREZID2GENESYMBOL,'test.txt',sep='\t')
----------------------------------------------------------------------
------------------------------------------------
However, when I search the table for the gene 'mTOR' I don't find
anything. I believe that mTOR is widely recognized as a cancer causing
gene, and I was wondering if I was doing something wrong in my code
(or libraries/functions used)...
many thanks!
Tim
PS: My sessionInfo() is :
R version 2.8.0 (2008-10-20)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] tools stats graphics grDevices utils datasets
methods base
other attached packages:
[1] org.Hs.eg.db_2.2.6 RSQLite_0.7-1 DBI_0.2-4
AnnotationDbi_1.4.2 Biobase_2.2.1
>
[[alternative HTML version deleted]]