BIRD Data Access Protocol

From Wikili
Jump to: navigation, search

BIRD Data Access Protocol for Data-Intensive Applications

Simple Services-Bank ID

Service : http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=<database>&accession=<ac or id>&field=<DE,OS..> &format=<fasta/flat>

Example 1: get dbsnp by ID

     http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=dbsnp&accession=268

Example 2: get dbsnp genotype by ID

     http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=dbsnpgt&accession=268

Example 3: get dbsnp genotype population by ID

     http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=dbsnpgtpop&accession=1371

Example 4: get dbsnp genotype individual by ID

     http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=dbsnpgtind&accession=867

Example 5: get RefSeq Protein

     http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=refseqp&accession=NP_001256133&format=fasta

Example 6: get Protein :

     http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=uniprot&accession=Q23456

Example 7: get PDB :

    http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=pdb&accession=1XDS

Example 8: get Fasta :

    http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?db=pdb&accession=1XDS&format=fasta


Data Selection by BIRDQL Query Engine Service

Data can also be selected with BIRDQL queries; Expert users can however modify queries by hand. Three query service are available:

  1. curl -F upload=@your_bird.ql 'http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?service=birdql'
    
  2. http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?service=birdql&query=your_birdql
    
    • Example:
      •  http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?service=birdql&query=ID * DB Uniprot--WH DE contains "histone"--LM 10--FD AC,DE--FM FLAT
        
      • http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?service=birdql&query=ID * DB Uniprot--WH DE contains "Helianthinin"--LM 10--FM FASTA
        
      • http://kbm.u-strasbg.fr:8080/birdsnp/bsearch?service=birdql&query=ID * DB Uniprot--WH DE contains "Helianthinin"--LM 10--FM JSON
        
  3. 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/BirdClient/BirdConsole.sh ( or download here).


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 MyBank
                     --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://kbm.u-strasbg.fr:8080/birdsnp/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 MYBANK
   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;
     //bird server
     String url = "http://kbm.u-strasbg.fr:8080/birdsnp/bsearch";
     String mybioql="ID * DB MyBANK \n" +
   	               "WH TEXT CONTAINS \"DMD\" \n"+
   	               "LM 100 \n"+
   	               "FM FASTA \n";
     PostMethod postMethod = new PostMethod(url);
     client.setConnectionTimeout(300);
     // post parameters: service="birdql" & query="...."
     postMethod.addParameter("service","birdql");
     postMethod.addParameter("query",mybioql);
     // running birdql query
     int statusCode1 = client.executeMethod(postMethod);
     // get results
     String result= postMethod.getResponseBodyAsString();
     postMethod.releaseConnection();

BirdHttpClient

A fonctional API to use Bird with Java by HTTP. Available by subversion in svn/dkieffer/BirdHTTPClient. Or download beta version here.