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

Possible (minor) bug in PC ancestors? #608

Open
hyanwong opened this issue Nov 15, 2021 · 3 comments
Open

Possible (minor) bug in PC ancestors? #608

hyanwong opened this issue Nov 15, 2021 · 3 comments
Milestone

Comments

@hyanwong
Copy link
Member

I see that when we add a PC ancestor here:

pc_node = self.add_node(-1, constants.NODE_IS_PC_ANCESTOR)

And presumably in an equivalent place in the C code, we override the default "flags=tskit.NODE_IS_SAMPLE" value. This presumably means that when we create PC ancestors in the ancestors_tree_sequence, they are not marked as samples. I think there was a good reason to mark all the nodes in the ancestors_tree_sequence as samples, e.g. so they don't get simplified away. If so, then the PC nodes are escaping this, and I guess that might be responsible for some weird behaviour?

@jeromekelleher
Copy link
Member

I think they're all still marked as samples (we probably OR the flags with TSK_NODE_IS_SAMPLE) but I don't know off the top of my head. Should be easy enough the check if there's any non-sample nodes in the ancestors ts?

@hyanwong
Copy link
Member Author

hyanwong commented Nov 15, 2021

Yeah, I did and it appears that they aren't marked as samples:

anc = tsinfer.generate_ancestors(samples)
anc_ts = tsinfer.match_ancestors(samples, anc, path_compression=False)
print(anc_ts.num_nodes, anc_ts.num_samples)

anc_ts = tsinfer.match_ancestors(samples, anc)
print(anc_ts.num_nodes, anc_ts.num_samples)

gives

6402 6402
7372 6402

@hyanwong
Copy link
Member Author

As discussed with @jeromekelleher, we should probably only set the is_sample flag when writing out the final ancestors tree sequence. We don't actually use it internally anyway - it's just for ease of printing out haplotypes.

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

No branches or pull requests

2 participants