The current GATK version is 3.6-0
Examples: Monday, today, last week, Mar 26, 3/26/04

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Powered by Vanilla. Made with Bootstrap.

Writing walkers

Geraldine_VdAuweraGeraldine_VdAuwera Posts: 10,395Administrator, Dev admin
edited March 2013 in Developer Zone

1. Introduction

The core concept behind GATK tools is the walker, a class that implements the three core operations: filtering, mapping, and reducing.

  • filter
    Reduces the size of the dataset by applying a predicate.

  • map
    Applies a function to each individual element in a dataset, effectively mapping it to a new element.

  • reduce
    Inductively combines the elements of a list. The base case is supplied by the reduceInit() function, and the inductive step is performed by the reduce() function.

Users of the GATK will provide a walker to run their analyses. The engine will produce a result by first filtering the dataset, running a map operation, and finally reducing the map operation to a single result.

2. Creating a Walker

To be usable by the GATK, the walker must satisfy the following properties:

  • It must subclass one of the basic walkers in the org.broadinstitute.sting.gatk.walkers package, usually ReadWalker or LociWalker.

    • Locus walkers present all the reads, reference bases, and reference-ordered data that overlap a single base in the reference. Locus walkers are best used for analyses that look at each locus independently, such as genotyping.

    • Read walkers present only one read at a time, as well as the reference bases and reference-ordered data that overlap that read.

    • Besides read walkers and locus walkers, the GATK features several other data access patterns, described here.

  • The compiled class or jar must be on the current classpath. The Java classpath can be controlled using either the $CLASSPATH environment variable or the JVM's -cp option.

3. Examples

The best way to get started with the GATK is to explore the walkers we've written. Here are the best walkers to look at when getting started:

  • CountLoci

    It is the simplest locus walker in our codebase. It counts the number of loci walked over in a single run of the GATK.


  • CountReads

    It is the simplest read walker in our codebase. It counts the number of reads walked over in a single run of the GATK.


  • GATKPaperGenotyper

    This is a more sophisticated example, taken from our recent paper in Genome Research (and using our ReadBackedPileup to select and filter reads). It is an extremely basic Bayesian genotyper that demonstrates how to output data to a stream and execute simple base operations.


Please note that the walker above is NOT the UnifiedGenotyper. While conceptually similar to the UnifiedGenotyper, the GATKPaperGenotyper uses a much simpler calling model for increased clarity and readability.

4. External walkers and the 'external' directory

The GATK can absorb external walkers placed in a directory of your choosing. By default, that directory is called 'external' and is relative to the Sting git root directory (for example, ~/src/Sting/external). However, you can choose to place that directory anywhere on the filesystem and specify its complete path using the ant external.dir property.

ant -Dexternal.dir=~/src/external

The GATK will check each directory under the external directory (but not the external directory itself!) for small build scripts. These build scripts must contain at least a compile target that compiles your walker and places the resulting class file into the GATK's class file output directory. The following is a sample compile target:

<target name="compile" depends="init">
    <javac srcdir="." destdir="${build.dir}" classpath="${gatk.classpath}" />

As a convenience, the build.dir ant property will be predefined to be the GATK's class file output directory and the gatk.classpath property will be predefined to be the GATK's core classpath. Once this structure is defined, any invocation of the ant build scripts will build the contents of the external directory as well as the GATK itself.

Post edited by Geraldine_VdAuwera on

Geraldine Van der Auwera, PhD



  • RWWBRWWB Posts: 1Member

    Really good tutorial, but the comment on the classpath variable was not completely clear to me.

    After some mucking about and also reading the scala , I got the following command to get my custom walkers working:
    java -classpath GenomeAnalysisTKLite.jar:custom.jar org.broadinstitute.sting.gatk.CommandLineGATK -I input.bam -o output.bam -R hg19.fa -T MyCustomWalker

  • jonathan.barlevjonathan.barlev Israel - INCPMPosts: 11Member

    @Geraldine_VdAuwera Now that GATK uses maven for building, could please indicate how to compile and use custom walkers?

    Issue · Github
    by Geraldine_VdAuwera

    Issue Number
    Last Updated
  • Geraldine_VdAuweraGeraldine_VdAuwera Posts: 10,395Administrator, Dev admin

    We'll put in a ticket to get this documented but we're pretty backed up right now so it may take a bit of time, sorry.

    Geraldine Van der Auwera, PhD

Sign In or Register to comment.