How to convert gene IDs to gene symbols in R?
1
0
Entering edit mode
2.4 years ago
Amr ▴ 180

I am performing PCA in R and I got top 10 measurements (genes) that contribute for PC1:

loading_scores <- pca$rotation[,1]
gene_scores <- abs(loading_scores) ## get the magnitudes
gene_score_ranked <- sort(gene_scores, decreasing=TRUE)
top_10_genes <- names(gene_score_ranked[1:10])
top_10_genes

output:

 [1] "ENSG00000169018.5"  "ENSG00000181038.13" "ENSG00000103275.18" "ENSG00000174796.12"
 [5] "ENSG00000164087.7"  

How can I convert the ouputs from "gene IDs" into gene symbols? so that the outputs be like:

FEM1B

METTL23

UBE2I

etc..

Thanks in advance

gene R PCA IDs • 1.6k views
ADD COMMENT
0
Entering edit mode

for humans, use org.hs.eg.db

ADD REPLY
0
Entering edit mode

yes for humans, but how?

ADD REPLY
0
Entering edit mode
2.4 years ago

Hello, please check my answer, here: Translating gene names to entrez id's

Note that you will need to remove those numerical suffixes from the Ensembl gene IDs

ADD COMMENT
0
Entering edit mode

I run the first command:

library(org.Hs.eg.db)
mapIds(
  org.Hs.eg.db,
  keys = genes,
  column = 'ENTREZID',
  keytype = 'SYMBOL')
select(
  org.Hs.eg.db,
  keys = genes,
  column = c('SYMBOL', 'ENTREZID', 'ENSEMBL'),
  keytype = 'SYMBOL')

But I still cant convert the extracted genesIDs to the symbols? How related to that code? Where I should put top_10_genes?

Thanks for answering

ADD REPLY
0
Entering edit mode
require(org.Hs.eg.db)

mapIds(
  org.Hs.eg.db,
  keys = genes,
  column = 'SYMBOL',
  keytype = 'ENSEMBL')

select(
  org.Hs.eg.db,
  keys = genes,
  column = c('SYMBOL', 'ENTREZID', 'ENSEMBL'),
  keytype = 'ENSEMBL')
ADD REPLY
0
Entering edit mode

How related to that code? Where I should put top_10_genes?

ADD REPLY
0
Entering edit mode

I have provided enough information such that you should be able to adapt my code to your own code. Please review my answer via the other link, to help you understand.

ADD REPLY
0
Entering edit mode
keys = top_10_genes
ADD REPLY

Login before adding your answer.

Traffic: 1906 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