/usr/share/doc/bioperl/examples/tree/paup2phylip.pl is in bioperl 1.6.901-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/usr/bin/perl
# Author: Jason Stajich <jason.stajich@duke.edu>
# Convert a PAUP tree block to Phylip format
use strict;
my @data;
while(<>) {
last if( /Translate/ );
}
while(<>) {
last if (/;/);
my ($num, $taxon) = (/\s+(\d+)\s([A-Za-z\.\_]+),/);
$data[$num] = substr($taxon,0,10);
}
while(<>) {
next unless (s/^\s*tree (\S+) = \[\S+\] //i);
my $tree = $_;
for( my $i=scalar @data; $i > 0; $i-- ) {
my $taxon = $data[$i];
$tree =~ s/$i/$taxon/;
}
print $tree;
}
|