Bioclipse Scripting Language

Bioclipse 2 contains scripting consoles, one for each supported scripting language. These consoles give the user access to data and plugins through a command-oriented environment. Currently supported scripting languages are JavaScript, and R. Groovy and Ruby are available only in experimental state.

 

Getting started

The JavaScript console takes up the space directly below the editor. It's open by default in Bioclipse, but should it be closed for some reason, you can re-open it through Window > Show View > Other... > Scripting > JavaScript Console".

Try typing in:

2 + 2

at the console. You should be getting this back:

> 2 + 2
4

Getting help

Press the <code>Tab key twice. A list of commands should appear. Try also typing help js

and you'll get a summary of the js manager.

Test to write: help js.say and you will get this description of the manager method js.say.

Manipulating molecules in BSL

Type cdk.fromSM, and have the console complete the method name by hitting the Tab key. The result should be this:

cdk.fromSMILES(

You get an opening parenthesis, because this is a method call. If the method expected no parameters, you'd get a closing parenthesis too. But here, let's provide a SMILES string:

cdk.fromSMILES("CCCC")

The result is this:

> cdk.fromSMILES("CCCC")CDKMolecule:C4H10

If you want to store the molecule for later, you can assign the result to a variable:

var butane = cdk.fromSMILES("CCCC")

 

Writing scripts

You can create files in the Bioclipse Navigator (File > New ... and select File) - name it HelloBSL.js, Write the following script:

butane = cdk.fromSMILES("CCCC");res = cdk.calculateMass(butane);js.say("Mass is: " + res);

Then, in the toolbar click on the "Run Javascript" icon and see the result:

Mass is: 58.1224

 

Sharing scripts

We promote sharing of scripts using MyExperiment and Gist. You can download gists using the command gist.download(GIST_NUMBER). You can query MyExperiment using the command:  myexperiment.search("RDF").