| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | |||
| 6 | use Data::Dumper; | ||
| 7 | use Carp; | ||
| 8 | |||
| 9 | use 5.010; | ||
| 10 | |||
| 11 | use Bio::Gonzales::Phylo::Util qw/consensus_tree/; | ||
| 12 | |||
| 13 | |||
| 14 | use Getopt::Long::Descriptive; | ||
| 15 | |||
| 16 | my ($opt, $usage) = describe_options( | ||
| 17 | '%c %o <input_forest> <output_consensus_tree>', | ||
| 18 | [ 'fraction|f=f', "set bootstrap cutoff", {default => 0.5} ], | ||
| 19 | [ 'help', "print usage message and exit" ], | ||
| 20 | ); | ||
| 21 | |||
| 22 | print($usage->text), exit if $opt->help; | ||
| 23 | |||
| 24 | my ($input, $output) = @ARGV; | ||
| 25 | |||
| 26 | die "couldn't open $input" unless($input && -f $input); | ||
| 27 | |||
| 28 | die "no output file" unless($output); | ||
| 29 | |||
| 30 | consensus_tree($input, $output, $opt->fraction); |