Question: Problem with extracting information from txdb object!
0
gravatar for Parham
3.3 years ago by
Parham1.4k
Sweden
Parham1.4k wrote:

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.
keytypes columns keys txdb • 1.3k views
ADD COMMENTlink modified 3.3 years ago by PoGibas4.7k • written 3.3 years ago by Parham1.4k
1
gravatar for PoGibas
3.3 years ago by
PoGibas4.7k
Vilnius
PoGibas4.7k wrote:

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 COMMENTlink modified 3.3 years ago • written 3.3 years ago by PoGibas4.7k

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 REPLYlink written 3.3 years ago by Parham1.4k
1

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 REPLYlink written 3.3 years ago by PoGibas4.7k
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 2.3.0
Traffic: 1290 users visited in the last hour