# Groovy Support in Jalview

Groovy has been bundled with the Jalview desktop since circa 2012. The program supports interactive execution of groovy scripts via the Groovy Console, and command line execution via the '-groovy' option. The main source for documentation about Groovy in Jalview is the online help pages.

Here are some scripts to get you started:

- Getting the title, alignment and first sequence from the current alignFrame

      def alf = Jalview.getAlignFrames();
      print alf[0].getTitle();
      def alignment = alf[0].viewport.alignment;
      def seq = alignment.getSequenceAt(0);

## TODO

Using Java class methods from Groovy is straightforward, but currently, there isn't a set of easy to use methods for the jalview objects. A Jalview Scripting API needs to be developed to make this easier.

### Making it easier

jalview.bin.JalviewScript could be a top level jalview instance of a script execution thread, creating and maintaining the context for scripts operating on the jalview datamodel and interfacing with the Jalview GUI.