Question: select keys from org.Mm.eg.db
0
gravatar for Assa Yeroslaviz
3.7 years ago by
Assa Yeroslaviz1.4k
Munich, Germany
Assa Yeroslaviz1.4k wrote:

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 list select • 1.4k views
ADD COMMENTlink modified 3.7 years ago by James W. MacDonald50k • written 3.7 years ago by Assa Yeroslaviz1.4k
Answer: select keys from org.Mm.eg.db
3
gravatar for James W. MacDonald
3.7 years ago by
United States
James W. MacDonald50k wrote:

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 COMMENTlink written 3.7 years ago by James W. MacDonald50k
Answer: select keys from org.Mm.eg.db
1
gravatar for Hotz, Hans-Rudolf
3.7 years ago by
Switzerland
Hotz, Hans-Rudolf400 wrote:

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 COMMENTlink written 3.7 years ago by Hotz, Hans-Rudolf400
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 157 users visited in the last hour