Difference between revisions of "BIRD Data Access Protocol"
(→PhP Connection) |
(→Java) |
||
Line 91: | Line 91: | ||
=====Java===== | =====Java===== | ||
− | /** http://hc.apache.org/downloads.cgi**/ | + | /** download httpclient from http://hc.apache.org/downloads.cgi**/ |
import org.apache.commons.httpclient.HttpClient; | import org.apache.commons.httpclient.HttpClient; | ||
import org.apache.commons.httpclient.methods.PostMethod; | import org.apache.commons.httpclient.methods.PostMethod; |
Revision as of 08:28, 29 October 2008
Contents
BIRD Data Access Protocol
Data Browsing at Décrypthon Data Center
Database content can be browsed from Bird Website [1] (beta version)
Data Selection by BIRDQL Service
Data can also be selected with BIRDQL queries; Expert users can however modify queries by hand. Three query service are available:
-
curl -F upload=@your_bird.ql 'http://bird.u-strasbg.fr:8080/bird/bsearch?service=birdql'
-
http://bird.u-strasbg.fr:8080/bird/bsearch?service=birdql&query=your_birdql
- Example:
http://bird.u-strasbg.fr:8080/bird/bsearch?service=birdql&query=ID * DB Uniprot--WH DE contains "histone"--LM 10--FD AC,DE--FM FLAT
http://bird.u-strasbg.fr:8080/bird/bsearch?service=birdql&query=ID * DB Uniprot--WH DE contains "Helianthinin"--LM 10--FM FASTA
http://bird.u-strasbg.fr:8080/bird/bsearch?service=birdql&query=ID * DB Uniprot--WH DE contains "Helianthinin"--LM 10--FM JSON
- Example:
- BIRD-QL Editor (in pres).
- User can use this engine for intensive computation, download [birdql cmd].
- Till then you can test your queries on the star3-8 in the program /groupes/poch/dkieffer/test_tools/BirdQlConsol/BirdQlConsol.sh ( or download here).
Simple Services-Bank ID
Service : http://bird.u-strasbg.fr:8080/bird/bsearch?db=<database>&accession=<ac or id>&field=<DE,OS..> &format=<fasta/flat>
Example 1: get EST
http://bird.u-strasbg.fr:8080/bird/bsearch?db=gbest&accession=Cj133605&field=DE,OS,OC,TISSUE_TYPE,DEV_STAGE
Example 2: get Protein :
http://bird.u-strasbg.fr:8080/bird/bsearch?db=uniprot&accession=Q23456
Example 3: get PDB :
http://bird.u-strasbg.fr:8080/bird/bsearch?db=pdb&accession=1XDS
Example 4: get Fasta :
http://bird.u-strasbg.fr:8080/bird/bsearch?db=pdb&accession=1XDS&format=fasta
WEB Server
Beta version: [2]
API JAVA - BIRDQL Client
The API is an Interface of programming which defines the way in which a data-processing component can communicate with another. The API Java of BIRD contains useful reusable classes by external modules of access to the databases. It has functions (methods) returning the data selected under various formats. The user of high-level can use the API to develop new functionalities exploiting of the data. It can also be used to make personalized graphic interfaces and Web Services. The codes Java below illustrate the exploitation of BIRD API. BIRDQL Engine doesn’t return data but just OIDs of selected records. The content of the record must then be searched by the API.
API BIRD
Import org.igbmc.bird.* Class ExampleUtilisationAPI {
InterfactDB birddb = new InterfaceDB(“my-bird”) // BIRD-QL String birdql = ” ID * DB UniProt --WH OS contains "Mus mus" --WH OC contains "Eukaryota" & not "Metazoa" --FM OID” Vector OID=birddb.queryengine.run(birdql); For { i=1 to OID.size() } { // result treatment UniProt obj=(UniProt)birddb.getObject(OID[i]); …. }
PhP & Java Connection to BIRD HTTP Post
PhP
<?php function executeBIRDQuery($params=array()) { $data = http_build_query($params); $targetWebserviceUrl = 'http://decrypthon.u-strasbg.fr:8080/bird/bsearch'; $options = array('http' => array( 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9', // who am i 'max_redirects' => 10, // stop after 10 redirects 'timeout' => 60, // timeout on response 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" ."Content-Length: " . strlen($data) . "\r\n", 'content' => $data )); $context = stream_context_create($options); return file_get_contents($targetWebserviceUrl, false, $context); } $bql = <<<EOT ID * DB UNIPROT WH TEXT CONTAINS "polymerase" LM 10 FM FASTA EOT; echo executeBIRDQuery(array('service'=>'birdql','query'=>$bql)); ?>
Java
/** download httpclient from http://hc.apache.org/downloads.cgi**/ import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.PostMethod; String url = "http://decrypthon.u-strasbg.fr:8080/bird/bsearch"; String mybioql="ID * DB DB \n" + "WH TEXT CONTAINS \"DMD\" \n"+ "LM 100 \n"+ "FM FASTA \n"; PostMethod postMethod = new PostMethod(url); client.setConnectionTimeout(300); postMethod.addParameter("service","birdql"); postMethod.addParameter("query",mybioql); int statusCode1 = client.executeMethod(postMethod); String result= postMethod.getResponseBodyAsString(); postMethod.releaseConnection();
BIRDQL CLient
java org.igbmc.bird.datadiscovery.BirdQLClient birdql nameServer outFile
@birdql : file name contains your bird-ql query
@nameServer: name of BIRD Server (d1.crihan.fr or bird.u-strasbg.fr)
@outFile : file name, the result will be print to this file
BirdHttpClient
A fonctional API to use Bird with Java by HTTP. Available by subversion in svn/dkieffer/BirdHTTPClient. Or download beta version here.