# [Package] Phylogenetics for Mathematica

Posted 7 years ago
13647 Views
|
12 Replies
|
25 Total Likes
|
 Dr. P. David Polly from Indiana University published a Phylogenetics package for Mathematica. A detailed User's Guide is also available. Short discription is copied below.Keywords: Phylogenetics; Ancestral Node Reconstruction; Newick TreesAbstract: This add-in package for Mathematica performs basic phylogenetic functions, including reading and drawing Newick format trees, calculating phylogenetically independent contrasts, reconstructing ancestral values for continuous traits, performing random walks, and simulating continuous traits on phylogenetic trees. The file is a ".m" file, which can be imported into Mathematica 6.0 and later (functions do not work in earlier versions of Mathematica). Install using the "Install" item on the "File" menu. Once installed, you must load the package like any other with the line <
12 Replies
Sort By:
Posted 4 years ago
 Decent need to accomplish something like this with mine.
Posted 4 years ago
 Thanks for sharing!You can consider adding your packages to http://packagedata.net/Are you familiar with this other phylogenetics package? https://github.com/IstvanZachar/PhylogeneticsFinally, may I suggest converting it to a true package (following the standard structure, having its own context, etc.)? You will find many resources on getting started here: https://mathematica.stackexchange.com/a/132960/12Once you are confident creating packages that follow the standard structure, you can consider distributing them as paclets: https://mathematica.stackexchange.com/q/131101/12 This provides a robust, user-friendly installation and uninstallation method.
Posted 4 years ago
 Thanks for the pointers. The page on formatting packages is particularly helpful because this information is not presented very clearly in Wolfram documentation (or if it is, I haven't found the right sections). No, I was not aware of the other phylogenetics package. It seems to have come along after I started mine and I don't think I have systematically searched for others since then.
Posted 4 years ago
 A new version of Phylogenetics for Mathematica (v6.2) is available, along with user guide. The package now has more tree manipulation functions, phylogenetic comparative methods, implementation of Gene Hunt's evolutionary model fitting routines for stratigraphic sequences. My packages Geometric Morphometrics for Mathematica, Quantitative Paleontology for Mathematica, and Modularity for Mathematica (with Anjali Goswami) are available on the same page. The following graphic was produced using the MapTraitsOntoTree function from the Phylogenetics pacakge.
Posted 4 years ago
 Thank you! I used your package some years ago and was very useful. We recently released the Function Repository. Maybe you can consider submitting it there?
Posted 4 years ago
 Thank you! I used your package some years ago and was very useful. We recently released the Function Repository. Maybe you can consider submitting it there? The function repository accepts single functions. How would a package, which contains many inter-dependent functions, fit there?
Posted 4 years ago
 If there are many interdependencies then it might be better to wait for the (eventual) paclet repo. But if there are useful stand-alone functions, or function grouips that have small sets of interdependencies, then the WFR is a good place from our perspective.For what it's worth, I hope to put a phylogenenetic tree builder function there in the next several weeks. Not part of my day job, so it's not on a fast track exactly.
Posted 4 years ago
 I'm eagerly waiting for the paclet repo!Does the function repository allow dependence on other function repository functions?
Posted 4 years ago
 Yes to dependencies. One invokes as ResourceFunction["FuncName"], same as would be done anywhere else.
Posted 3 years ago
 There is now a phylogenetic tree plotting function in the Wolfram Function Repository.https://resources.wolframcloud.com/FunctionRepository/resources/PhylogeneticTreePlotIt uses a particular method, and with hard-wired parameter values. So there is no flexibility for tuning. But of course the code is available in the author notebook in case people want to make alterations. Also I'd be curious to learn about experiments with different methods.
Posted 3 years ago
 Hi Dr. Polly,I'm getting some errors while trying to use a nwk file. I've tried this with PollyPhylogenetics 6.2 on Mathematica 12 and 12.1. Both failed.This is what I get when using the Plaintext or String version of the file:However, when I use an online viewer like this one http://etetoolkit.org/treeview/, it works fine:I put the data I'm trying to use in the Cloud. You can get it by doing: CloudGet[CloudObject[https://www.wolframcloud.com/obj/christianp/Pandemic2020/data/nextstrain_ncov_timetree]] `The original source is: https://nextstrain.org/ncovAm I doing something wrong or does the package need some update?Thanks
Posted 3 years ago
 The structure of your tree tree is more complicated than my code expects. In addition to tips and branch lengths, your file has entries for node names. For example, one bit of the tree file looks like this:(Belgium/ULG-6216/2020:0.03161716056206387,Ireland/Dublin-19072/2020:0.0015625157534486789)NODE_ 0000305:0.00780043233021388That treats "Belgium/ULG-6216/2020" and "Ireland/Dublin-19072/2020" as two tips, each with a branch length after their respective ":". They are then enclosed in parentheses. What follows "NODE_0000305" appears to be a node label followed by ":" and the subtending branch length. My code is vomiting on the node name because it expects a ":" directly after the closing parenthesis (my code automatically numbers nodes using its own scheme). You could probably strip out the node names with a search and replace for "NODE*:" to ":" if you have the right tool. Even Word will do it with the right wildcard options.Warning though, my function is not terribly efficient. It's performance may not be great with trees this big, so expect it to be a little sluggish.