Open isaacovercast opened 3 years ago
Hmm, interesting. Thanks for pointing this out. This is a parser issue because I'm using the built-in julia parser, which doesn't allow character tokens to begin with a number or contain a period. I'll have a think if there's some easy way around it, but nothing immediately springs to mind unfortunately.
Okay, I've finally had time to look at this, and I think I have a solution (for this issue and #42). When I wrote the original parser I couldn't use Automa.jl because it couldn't handle recursive finite state machines (so nested trees within trees within trees, like we have for phylogenies). I actually can't tell whether it can now - it doesn't mention it and the examples are non-recursive. However, it now exposes its tokeniser directly, so I think at the very least I can rewrite the parser so that it uses Automa's tokeniser. It'll be a pain, but a lot easier than writing my own tokeniser! I'm afraid it may take a bit of time before it bubbles to the top of my list though...
[edit: It definitely can't handle recursive grammars still, but they are thinking about it...]
Hello folks, very cool module, thanks for your efforts. Parsing a bunch of heterogeneous nexus files I discovered a couple potential issues, which you can guess from the title. The
parsenexus
function appears to split on integers at the head of taxon names in the TaxaLabels field. It also splits on periods (.
) in taxon names. Within thefunction parsetaxa(token, state, tokens, taxa)
this results in ataxa
dictionary with more entries than are declared in thentaxa
field of the nexus file, raising the warning at line 436.Steps to reproduce:
I updated newick.jl (~line 436) to show the taxa dictionary, so the output of the above call is more informative:
And the result is:
Expects 3 and is getting 5 because
2108_Nesoenas_picturata_Reunion
andAY529948.1
are getting split.I think
ape
doesn't allow integers to lead taxon names either, so maybe this is a feature and not a bug, but I don't think it's a constraint of the nexus format, as other packages will handle this fine (e.g. toytree and dendropy).I can work around it, so not a big deal but thought I'd report it.
Thanks again for all your work. -isaac