select keys from org.Mm.eg.db
2
0
Entering edit mode
Assa Yeroslaviz ★ 1.5k
@assa-yeroslaviz-1597
Last seen 3 months ago
Germany

Hi,

 

I have a list of pathways with their gene symbols in a list structure.

> my_list

$PW1
 [1] "Abca1"  "Abca2"  "Abca3"  "Abca17" "Abca4"  "Abca7" "Abca12" "Abca13" "Abca5"  "Abca6"
[11] "Pik3cd"   ...

$PW2
 [1] "Atm"      "Chek2"    "Atr"      "Chek1"    "Cdkn2a"   "Mdm2"     "Mdm4"     "Trp53"    "Cdkn1a"   "Ccnd1"   
[11] "Ccnd2"    ...

I would like to convert the gene symbols into entrez IDs.

I know it is possible to do with the select command from the org.Mm.eg.db at least for one character vector.

> head(select(org.Mm.eg.db, keys = my_list[[1]], columns = "ENTREZID", keytype = "SYMBOL"))
  SYMBOL ENTREZID
1  Abca1    11303
2  Abca2    11305
3  Abca3    27410
4 Abca17   381072
5  Abca4    11304
6  Abca7    27403

But I would like to do it for the complete list and still be able to keep the list structure

thanks in advance

Assa

org.mm.eg.db select list • 3.4k views
ADD COMMENT
3
Entering edit mode
@james-w-macdonald-5106
Last seen 13 hours ago
United States

If you are going to be working with lists, then you should learn to use the *apply family of functions. You can do the same thing that Hans-Rudolph suggests in one line.

my_new_list <- lapply(seq(along = my_list), function(x) select(org.Mm.eg.db, my_list[[x]], "ENTREZID","SYMBOL"))

ADD COMMENT
1
Entering edit mode
@hotz-hans-rudolf-3951
Last seen 3.5 years ago
Switzerland

Hi Assa

As a suggestion, here is a quick and dirty way to do it:

 

my_list <- list(PW1=c("Abca1","Abca2","Abca3","Abca17","Abca4","Abca7"),PW2=c("Abca12","Abca13","Abca5","Abca6"),PW3=c("Atm","Chek2","Atr","Chek1","Cdkn2a","Mdm2","Mdm4","Trp53","Cdkn1a","Ccnd1"))

my_new_list <- list()

library(org.Mm.eg.db)

for (name in names(my_list)) {my_new_list[[length(my_new_list)+1]] <- select(org.Mm.eg.db, keys = my_list[[name]], columns = "ENTREZID", keytype = "SYMBOL")$ENTREZID }

 

 

> my_list
$PW1
[1] "Abca1"  "Abca2"  "Abca3"  "Abca17" "Abca4"  "Abca7"

$PW2
[1] "Abca12" "Abca13" "Abca5"  "Abca6"

$PW3
 [1] "Atm"    "Chek2"  "Atr"    "Chek1"  "Cdkn2a" "Mdm2"   "Mdm4"   "Trp53"
 [9] "Cdkn1a" "Ccnd1"

> my_new_list
[[1]]
[1] "11303"  "11305"  "27410"  "381072" "11304"  "27403"

[[2]]
[1] "74591"  "268379" "217265" "76184"

[[3]]
 [1] "11920"  "50883"  "245000" "12649"  "12578"  "17246"  "17248"  "22059"
 [9] "12575"  "12443"

>

 

 

Hope this helps, Hans-Rudolf

 

 

ADD COMMENT

Login before adding your answer.

Traffic: 710 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6