Skip to content

Instantly share code, notes, and snippets.

@olas
Created January 15, 2009 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olas/47421 to your computer and use it in GitHub Desktop.
Save olas/47421 to your computer and use it in GitHub Desktop.
Predict drug susceptibility for HIV mutant using XMPP service
/*******************************************************************************
* Script to predict the susceptibility of an HIV protease sequence for seven
* drugs based on the proteochemometric model described in:
* Lapins M, Eklund M, Spjuth O, Prusis P, Wikberg JE.
* Proteochemometric modeling of HIV protease susceptibility,
* BMC Bioinformatics. 2008 Apr 10;9:181. .
*
* Script accepts a 99 aa sequence as input and delivers susceptbiliy values
* for the drugs Amprenavir, Atazanavir, Indinavir, Lopinavir, Nelfinavir,
* Ritonavir, and Saquinavir.
*
* Script author: Ola Spjuth <ola.spjuth@farmbio.uu.se>
*
******************************************************************************/
//Define input sequence and XMPP service and -function
var seq="PQITLWQRPIVTIKIGGQLREALLDTGADNTVLEEMNLPGRWKPKMIVGIGGFIKVRQYDQILIEICGHKAIGTVLVGPTPVNIIGRDLLTQIGCTLNF";
var predictionServer="hivpred.ws1.bmc.uu.se";
var predictionFunction="predictSusceptibility";
//Connect if not connected (requires JID and password in preferences)
if (!(xmpp.isConnected()))
xmpp.connect();
//Set up function
var func = xmpp.getFunction(predictionServer, predictionFunction);
var iof;
if (xmpp.existsIoFactory(func)) //Check if binding exists
iof=xmpp.getIoFactory(func); //Try to load generated binding
if (iof==null){
var ios = func.getIoSchemataSync(20000); //Get schema from service
iof = xmpp.getIoFactory(ios); //Generate binding
}
//Create input document
var inputDoc=iof.createHIVPredInputDocument();
var inputObject = inputDoc.addNewHIVPredInput();
inputObject.setSequence(seq);
//Invoke service on document
var result = func.invokeSync(inputDoc, 20000);
//Handle results
var resultDoc = iof.getOutputObject(result);
js.print("Predicted susceptibility:\n\n " + resultDoc.toString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment