6 run_neighbor - run Phylip's 'neighbor' program through Bioperl
10 run_neighbor [-i inputfile] [-o outfilename]
14 Provide an matrix file to run neighbor on. File should be named of
15 the forma file.matrix or file.protdist (the ending doesn't matter, but
16 the program expects a file in the form of (\S+)\.(\S+).
18 This will run the application 'neighbor' to build a
19 Neighbor-Joining tree from a protein distance matrix.
23 Jason Stajich, jason-AT-open-bio-DOT-org
28 use Bio
::Tools
::Run
::Phylo
::Phylip
::Neighbor
;
31 my @params = ('type'=>'NJ', 'quiet' => 1);
36 'i|input:s' => \
$matrixfile,
38 'h|help' => sub { exec('perldoc',$0); exit(0) }
40 ($matrixfile) ||= shift @ARGV;
42 my ($stem,$ext) = ($matrixfile =~ /(\S+)\.(\S+)$/) ;
43 $stem ||= $matrixfile;
47 open($outfh, ">$out") || die($!);
49 open($outfh, ">$stem.tree") || die($!);
52 my $tree_factory = Bio
::Tools
::Run
::Phylo
::Phylip
::Neighbor
->new(@params);
53 my (@trees) = $tree_factory->create_tree($matrixfile);
55 my $outtree = new Bio
::TreeIO
(-fh
=> $outfh);
56 foreach my $tree ( @trees ){
57 $outtree->write_tree($tree);