What should I do with the following error? None of the keys entered are valid keys for 'ENSEMBL'.
1
0
Entering edit mode
2.1 years ago
abradford • 0

library("AnnotationDbi")

library("org.Hs.eg.db")

anno_df$gene_name <- mapIds(org.Hs.eg.db,

  • keys=anno_df$gene_id,
  • column="SYMBOL",
  • keytype="ENSEMBL",
  • multiVals="first")

Error in .testForValidKeys(x, keys, keytype, fks) : None of the keys entered are valid keys for 'ENSEMBL'. Please use the keys method to see a listing of valid arguments.

DESeq2 airway • 8.3k views
ADD COMMENT
0
Entering edit mode
2.1 years ago

One can interpret the error literally, i.e., none of the values of anno_df$gene_id relate to Ensembl gene IDs. Can you show the output of str(anno_df$gene_id), please?

It looks like you are using the airway dataset. One can convert the Ensembl gene IDs in this dataset to gene symbols via:

  library(airway)    
  data('airway')

  # Annotate the Ensembl gene IDs to gene symbols:
    ens <- rownames(airway)

    library(org.Hs.eg.db)
    symbols <- mapIds(org.Hs.eg.db, keys = ens,
      column = c('SYMBOL'), keytype = 'ENSEMBL')
    symbols <- symbols[!is.na(symbols)]
    symbols <- symbols[match(rownames(airway), names(symbols))]
    rownames(airway) <- symbols
    keep <- !is.na(rownames(airway))
    airway <- airway[keep,]

...as I do here in my vignette for EnhancedVolcano: https://github.com/kevinblighe/EnhancedVolcano (see Quick Start)

Please also see my answer here: Translating gene names to entrez id's

Kind regards,

Kevin

ADD COMMENT
0
Entering edit mode

This is awesome! Thank you. I am trying the conversion code you gave me but here is the output from str(anno_df$gene_id):

chr [1:34528] "5S_rRNA" "7SK" "A1BG" "A1BG-AS1" "A1CF" "A2M" "A2M-AS1" "A2ML1" "A2ML1-AS2" "A2MP1" "A3GALT2" ..

ADD REPLY
0
Entering edit mode

Hi, therein exists the problem, i.e., your keytype should be SYMBOL, not ENSEMBL

ADD REPLY

Login before adding your answer.

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