This is a test version of Biostars. For the public version, visit https://www.biostars.org.
None of the keys entered are valid keys for 'ENSEMBL'. Please use the keys method to see a listing of valid arguments.

I have Ensamble transcipt ids, I am trying to match them to the gene names using following code;

sigs.df$symbol <- mapIds(org.Hs.eg.db, keys = rownames(sigs.df), keytype = "ENSEMBL", column = "SYMBOL")

but is is giving me following error;

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.

rownames(sigs.df)
"ENST00000234590"   "ENST00000295688"   "ENST00000319248"   "ENST00000436427"  
 [5] "ENST00000458748"   "ENST00000384384"   "ENST00000524851"   "ENST00000530019"  
 [9] "ENST00000532872"   "ENST00000610851"   "ENST00000618227"   "ENST00000229239"

transcripts were in decimal but I removed the decimal point

genemap

transcripts were in decimal but I removed the decimal point

They are not decimals. The .# number is the transcript version.

1 answer

You can use bioMart to solve this problem:

Let your data be as follows:

data = c("ENST00000234590","ENST00000295688","ENST00000319248","ENST00000436427", "ENST00000458748", "ENST00000384384", "ENST00000524851", "ENST00000530019", "ENST00000532872", "ENST00000610851", "ENST00000618227", "ENST00000229239")

then,

library(biomaRt)
mart <- useMart("ensembl","hsapiens_gene_ensembl")

genes <- getBM(attributes=c("ensembl_transcript_id","external_gene_name","ensembl_gene_id"),
                           filters = "ensembl_transcript_id",
                           values = data, 
                           mart = mart)

rownames(genes) <- genes$ensembl_transcript_id
names(genes) = c("transcript_id", "gene_name", "gene_id")
head(genes)

output

transcript_id   gene_name   gene_id
ENST00000229239 GAPDH           ENSG00000111640
ENST00000234590 ENO1            ENSG00000074800
ENST00000295688 CCT3            ENSG00000163468
ENST00000319248 PRDX1           ENSG00000117450
ENST00000384384 SNORA25         ENSG00000207112
ENST00000436427 YBX1            ENSG00000065978

When I run the code for genes above it returns empty

When I ran I get following results. May be error with input file. Can you upload your input file here? Atleast 20 rows. Output

Here are the first 20 rows

head(upd_res, n=20)
                   log2FoldChange      padj
ENST00000003583.12     0.40164381        NA
ENST00000003912.7     -0.05140115        NA
ENST00000008440.9      0.47192235        NA
ENST00000009105.5     -0.13715870        NA
ENST00000010299.10     0.14186329        NA
ENST00000011700.10     0.07036600 0.9998878
ENST00000037502.11    -0.19101250        NA
ENST00000040877.2      1.22996218 0.9998878
ENST00000054650.8     -0.52119236        NA
ENST00000054666.11     2.21708675        NA
ENST00000054668.5      0.32343051        NA
ENST00000060969.5      0.01212148        NA
ENST00000072644.7      0.36382516        NA
ENST00000078527.8     -0.13269647        NA
ENST00000164247.5     -0.62515123        NA
ENST00000166244.8     -0.61265305 0.9998878
ENST00000167825.5     -0.36785321        NA
ENST00000194214.9      3.54957676 0.2389666
ENST00000196061.5      2.29339270 0.7207738
ENST00000207157.7     -0.03162652        NA

in place of data in your code I used rownames(upd_res)

In that case let us consider your dataframe:

data = c("ENST00000003583.12", "ENST00000003912.7", "ENST00000008440.9", "ENST00000009105.5", "ENST00000010299.10", "ENST00000011700.10", "ENST00000037502.11", "ENST00000040877.2", "ENST00000054650.8", "ENST00000054666.11", "ENST00000054668.5", "ENST00000060969.5", "ENST00000072644.7", "ENST00000078527.8", "ENST00000164247.5", "ENST00000166244.8", "ENST00000167825.5", "ENST00000194214.9", "ENST00000196061.5", "ENST00000207157.7")

Remove the numbers after .

enst <- gsub("\\.[0-9]*$", "", data)

then follow the command

library(biomaRt)
mart <- useMart("ensembl","hsapiens_gene_ensembl")

genes <- getBM(attributes=c("ensembl_transcript_id","external_gene_name","ensembl_gene_id", "gene_biotype"),
                           filters = "ensembl_transcript_id",
                           values = enst, 
                           mart = mart)

rownames(genes) <- genes$ensembl_transcript_id
names(genes) = c("transcript_id", "gene_name", "gene_id", "gene_biotype")
head(genes)

Upvote and accept the answer, if that helped you

Thank you very much it worked for me

Log in to answer this question.