2007-11-22

Scripting in Bioclipse 2

Go to WindowShow ViewOther... in the application menu in Bioclipse 2. Under the heading Scripting, we find Groovy Console and Javascript Console. Pick Groovy Console.


groovy> "CCCTCGCCACCTATACCCAG".replace("T","U")
CCCUCGCCACCUAUACCCAG
groovy> ["Alanine", "Glutamic Acid", "Methionine", "Tryptophan"].findAll { it.endsWith("ine") }
[Alanine, Methionine]



Performing more integrated Bioclipse actions depends on getting more of the data model done, but the above should give a sense of why command-line scripting is something we want.

Our dream is something along the lines of being able to turn many of the common actions in Bioclipse into pieces of scripts, so that actions can be recorded and saved, much like macros in some applications.

The fact that we now have two scripting engines in net.bioclipse.core spurred some discussion on the channel, which has given me food for thought. I do think the scripting capability in Bioclipse 2 should be built-in to the point of being hard to avoid... but there's nothing that says that this capability needs to be a language engine like Rhino or Groovy. Instead, one could imagine it being an API of some sort.

If that turns out to be the way we do it, neither Rhino nor Groovy need be core. My hope is that we can make things decoupled enough to be able to move them out into separate plugins. But it's too early to tell; still too many unknowns.

Coming up: Ruby!

3 comments:

  1. I must admit that I have come to love the idea of having a bioclipse scripting api with methods and model objects that could just as well be used in any of javascript, groovy or jruby.

    ReplyDelete
  2. I have one problem with the idea of hard-coded data objects. I understand that this makes learning Bioclipse easier... but what I do not understand how plugins can add objects...

    Can you explain how I can do that?

    ReplyDelete
  3. egon: No hard-coded data objects needed. The trick which enables edrin++'s script plugin to load classpaths dynamically would save the day here as well. This I gained from a discussion yesterday spurred by your question.

    For more details, see the rhino plugin in Bioclipse.

    ReplyDelete