Extracting subset of trees from trees file

511 views
Skip to first unread message

Brittany Rife

unread,
Jun 2, 2014, 8:39:42 AM6/2/14
to beast...@googlegroups.com
This may be a silly question, but a previous coworker had combined BEAST .trees files in LogCombiner without resampling to provide a final file with 10,000 trees. Now the .trees file is too big for TreeAnnotator to handle to create the MCC tree, so I need to extract 10,000 trees from this gigantic file. I am not even sure how many trees is actually in this file. Does anyone know how to do this?

Santiago Sánchez

unread,
Jun 2, 2014, 11:30:48 AM6/2/14
to beast...@googlegroups.com
Hello Brittany,

This command line in the terminal will give you the exact number of trees in your tree file:

grep -c "tree STATE" $1 your_tree_file.trees

In addition, you can use this perl script I wrote to resample your large tree. Run it with the "-h" argument to get the details of how it works. It will be something like:

perl GetPosteriorTrees.pl -burnin 0 -resample 10000 -trees your_tree_file.trees -out  your_tree_file_resampled.trees -HPD false

Let me know if this works for you.

Cheers,
Santiago



2014-06-02 8:39 GMT-04:00 Brittany Rife <rife...@gmail.com>:
This may be a silly question, but a previous coworker had combined BEAST .trees files in LogCombiner without resampling to provide a final file with 10,000 trees. Now the .trees file is too big for TreeAnnotator to handle to create the MCC tree, so I need to extract 10,000 trees from this gigantic file. I am not even sure how many trees is actually in this file. Does anyone know how to do this?

--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at http://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/d/optout.



--
Santiago Sánchez-Ramírez
Department of Ecology and Evolutionary Biology, University of Toronto
Department of Natural History (Mycology), Royal Ontario Museum
100 Queen's Park
Toronto, ON
M5S 2C6
Canada
GetPosteriorTrees.pl

Santiago Sánchez

unread,
Jun 2, 2014, 1:09:58 PM6/2/14
to beast...@googlegroups.com
I found a small bug in the script. Here is the corrected version.
GetPosteriorTrees.pl
Message has been deleted

Brittany Rife

unread,
Jun 2, 2014, 3:32:42 PM6/2/14
to beast...@googlegroups.com
Great! The only problem is that is not in the proper format for TreeAnnotator. Do you also have a small modifier script for the file?

Brittany Rife

unread,
Jun 2, 2014, 3:56:42 PM6/2/14
to beast...@googlegroups.com
Nevermind. I think it just stuck an "END;" after the taxon number assignment section that TreeAnnotator didn't like

Santiago Sánchez

unread,
Jun 12, 2014, 1:09:28 PM6/12/14
to beast...@googlegroups.com
Hi Brittany,

Here is a corrected version of the script.

Cheers,
Santiago
GetPosteriorTrees.pl
Reply all
Reply to author
Forward
0 new messages