Problem with extracting information from txdb object!
1
0
Entering edit mode
6.2 years ago
Parham ★ 1.6k

Hi,

I am trying to extract GENEID and corresponding CDSSTART from a txdb object using select function but it doesn't work. Could someone give a little help if you see where I am doing wrong? Here is the last few codes that lead to error. I appreciate your help in advance.

> keytypes(txdb)
[1] "GENEID"   "TXID"     "TXNAME"   "EXONID"   "EXONNAME" "CDSID"    "CDSNAME" 
> columns(txdb)
 [1] "CDSID"      "CDSNAME"    "CDSCHROM"   "CDSSTRAND"  "CDSSTART"   "CDSEND"     "EXONID"    
 [8] "EXONNAME"   "EXONCHROM"  "EXONSTRAND" "EXONSTART"  "EXONEND"    "GENEID"     "TXID"      
[15] "EXONRANK"   "TXNAME"     "TXCHROM"    "TXSTRAND"   "TXSTART"    "TXEND"     
> head(select(txdb, keys="GENEID", columns = "CDSSTART", keytype = "GENEID"))
Error in head(select(txdb, keys = "GENEID", columns = "CDSSTART", keytype = "GENEID")) : 
  error in evaluating the argument 'x' in selecting a method for function 'head': Error in .testForValidKeys(x, keys, keytype) : 
  None of the keys entered are valid keys for 'GENEID'. Please use the keys method to see a listing of valid arguments.
keys columns keytypes txdb • 2.3k views
ADD COMMENT
1
Entering edit mode
6.2 years ago
PoGibas 4.9k

As error message says None of the keys entered are valid keys

# Available keys
keys(txdb)

[1] "ENSG00000011198" "ENSG00000067646" "ENSG00000103343" "ENSG00000111837"
[5] "ENSG00000207157" "ENSG00000231116"

# Extract wanted keys
select(txdb, keys="ENSG00000011198", columns = "CDSSTART", keytype = "GENEID")

           GENEID CDSSTART
1 ENSG00000011198 43690993
2 ENSG00000011198 43699276
3 ENSG00000011198 43699502
ADD COMMENT
0
Entering edit mode

Nice thanks. I did:

keys <- keys(txdb)

select(txdb, keys=keys, columns = "CDSSTART", keytype = "GENEID")

and it works now. However I don't understand what are keys and what are keytypes. A little explanation on that is very appreciated. 

ADD REPLY
1
Entering edit mode

Happy it helped. All I can do is to copy/paste info from ?biomaRt::keys

 keys: the keys to select records for from the database.  Keys for
          some keytypes can be extracted by using the 'keys' method.

 keytype: the keytype that matches the keys used.  For the 'select'
          methods, this is used to indicate the kind of ID being used
          with the keys argument. For the 'keys' method this is used to
          indicate which kind of keys are desired from 'keys'
ADD REPLY

Login before adding your answer.

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