Created
August 9, 2013 23:29
-
-
Save armanbilge/6198178 to your computer and use it in GitHub Desktop.
Isolates a target tree from a BEAST trees file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# isolate_target_tree.pl | |
# Usage: isolate_target_tree.pl <target_tree_id> <trees_file> | |
use strict; | |
use warnings; | |
my $target_tree = shift; | |
# Print up to the first tree declaration, then print only the target tree | |
my $is_preamble = 1; | |
while (<>) { | |
$is_preamble = 0 if /^tree STATE_.*/; | |
print if $is_preamble or /$target_tree\s/; | |
} | |
print "End;\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment