BioJava CookBook

BioJava Cookbook for release 4.*

BioJava 3+ is a major re-write of BioJava 1. As such many things work differently. This cookbook provides examples how to work with the new codebase.

The page was inspired by various programming cookbooks and follows a “How do I…?” type approach. Each “How do I?” is linked to some example code that does what you want and sometimes more. Basically if you find the code you want and copy and paste it into your program you should be up and running quickly. I have endeavoured to over document the code to make it more obvious what I am doing so some of the code might look a bit bloated.

If you have any suggestions, questions or comments contact the biojava mailing list. To subscribe to this list go here


Many topics are also covered in the BioJava tutorial.

How Do I….?

Core Module - Working with Sequences

Required modules: biojava-core

Protein Structure

Required modules: biojava-structure, biojava-alignment Optional module : biojava-structure-gui for the 3D visualisation Optional external library : JmolApplet.jar for the 3D visualisation

Pairwise and Multiple Sequence Alignment

Required modules: biojava-alignment, biojava-core, biojava-phylo Required external library: forester.jar


Required modules: biojava-genome


Required modules: biojava-core,biojava-sequencing Required external library: guava-11.0.1.jar

Phylogenetic tree

Required modules: ‘‘biojava-core Required external library: forester.jar

Physico-Chemical Properties Computation

Required modules: biojava-aa-prop, biojava-structure and biojava-core

Protein Disorder

Required modules: biojava-protein-disorder

Protein Modification Identification

Required modules: biojava-modfinder, biojava-structure

Remote Web Service Calls

Required modules: biojava-core, biojava-ws

Legacy 1.8.x CookBook

The CookBook for the legacy 1.8.x code base is available from here.