-
Notifications
You must be signed in to change notification settings - Fork 7
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
Prevent the single-node tree check from yielding "false positives" on linear trees; also fix the build #48
base: master
Are you sure you want to change the base?
Conversation
Reliant now on the topology rather than on the string, since relying on the presence of "," yields false positives in the case of a tree with multiple nodes in a single linear chain.
make test
make test
Just a small check that linear trees somehow aren't parsed as having *more* nodes than they should. IDK how that would even happen, but this ensures it shouldn't at least...
Looks good, thanks! I'm surprised actions isn't running -- I'll need to look into that before merge |
I'm confused about travis as the project was using gh actions as of a few weeks ago, and I haven't made any changes to its configuration since |
@fedarko could you merge master? That should allow for actions to run -- I think you're the first person besides me to issue a commit since the original actions configuration, and it may have needed a little tweaking |
To avoid confusion; the CI for iow is now on github actions
@wasade got it! I've merged master in, and now it looks like github actions is able to run. Looks like all of the builds are successful. There was a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just one comment.
Background
The check for single-node trees was previously structured as follows (where
data
is a Newick-format string representing a tree):In most cases, this check works. However, a Newick file containing no commas does not indicate that this tree contains only one node -- it just indicates that this tree does not contain any branches. In the weird case where our "tree" is a linear chain of nodes without any branches, e.g.
((b:3)a:2)root:1;
, this check will falsely raise an error. (I don't expect that trees like this will come up in practice often, but some of the trees in Empress' tests are structured like this -- so the current check is breaking Empress' build.)Changes in this PR
This PR fixes this check: now it is based on the topology of the parsed tree, rather than the input Newick string's number of commas. This means that the check will be performed "later on", from the user's perspective, but single-node trees should by definition be parsed pretty quickly anyway -- so I think postponing the check is reasonable.
This PR also adds a test,
test_parse_newick_linear_tree
, which ensures that "linear trees" like the ones discussed here can be parsed ok.Also, the Travis build failed for this test (see log here, which doesn't seem to show up on this PR but I did get an email about?) -- it seems like this failure is due to 1)
BitArray
being moved to within thebp
folder, which brokemake test
, and 2) flake8 issues. This PR additionally resolves both of these concerns, so the Travis build now works again.Thanks!