#!/usr/bin/perl -w use Bio::TreeIO; my $usage="Usage: $0 [-hn] [treeFile ...]\n". " -n: input is in newick (phylip) format: default = nexus (paup*) format\n"; use Getopt::Std; my %opts=(); getopts('hb:n',\%opts) || die "$usage\n"; die "$usage\n" if ($opts{h}); @ARGV = ('-') unless @ARGV; # take STDIN when no arg. my $treeOut = Bio::TreeIO->new('-format' => 'lintree', 'file' => '>-'); my $infile; while ($infile = shift @ARGV) { my $inFormat = ($opts{n}) ? 'newick' : 'nexus'; my $treeIN = new Bio::TreeIO(-file => $infile, -format => $inFormat); my $cntr = 1; while (my $tree = $treeIN->next_tree) { $treeOut->write_tree($tree); } } exit(0);