Tuesday, May 1, 2012

read.simmap now reads SIMMAP v1.5 input files

I finally got around to adding the capacity to read SIMMAP v1.5 (program description here). SIMMAP v1.5 mapped tree files use a very different modified Nexus format tree file than the previous version. Although I obviously can't speak directly to the motives of the program author, my guess is that this change was designed to allow SIMMAP tree files to be read into other programs that read Nexus format trees (albeit without the mapping). This was accomplished by bracketing all mappings with [ square brackets ] which are ignored as "comments" by Nexus convention. In particular, the following Newick string from version 1.0 SIMMAP tree:

((1:{0,0.3:1,0.4:0,0.3},2:{0,1.0}):{0,1.0},(3:{1,0.75:0,0.25},4:{0,1.0}):{0,1.0});

Representing the following tree:
Would be written as follows by SIMMAP v1.5:

((1:[&map={0,0.3,1,0.4,0}]1.0,2:[&map={0}]1.0):[&map={0}]1.0,(3:[&map={1,0.75,0}]1.0,4:[&map={0}]1.0):[&map={0}]1.0);

In SIMMAP v1.5 output files the mapping information for each branch is contained in the [&maps={...}] elements in which ... contains the state and (if there is more than one state on a branch) the time spend in each state from the tipward to the most rootward states on the edge - but excluding the time spend in the most rootward state (which can here be inferred by subtracting the time spend in each tipward state from the total length of the edge given after the ]).

Version is specified by a new argument: read.simmap(...,version), which is a numeric argument and can be 1.0 or 1.5.

Like prior versions of read.simmap, this present version can also read multiple trees in a list. However, I should note that if version=1.5 the tree or trees must be supplied in a Nexus style input file (not in a text string or Phylip style file, as is allowed for version=1.0).

Ok, well I have posted the function online here. It is also part of the latest version of phytools, version 0.1-8, which can be installed from the source code from my website (phytools page) and has also been submitted to CRAN.

I have only tested this with a few input files, so if you are able to give it a go - please let me know of the result.

No comments:

Post a Comment

Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.