This is a test version of Biostars. For the public version, visit https://www.biostars.org.
targetScan R errors

Hello,

I am using targetScan package for R. The function mget for targetscan.Hs.egTARGETSFULL gives an error when it stumbles upon an entrez gene id (a key) in which there is no value giving the error e.g. Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : value for "101930100" not found. I want the function to skip the ones in which there is no corresponding value and find the values for other entrez gene ids. Do you guys know a way around this? Thanks in advance for your time.

mirna error-handling targetscan r

Please post example data and session info.

Thank you for your reply

R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

head(CHRNA5_up_entrez)
  entrezgene
1     138241
2     283349
3  101930100
4       3841
5      92703
6     653659

CHRNA5_targetScan <- mget(as.character(CHRNA5_up_entrez[2:3,]), targetscan.Hs.egTARGETSFULL)
Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : 
  value for "101930100" not found

CHRNA5_targetScan <- mget(as.character(CHRNA5_up_entrez[2,]), targetscan.Hs.egTARGETSFULL)

CHRNA5_targetScan
$`283349`
miRFamily: miR-25/32/92abc/363/363-3p/367
UTRstart: 1664
UTRend: 1671
MSAstart: 2406
MSAend: 2416
Seedmatch: 8mer
PCT: 0.97

miRFamily: miR-25/32/92abc/363/363-3p/367
UTRstart: 1458
UTRend: 1465
MSAstart: 2200
MSAend: 2210
Seedmatch: 8mer
PCT: 0.97

miRFamily: miR-27abc/27a-3p
UTRstart: 231
UTRend: 237
MSAstart: 388
MSAend: 394
Seedmatch: 7mer-1a
PCT: 0.52

... continues

1 answer

Try using ifnotfound argument for mget function.

Following example code I used:

See if this works:

1) I saved the entrez id list above, as a text file "test"

  entrezgene
1     138241
2     283349
3  101930100
4       3841
5      92703
6     653659

2) Loaded the file in R

test=read.delim2("test", header = T, stringsAsFactors = F, sep = "")

3) loaded the library

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

4) executed following code without errors:

mget(as.character(test[,1]), targetscan.Hs.egTARGETS, ifnotfound = as.list(NA))

output is huge and didn't want to paste here.

5) executed following code to reproduce error:

mget(as.character(test[,1]), targetscan.Hs.egTARGETS)

Error produced:

Error in .checkKeys(value, Lkeys(x), x@ifnotfound) :value for "138241" not found

session info:

R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu Wily Werewolf (development branch)

locale:
 [1] LC_CTYPE=en_IN.UTF-8       LC_NUMERIC=C               LC_TIME=en_IN.UTF-8
 [4] LC_COLLATE=en_IN.UTF-8     LC_MONETARY=en_IN.UTF-8    LC_MESSAGES=en_IN.UTF-8
 [7] LC_PAPER=en_IN.UTF-8       LC_NAME=C                  LC_ADDRESS=C
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_IN.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods
[9] base

other attached packages:
[1] targetscan.Hs.eg.db_0.6.1 RSQLite_1.0.0             DBI_0.3.1
[4] AnnotationDbi_1.30.1      GenomeInfoDb_1.4.3        IRanges_2.2.9
[7] S4Vectors_0.6.6           Biobase_2.28.0            BiocGenerics_0.14.0

loaded via a namespace (and not attached):
[1] tools_3.2.2

Log in to answer this question.