~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to scripts/tree/nexus2nh.PLS

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!perl -w
2
 
 
3
 
=head1 NAME
4
 
 
5
 
nexus2nh - convert nexus format trees (from PAUP* and MrBayes) to new hampshire
6
 
 
7
 
=head1 SYNOPSIS
8
 
 
9
 
 nexus2nh file.nexus > file.nh
10
 
 
11
 
 # OR pipe in through STDIN
12
 
 
13
 
 cat file.nexus | nexus2nh > file.nh
14
 
 
15
 
 # OR specify an output
16
 
 
17
 
 nexus2nh -o file.nh file.nexus
18
 
 
19
 
=head1 DESCRIPTION
20
 
 
21
 
Convert Nexus Tree files into Newick/New Hampshire format tree files.
22
 
 
23
 
 
24
 
=cut
25
 
 
26
 
use strict;
27
 
use Bio::TreeIO;
28
 
use Getopt::Long;
29
 
 
30
 
my $outfile;
31
 
 
32
 
GetOptions('o|out|outfile:s' => \$outfile);
33
 
 
34
 
my $in = Bio::TreeIO->new(-format => 'nexus', -fh => \*ARGV);
35
 
my $out;
36
 
if( $outfile ) { 
37
 
    $out= Bio::TreeIO->new(-format => 'newick',
38
 
                           -file   => ">$outfile");
39
 
} else { 
40
 
    # write to STDOUT
41
 
    $out= Bio::TreeIO->new(-format => 'newick');
42
 
}
43
 
 
44
 
while( my $t = $in->next_tree ) {
45
 
    $out->write_tree($t);
46
 
}