Web Services Description

From DISI
Jump to: navigation, search

the web services are accessible at http://gurgendev.bkslab.org:8080/aggregate_lookup/xml-rpc/. {LINK NO LONGER WORKING} The interaction with the service is based on following requests

Description of Methods


method: '''similarity.getExactMatch'''. 
returns aggregators and non-aggregators that match the query molecule exactly
params: '''<string>smile</string>''' query string
This method queries the web service for an exact match(over 95% similarity)
'''response''':
   <struct>
       <respcode><string>00</string></respcode> //00 in case of success, 90 if no results are found, 99 internal server error
       <msg><string> Message</string></msg> //optional, only when respcode != 00
       <smile><string><string></smile> //filtered smile that was used for query
       <aggregators>
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</stiring></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </aggregators>
      <non-aggregators>
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</stiring></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </non-aggregators>
   </struct>

method: '''similarity.getSimilar'''. returns similar aggregators and ambigous that match the query molecule exactly
params: '''<string>smile</string>''' query string
This method queries the web service for an exact match(over 65% similarity)
'''response''':
   <struct>
       <respcode><string>00</string></respcode> //00 in case of success, 90 if no results are found, 99 internal server error
       <msg><string> Message</string></msg> //optional, only when respcode != 00
       <smile><string><string></smile> //filtered smile that was used for query
       <aggregators>
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</string></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </aggregators>
      < ambiguous >
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</stiring></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </ambiguous>
   </struct>

method: '''similarity.getMurcoSimilars'''. returns similar aggregators and ambigous that match the query molecule exactly
params: '''<string>smile</string>''' query string
This method queries the web service for matches which have similar(over 95% similarity) murco scaffold. The murco scaffold is calculated using MIB tools
'''response''':
   <struct>
       <respcode><string>00</string></respcode> //00 in case of success, 90 if no results are found, 99 internal server error
       <msg><string> Message</string></msg> //optional, only when respcode != 00
       <smile><string><string></smile> //smile for murco scaffold that was used for query
       <aggregators>
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</string></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </aggregators>
      < ambiguous >
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</stiring></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </ambiguous>
   </struct>


method: '''similarity.getLogP'''. calculates and returns logP value for a molecule
params: '''<string>smile</string>''' query string
This method queries the web service for an exact match(over 65% similarity)
'''response''':
   <struct>
       <respcode><string>00</string></respcode> //00 in case of success, 99 internal server error
       <msg><string> Message</string></msg> //optional, only when respcode != 00
       <logP><double>LogP</double></logP> //LogP value as calculated by MIButils
      
   </struct>

method: '''similarity.getAggregators'''. returns known aggregators from database
params: '''<start><string>Start</string><start><count><count>''' start is the id of the aggregator, count is the number of aggregators to retrieve. Web service returns aggregators in the range [start, start+count]
'''response''':
   <struct>
       <respcode><string>00</string></respcode> //00 in case of success, 90 if no results are found, 99 internal server error
       <count><int> Count</int></count> //total number of aggreagtors in the database
       <aggregators>
            <array>
                   <struct>
                            <formula><string>Formula</string></formula>//chemical formula of the compound
                            <smile><string>SMILE</string></smile>//SMILE of the formula
                            <similarity><double>Similarity</double> //similarity level of the molecule to query
                            <reference><string>Reference</string></reference>// reference to where the aggregator was published
                    </struct>
            </array>
       </aggregators>
   </struct>


===Example Client===

Any XML-RPC client is compatible with this web-service. When using Java I recommend using '''Redstone XML-RPC''' (http://xmlrpc.sourceforge.net/), since it is lightweight and easy to use. Below is an example code for interating with the web servce. 

  import redstone.xmlrpc.XmlRpcClient;
 import java.util.HashMap;
 import java.util.ArrayList;
 public class Test{
  
 public static void main( String[] args )
 {
 try{
    XmlRpcClient client = new XmlRpcClient( "http://localhost:8080/aggregate_lookup/xml-rpc/", false );
    java.util.HashMap result = (java.util.HashMap)client.invoke("similarity.getSimilar", new Object[] {"c1cc(O)c2C(=O)C(O)=C(Oc2c1)c3ccc(O)c(O)c3"});
        System.out.println("result retreived");
        java.util.ArrayList agg = (java.util.ArrayList)result.get("aggregators");
        System.out.println("retreived agg.size:"+agg.size());
        for(int i=0; i< agg.size(); i++){
                HashMap hit = (HashMap)agg.get(i);
                String formula =(String) hit.get("formula");
                String reference =(String) hit.get("reference");
                Double score =(Double) hit.get("dissimilarity");
                System.out.println("Formula:"+formula+"\tReference:"+reference+"\tScore:"+score+"\n");
        }
 }catch(Exception ex)
        {
                ex.printStackTrace();
        }
 }
 }