FunSimMat provides an XML-RPC interface for performing automatic queries and processing of the results. Here, several examples for the use of the XML-RPC interface in different programming languages (Java, Python, PHP) are listed below. A detailed description of the functions supported by the XML-RPC server is given here.
This example uses the Apache XML-RPC library.
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://funsimmat.bioinf.mpi-inf.mpg.de/xmlrpc.php"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] input = new Object[]{"PF00001", "PF00001,PF00002,PF00003"};
Object[] result = (Object[]) client.execute("Functional.getScoresGp2List", input);
Object[] headerRow = (Object[]) result[0];
for (int j = result.length - 1; j > 0; --j) {
Object[] row = (Object[]) result[j];
String acc1 = (String) row[0];
String acc2 = (String) row[1];
Double score1 = Double.valueOf((String) row[34]);
}
No additional libraries required.
import xmlrpclib
server = xmlrpclib.ServerProxy('http://funsimmat.bioinf.mpi-inf.mpg.de/xmlrpc.php')
query = "PF00001"
list = "PF00001,PF00002,PF00003"
result = server.Functional.getScoresGp2List(query, list)
header = result[0]
for i in range(1, len(result)):
acc1 = result[i][0]
acc2 = result[i][1]
score1 = float(result[i][2])
No additional libraries required.
$args = array("PF00001", "PF00001,PF00002,PF00003");
$request = xmlrpc_encode_request('Functional.getScoresGp2List', $args);
$context = stream_context_create(array('http' => array(
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)));
$queryResult = file_get_contents("http://funsimmat.bioinf.mpi-inf.mpg.de/xmlrpc.php", false, $context);
$result = xmlrpc_decode($queryResult);
$header = $result[0];
$count = count($result);
for ($i = 1; $i < $count; $i++) {
$acc1 = $result[$i][0];
$acc2 = $result[$i][1];
$score1 = floatval($result[$i][2]);
}