Home       Downloads       Documentation       Contact       Mesquite


Java ≥ 5 (aka v1.5) is required.


NINJA is software for large-scale neighbor-joining phylogeny inference. It expects inputs to be either alignments (in fasta format) or pairwise distance matrices (in phylip format), and can produce both a distance matrix (phylip) and a tree file (newick format).

(1) After downloading Ninja.tgz, unpack with the command

  tar -xzf Ninja.tgz
This will create a folder ninja_x.y.z, containing three files:
  • 00README
  • Ninja.jar (the heart of NINJA)
  • ninja (a shell script that runs Ninja.jar with appropriate Java flags)

(2) To build a tree, use one of the following commands:
./ninja alignment.fasta > tree.newick
(or)
./ninja --in alignment.fasta --out tree.newick
NINJA can also output a phylip formatted distance matrix, or accept such a matrix as input, with the following commands, respectively:
./ninja --out_type d alignment.fasta > distance_file
(and)
./ninja --in_type d distance_file > tree.newick
For a list of ninja arguments, use the --help flag:
./ninja --help
(3) The external-memory variant of NINJA, used for inputs of many thousands of sequence, makes moderate use of the disk. That proves to be a negligible problem for other applications running concurrently, since most apps don't use the disk all that much, but can become a problem if several instances of NINJA are hitting the same disk. This is particularly a concern for clusters where the compute nodes all share a common disk, e.g. though NFS. NINJA allows you to manage this issue by specifying where it should place the temporary folder in which it holds all the temporary files used to store data structures on disk. If you have a cluster, each of your compute nodes likely has a local disk drive - you'd just tell NINJA to do all its temporary work in a directory that maps to that local disk. The flag "-t" gets you there :
ninja -t /local/disk distance_matrix > tree

Source code is included in the jar. Extract the jar ('jar xf Ninja.jar'), then enter the src directory.

NINJA has been tested on unix and linux operating systems, and should work on cygwin. It should also work in Windows, though I've had a report of a problem that appears to be an error in the Windows Java BufferedReader (yuck).


Details of the algorithms used in NINJA are available in the original paper, or this preprint of the 2009 WABI paper.