-
Notifications
You must be signed in to change notification settings - Fork 0
/
bioDBnet.Rmd
737 lines (501 loc) · 19.6 KB
/
bioDBnet.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
---
title: "bioDBnet"
author: "Celine Hernandez"
date: "5 Jun 2016"
output:
html_document:
toc: yes
---
# Introduction
The bioDBnet database is a set of services similar to the Biomart service and aiming at converting identifiers or retrieving information about them.
Description from the website:
> biological DataBase network is an application integrating a vast number of biological databases including Gene, UniProt, Ensembl, GO, Affy, RefSeq etc. The databases are created by downloading data from various public resources. They are formatted and maintained in a relational structure at the Advanced Biomedical Computing Center (ABCC).
# bioDBnet API
## Services available
bioDBnet provides access seven services as well as supporting tools.
List of sevices provided by bioDBnet
* db2db handles all the conversions from one database identifier to another.
* dbWalk lets you walk through your own bioDBnet path.
* dbReport reports every possible information that it can get for a particular identifier.
* dbFind finds the type of identifiers and converts all into a chosen database identifier type
* dbOrtho converts identifiers from one organism into homolog identifiers of a different organism
* dbAnnot provides different types of annotations for various biological identifiers
* dbOrg provides downloadable files of organism wide conversions
List of the supporting analysis tools
* getInputs to get all available ressources
* getOutputsForInput to get all possible conversions (direct or indirect)
* getDirectOutputsForInput to get all direct conversions
* getPathways to access pathways of a given species
The base URL for all services is as follows:
```{r base_url}
base_url <- "https://biodbnet-abcc.ncifcrf.gov/webServices/rest.php/"
```
Depending on the desired output format we will either contact "biodbnetRestApi.json" (JSON) or "biodbnetRestApi" (XML).
```{r}
# Base URL returning data in JSON
json_url <- paste0(base_url, "biodbnetRestApi.json?")
# Base URL returning data in XML
xml_url <- paste0(base_url, "biodbnetRestApi?")
```
## Access using R
bioDBnet provides RESTful access to its services but no wrapper is available in an R library. It's then necessary to use a generic access through the RCurl library, jointly with the RJSONIO or XML libraries to read the returned information.
RCurl: https://cran.r-project.org/web/packages/RCurl/index.html
RJSONIO: https://cran.r-project.org/web/packages/RJSONIO/index.html
XML: https://cran.r-project.org/web/packages/XML/index.html
```{r install_libraries, eval=FALSE}
# Not run
# Generic library used to
install.packages("RCurl")
# If we want to access the information in JSON format
install.packages("RJSONIO")
# If we want to access the information in XML format
install.packages("XML")
```
Once installed, we can load the libraries and use them in the examples.
```{r load_libraries}
library('RCurl')
library('RJSONIO')
library('XML')
```
To use RCurl more easily, we can define a generic function requesting a provided URL given a list() of parameters and returning the service's response.
```{r rcurl_request}
rcurl_request <- function(service_url, parameters) {
# Collapse all parameters into one string
all_parameters <- paste(
sapply(names(parameters),
FUN=function(param_name, parameters) {
paste(param_name, paste(parameters[[param_name]], collapse=','), collapse='', sep='=')
},
parameters),
collapse="&")
# Paste base URL and parameters
requested_url <- paste0(service_url, all_parameters)
# Encode URL (in case there would be any space character for instance)
requested_url <- URLencode(requested_url)
# Start request to service
response <- getURL(requested_url, .opts = list(ssl.verifypeer = FALSE))
return(response)
}
```
# Examples
## Main bioDBnet tools
### db2db (conversion to one)
The "db2db" tool aims at converting a set of identifiers from a specific type to another type available in bioDBnet.
Parameters for the method "db2db":
Parameter | Value
--- | ---
inputValues | A set of identifiers.
input | Format of the inputValues.
outputs | Desired converted output formats.
taxonId | Taxon identifier of the coresponding species.
format | Either "row" or "col" depending on the desired resulting table orientation. Not specifying the format results in a more complex JSON output containing also the input parameters.
```{r db2db_data}
parameters <- list(method="db2db",
inputValues=c("Lat", "Lck"),
input="genesymbol",
outputs=c("uniprotaccession", "affyid"),
taxonId="10090",
format="col")
```
Request result as JSON.
```{r db2db_json}
db2db_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(db2db_result)
json_result <- sapply(json_result,
FUN=function(x) {
x[sapply(x, is.null)] <- NA
unlist(x)
})
# Display result
print(json_result)
```
Request result as XML.
```{r db2db_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
db2db_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = db2db_result, asText = TRUE)
# Display result
print(xml_result)
```
### dbReport (conversion to all)
The "dbreport" tool aims at converting a set of identifiers from a specific type to all available ressources in bioDBnet.
Parameters for the method "dbreport":
Parameter | Value
--- | ---
inputValues | A set of identifiers.
input | Format of the inputValues.
taxonId | Taxon identifier of the coresponding species.
format | Either "row" or "col" depending on the desired resulting table orientation. Not specifying the format results in a more complex JSON output containing also the input parameters.
```{r dbreport_data}
parameters <- list(method="dbreport",
inputValues=c("Zap70"),
input="genesymbol",
taxonId="10090",
format="col")
```
Request result as JSON.
```{r dbreport_json, eval=FALSE}
# Note that this code is not evaluated because the request is very slow.
dbreport_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(dbreport_result)
json_result <- sapply(json_result,
FUN=function(x) {
x[sapply(x, is.null)] <- NA
unlist(x)
})
# Display result
print(json_result)
```
Request result as XML.
```{r dbreport_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
dbreport_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = dbreportd_result, asText = TRUE)
# Display result
print(xml_result)
```
### dbWalk (multiple successive conversions)
The "dbwalk" tool aims at linking successive conversions together. See the bioDBnet graph for more information: https://biodbnet-abcc.ncifcrf.gov/dbInfo/netGraph.php
Parameters for the method "dbwalk":
Parameter | Value
--- | ---
inputValues | A set of identifiers.
input | Format of the inputValues. (optional?)
dbPath | Path from one identifer type to another.
taxonId | Taxon identifier of the coresponding species.
format | Either "row" or "col" depending on the desired resulting table orientation. Not specifying the format results in a more complex JSON output containing also the input parameters.
```{r dbwalk_data}
parameters <- list(method="dbwalk",
inputValues=c("Lat", "Lck"),
input="genesymbol",
dbPath="genesymbol->geneid->affyid",
taxonId="10090",
format="col")
```
Request result as JSON.
```{r dbwalk_json}
dbwalk_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(dbwalk_result)
json_result <- sapply(json_result,
FUN=function(x) {
x[sapply(x, is.null)] <- NA
unlist(x)
})
# Display result
print(json_result)
```
Request result as XML.
```{r dbwalk_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
dbwalk_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = dbwalk_result, asText = TRUE)
# Display result
print(xml_result)
```
### dbFind (identifiers from unknown or multiple types)
The "dbfind" tool aims at converting identifiers from multiple and often unknown sources into a unique database type.
Parameters for the method "dbfind":
Parameter | Value
--- | ---
inputValues | A set of identifiers.
output | Desired conversion. One of "ensemblgeneid" (Ensembl Gene ID), "geneid" (Gene ID), "uniprotaccession" (UniProt Accession ID), "genesymbol" (Gene Symbol).
taxonId | Taxon identifier of the coresponding species.
format | Either "row" or "col" depending on the desired resulting table orientation. Not specifying the format results in a more complex JSON output containing also the input parameters.
```{r dbfind_data}
parameters <- list(method="dbfind",
inputValues=c("LAT", "Lck", "Zap70"),
output="ensemblgeneid",
taxonId="10090",
format="col")
```
Request result as JSON.
```{r dbfind_json}
dbfind_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(dbfind_result)
json_result <- sapply(json_result,
FUN=function(x) {
x[sapply(x, is.null)] <- NA
unlist(x)
})
# Display result
print(json_result)
```
Request result as XML.
```{r dbfind_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
dbfind_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = dbfind_result, asText = TRUE)
# Display result
print(xml_result)
```
### dbortho (conversion to a different organism)
The "dbortho" tool aims at converting a set of identifiers from a specific organism to another organism.
Parameters for the method "dbortho":
Parameter | Value
--- | ---
inputValues | A set of identifiers.
input | Format of the inputValues.
inputTaxon | Taxon of the inputValues.
output | Desired output formats.
outputTaxon | Taxon identifier of output values.
format | Either "row" or "col" depending on the desired resulting table orientation. Not specifying the format results in a more complex JSON output containing also the input parameters.
```{r dbortho_data}
parameters <- list(method="dbortho",
inputValues=c("Lat", "Lck"),
input="genesymbol",
inputTaxon="10090",
output="uniprotaccession",
outputTaxon="9606",
format="col")
```
Request result as JSON.
```{r dbortho_json}
dbortho_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(dbortho_result)
json_result <- sapply(json_result,
FUN=function(x) {
x[sapply(x, is.null)] <- NA
unlist(x)
})
# Display result
print(json_result)
```
Request result as XML.
```{r dbortho_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
dbortho_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = dbortho_result, asText = TRUE)
# Display result
print(xml_result)
```
### dbannot (gather annotations)
The "dbannot" tool aims at gathering information linked to given identifiers.
Parameters for the method "dbannot":
Parameter | Value
--- | ---
inputValues | A set of identifiers.
input | Format of the inputValues.
annotations | Desired type of information. One of "Genes", "Drugs", "Diseases", "GO Terms", "Pathways" and "Protein Interactors".
taxonId | Taxon identifier of the coresponding species.
format | Either "row" or "col" depending on the desired resulting table orientation. Not specifying the format results in a more complex JSON output containing also the input parameters.
```{r dbannot_data}
parameters <- list(method="dbannot",
inputValues=c("Lat", "Lck"),
input="genesymbol",
annotations=c("Protein Interactors"),
taxonId="10090",
format="col")
```
Request result as JSON.
```{r dbannot_json, eval=FALSE}
dbannot_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(dbannot_result)
json_result <- sapply(json_result,
FUN=function(x) {
x[sapply(x, is.null)] <- NA
unlist(x)
})
# Display result
print(paste0("Categories : ", paste0(sapply(fromJSON(dbannot_result), names), sep=",", collapse=" ")))
print(json_result)
```
Request result as XML.
```{r dbannot_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
dbannot_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = dbannot_result, asText = TRUE)
# Display result
print(xml_result)
```
### dborg (organism-wide downloads)
The "dborg" tool aims at downloading organism-specific files converting one identifier type to another. This tool is not available as a RESTful service.
## Other tools
### getInputs
Access all the input nodes in the bioDBnet graph.
This tool doesn't accept any parameter apart from the method name.
```{r getinputs_data}
parameters <- list(method="getinputs")
```
Request result as JSON.
```{r getinputs_json, eval=FALSE}
getinputs_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(getinputs_result)
# Display result
print(json_result)
```
Request result as XML.
```{r getinputs_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
getinputs_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = getinputs_result, asText = TRUE)
# Display result
print(xml_result)
```
### getOutputsForInput (all possible conversion)
From a given identifier type, "getOutputsForInput" gives all the possible conversions, being direct or indirect.
Parameters for the method "getoutputsforinput":
Parameter | Value
--- | ---
input | Format of the identifier type.
```{r getoutputsforinput_data}
parameters <- list(method="getoutputsforinput",
input="genesymbol")
```
Request result as JSON.
```{r getoutputsforinput_json, eval=FALSE}
getoutputsforinput_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(getoutputsforinput_result)
# Display result
print(json_result)
```
Request result as XML.
```{r getoutputsforinput_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
getoutputsforinput_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = getoutputsforinput_result, asText = TRUE)
# Display result
print(xml_result)
```
### getDirectOutputsForInput (direct conversions)
From a given identifier type, "getDirectOutputsForInput" gives all the possible direct conversions.
Parameters for the method "getoutputsforinput":
Parameter | Value
--- | ---
input | Format of the identifier type.
directOutput | 1
```{r getdirectoutputsforinput_data}
parameters <- list(method="getdirectoutputsforinput",
input="genesymbol",
directOutput="1")
```
Request result as JSON.
```{r getdirectoutputsforinput_json}
getdirectoutputsforinput_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(getdirectoutputsforinput_result)
# Display result
print(json_result)
```
Request result as XML.
```{r getdirectoutputsforinput_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
getdirectoutputsforinput_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = getdirectoutputsforinput_result, asText = TRUE)
# Display result
print(xml_result)
```
### getPathways (access pathways)
Use "getpathways" to access all the possible pathways references of a given species in one or more databases.
Parameters for the method "getpathways":
Parameter | Value
--- | ---
taxonId | Taxon identifier of the coresponding species.
pathways | Either "1" to get all pathways or one of "ncipid", "kegg", "biocarta" or "reactome".
```{r getpathways_data}
parameters <- list(method="getpathways",
taxonId="9606",
pathways="reactome")
```
Request result as JSON.
```{r getpathways_json}
getpathways_result <- rcurl_request(json_url, parameters)
# Parse result
json_result <- fromJSON(getpathways_result)
# Display result
print(head(json_result, n=1))
```
Request result as XML.
```{r getpathways_xml, eval=FALSE}
# Note that this code is not evaluated because there seems to be a problem with XML requests.
getpathways_result <- rcurl_request(xml_url, parameters)
# Parse result
xml_result <- xmlParse(file = getpathways_result, asText = TRUE)
# Display result
print(head(xml_result, n=1))
```
## Full list of allowed inputValues formats
If not specified otherwise, these are the possible types available for input and output values.
Category | Value to use
--- | ---
Affy GeneChip Array | ?
Affy ID | "affyid"
Agilent ID | "agilentid"
Biocarta Pathway Name | "biocartapathwayname"
CodeLink ID | "codelinkid"
dbSNP ID | "dbsnpid"
DrugBank Drug ID | "drugbankdrugid"
DrugBank Drug Name | "drugbankdrugname"
EC Number | "ecnumber"
Ensembl Gene ID | "ensemblgeneid"
Ensembl Protein ID | "ensemblproteinid"
Ensembl Transcript ID | "ensembltranscriptid"
EST Accession | "estaccession"
FlyBase Gene ID | "flybasegeneid"
GenBank Nucleotide Accession | "genbanknucleotideaccession"
GenBank Protein Accession | "genbankproteinaccession"
Gene ID | "geneid"
Gene Symbol | "genesymbol"
Gene Symbol and Synonyms | "genesymbolandsynonyms"
GI Number | "ginumber"
GO ID | "goid"
GSEA Standard Name | "gseastandardname"
H-Inv Locus ID | "h-invlocusid"
H-Inv Protein ID | "h-invproteinid"
H-Inv Transcript ID | "h-invtranscriptid"
HGNC ID | "hgncid"
HMDB Metabolite | "hmdbmetabolite"
HomoloGene ID | "homologeneid"
Illumina ID | "illuminaid"
InterPro ID | "interproid"
IPI ID | "ipiid"
KEGG Compound Name | "keggcompoundname"
KEGG Disease ID | "keggdiseaseid"
KEGG Drug ID | "keggdrugid"
KEGG Drug Name | "keggdrugname"
KEGG Gene ID | "kegggeneid"
KEGG Pathway ID | "keggpathwayid"
MGI ID | "mgiid"
MIM ID | "mimid"
miRBase ID | "mirbaseid"
miRBase Mature miRNA Acc | "mirbasematuremirnaacc"
NCIPID Pathway Name | "ncipidpathwayname"
Organism Scientific Name | "organismscientificname"
PDB ID | "pdbid"
Pfam ID | "pfamid"
PharmGKB Disease ID | "pharmgkbdiseaseid"
PharmGKB Drug Info | "pharmgkbdruginfo"
PharmGKB ID | ?
PharmGKB Gene ID | "pharmgkbgeneid"
Reactome Pathway Name | "reactomepathwayname"
RefSeq Genomic Accession | "refseqgenomicaccession"
RefSeq mRNA Accession | "refseqmrnaaccession"
RefSeq Protein Accession | "refseqproteinaccession"
SGD ID | "sgdid"
TAIR ID | "tairid"
Taxon ID | "taxonid"
UniGene ID | "unigeneid"
UniProt Accession | "uniprotaccession"
UniProt Entry Name | "uniprotentryname"
UniProt Protein Name | "uniprotproteinname"
UniSTS ID | "unistsid"
# Session info
```{r}
sessionInfo()
```