BioCreative XML-RPC MetaService
To invoke the RPC service use an XML-RPC client (library) using this URL and
path: http://bcms.bioinfo.cnio.es/xmlrpc/ .
The following methods are available:
- Annotations.getAnnotation - ([string or int], [int]) -> struct{...}
Return the annotations created by one Annotation Server for the given
article. Input is either a positive integer - a valid PubMed ID - or a
text string for fulltext annotations.
Fulltext ([string] input) is currently NOT supported.
Response struct:
- Struct of result_type/array key-values.
- Each result array is either a list of structs containing the
raw results, or a two-element array consiting of a boolean and the
confidence for the interaction prediction result.
See getAnnotations() for result_type keys.
- Annotations.getAnnotationServerList - ([string or int]) -> array([int], ...)
Return the list of all server IDs which should create annotations for
the given PMID or fulltext sting (fulltext currently not supported).
- Annotations.getAnnotations - ([string or int]) -> struct{...}
Return the annotations created by the Annotation Servers for the given
article. Input is either a positive integer - a valid PubMed ID - or a
text string for fulltext annotations.
Fulltext ([string] input) is currently NOT supported.
response struct:
- Struct of server_id/result key-values.
- Each value has a struct of result_type/array key-values.
- Each result array is either a list of structs containing the
raw results, or a two-element array consiting of a boolean and the
confidence for the interaction prediction result.
The follwoing result_type keys can be found:
- mentions (struct)
- offset (int)
- section (str)
- mention (str)
- confidence (float, optional)
- normalizations (struct)
- dbname (str)
- dbid (str)
- taxid (int)
- confidence (float, optional)
- taxons (struct)
- taxid (int)
- confidence (float)
- interaction (array)
- 0 (boolean, has interaction)
- 1 (float, confidence)
- Resources.getServer - ([int]) => struct{...}
Return a server struct for a server ID describing the current status
of the server (ONLINE, OFFLINE, DISABLED) and its annotation
capabilities.
response struct:
- team_id (int)
- status (str)
- fulltext (boolean) - currently meaningless
- mentions (boolean)
- normalizations (boolean)
- taxons (boolean)
- interaction (boolean)
- Resources.getServerIDs - ([int]) => array([int], ...)
Return all known server IDs for a team ID.
- Resources.getTeam - ([int]) => struct{...}
Return a team struct for a team ID giving general information on the
team and their annotation system.
response struct:
- organization (str)
- system_description (str)
- contact_name (str)
- email_address (str)
- homepage (str)
- Resources.getTeamID - ([int]) => [int]
Return the team ID for a server ID.
- Resources.getTeams - () => array([int], ...)
Return an integer array of all team IDs.
- add - ([int], [int]) -> [int]
Return the sum of two integers. Default test function for ensuring the
connectivity to the XML-RPC server.
Please do not call the real functions for connectivity testing
purposes.
- system.listMethods - system.listMethods() => ['add', 'subtract', 'multiple']
Returns a list of the methods supported by the server.
- system.methodHelp - system.methodHelp('add') => "Adds two integers together"
Returns a string containing documentation for the specified method.
- system.methodSignature - system.methodSignature('add') => [double, int, int]
Returns a list describing the signature of the method. In the
above example, the add method takes two integers as arguments
and returns a double result.
This server does NOT support system.methodSignature.
More information about XML-RPC can be found
here.
Examples
Python
This is an example Python script to access the XML-RPC services of the
MetaServer.
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import xmlrpclib
url = "http://bcms.bioinfo.cnio.es/xmlrpc/"
method = sys.argv[1]
arguments = sys.argv[2:]
server = xmlrpclib.Server(url, encoding="UTF-8",
verbose=True)
cmd = "server." + method + "(" + ", ".join(arguments) + ")"
print >> sys.stderr, "command:", cmd
result = eval(cmd)
print result
You could use it, for example if you named it bcms-xmlrpc.py, like this:
python bcms-xmlrpc.py Annotations.getAnnotations 16212962
where the first argument is the name of the RPC method, the second is the
PMID of the abstract you want to fetch results for.
Perl
And this is an example of a Perl script with a test option for the XML-RPC
or listing the available methods:
#!/usr/bin/env perl
use strict;
require Data::Dumper;
require RPC::XML;
require RPC::XML::Client;
my $conn = RPC::XML::Client->new(
'http://bcms.bioinfo.cnio.es/xmlrpc/'
);
sub help
{
print "options: -t | -l | {pmid}\n";
print "-t => test\n";
print "-l => list XML-RPC methods\n";
print "pmid => integer\n";
exit 1;
}
my $req;
for ($ARGV[0]) {
$req = /^-t$/ && RPC::XML::request->new('add', 23, 32)
|| /^-l$/ && RPC::XML::request->new('system.listMethods')
|| /^\d+$/ && RPC::XML::request->new('Annotations.getAnnotations',
$ARGV[0])
|| help();
}
print "sending request: '".$req->as_string."'\n";
my $resp = $conn->simple_request($req);
unless (defined $resp) {
print "Client Error:\n ".$RPC::XML::fault."\n";
exit 1;
}
if ($req->name eq "add") {
if (55 == $resp) {
print "TEST OK\n";
} else {
print "TEST FAILED\n";
exit 1;
}
} else {
print Data::Dumper::Dumper($resp);
}
exit 0;
BioCreative Annotation Servers
If you are interested in creating an BCAS, please contact the BCMS
administrator () directly. If you would like to only see the XML-RPC specifications
we agreed on, please find them here.
|