liamrevell / Rphylip

An R interface for PHYLIP.
12 stars 12 forks source link

Rconsense can now handle ompetely unresolved consensus trees #9

Closed bsennblad closed 5 years ago

bsennblad commented 7 years ago

@liamrevell I have used Rphylip in a project and noticed that when the consensus tree from phylip's consense method is completely unresolved, then Rconsense fails when reformatting the tree to a phylo object.

Briefly, when the outtree file from phylip's consense is read, the bootstrap values are stored in tree$edge.length; Rconsense attempts to moves these to tree$node.label. However, Rconsense then assumes that there are at least two internal nodes and, therefore, fails when there are fewer internal nodes (as is the case for a completely unresolved tree which has only one internal node, the root). In this proposed change, I have added an additional if clause that handles the case with a single internal (root) node.

I have chosen to communicate this as a pull request. Please let me know how you want to handle this.

Some additional info: 1) To simplify testing, I modified the version number in Rphylip/DESCRIPTION, adding a "-1" (i.e., from "Version: 0.1-26" to "Version: 0.1-26-1"). This is probably not your preferred way, and need to be fixed. Let me know if/how I should change this. 2) I have made bioconda recipes for both Phylip and Rphylip for use in one of our projects. I could have made this change as a patch, but I felt would be much better to fix it in the source code if this could be done quickly. Let me know if this is not the case.

I hope you will have use of this proposed change to improve the Rphylip package -- it is a great package! Thank you for providing it.