Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue of read.nexus to solve the labels of translation contains space #29

Merged
merged 2 commits into from
Sep 13, 2021

Conversation

xiangpin
Copy link
Contributor

If the labels in Translation contain space, the original read.nexus will generate an error.

The related issue

> library(magrittr)
> readLines("./problem.tree.txt") %>% writeLines()
#NEXUS

Begin trees;
        Translate
                   1 "Tip 1",
                   2 "Tip 2",
                   3 "Tip 3 c"
;
tree TREE1 = ((1[&height=0.3]:1,2[&height=0.3]:1)[&height=0.3]:1,3[&height=0.3])[&height=0.3]:1;
End;

This issue was fixed following the steps.

First, the space and tab before the string was removed
Second, The , and ; symbols were also removed
Last, split the label string with the first space (start from left)

> library(ape)
> read.nexus("./problem.tree.txt")

Phylogenetic tree with 3 tips and 2 internal nodes.

Tip labels:
  Tip 1, Tip 2, Tip 3 c

Rooted; includes branch lengths.

@emmanuelparadis emmanuelparadis merged commit 5951e57 into emmanuelparadis:master Sep 13, 2021
@emmanuelparadis
Copy link
Owner

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants