Groovy

What is Groovy?

Groovy should be thought of as Java Scripting.  Want to write a Java program in an executable text file like you would a Perl or Python program?  Want to be sloppy with types?  Want to write some code without obligatory exception handling?   Want more syntatic sugar for common tasks?  Want Perl regular expression syntax?  Want to write a command line java program that you can invoke like any other script, that is, something like:

computeNonRedundantFeatures  input.csv > nonredundant.csv

rather than something like:

java -cp $CLASSPATH ucsc.edu.RedundantFeatureRemover input.csv > nonredundant.csv

Groovy will give you all of these things and more. 

Groovy...

  • is an agile and dynamic language for the Java Virtual Machine
  • builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk
  • makes modern programming features available to Java developers with almost-zero learning curve
  • supports Domain-Specific Languages and other compact syntax so your code becomes easy to read and maintain
  • makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL
  • increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications
  • simplifies testing by supporting unit testing and mocking out-of-the-box
  • seamlessly integrates with all existing Java objects and libraries
  • compiles straight to Java bytecode so you can use it anywhere you can use Java

Groovy in Bioinformatics


Here's one article describing how Groovy can be a good choice for bioinformatics.

Learning Groovy


Groovy is roughly a superset of Java, so most Java code will run unaltered.  If you know Java you can start using Groovy immediately, learning Groovy specifics as you go.

Groovy is very well documented at the Groovy project website with beginning and advanced tutorials, library references, cookbook examples, and other documentation.

Programming Languages Coded Alike (PLEAC) is another good source of Groovy examples.  The Perl Cookbook is a familiar standard on the shelves of many bioinformatics programmers.  PLEAC is a project to implement all of the examples in The Perl Cookbook in various other languages (Groovy, Python, Ruby, etc.).   The Groovy examples are close to 100% complete, so PLEAC is a good place both to find examples of how to do things in Groovy and to get a good feel for how various languages compare. 

Using Weka from Groovy is a brief outline of how to use the machine learning library/application Weka from Groovy.

This is a blog with Groovy examples from bioinformatics.

A BioGroovy project page, although for the most part, anything Java is also applicable to Groovy, so BioJava is another source for BioGroovy info.