-
Notifications
You must be signed in to change notification settings - Fork 77
Function to delete all mutations at a site but leave the site in the table #1034
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
Comments
How about just
This would be more flexible as well. |
ps @hyanwong - I edited your comment above so that the code is rendered with Python highlighting - you just need to put "python" at the end of the three backticks. |
That would be great, but we'd have to figure out how to deal with deleting only some mutations at a site. This might actually be impossible (e.g. because we end up having two sequential mutations that change to the same state). I guess we can zap the mutation parents and re-make them, and then if we fail when remaking, so be it - we just warn the user in the docs that it isn't always possible? |
Oh, right. Yes, I like this suggestion, and we could even ask the user to open an issue if it's something they actually need to do. |
Sounds like a plan. We should have a quick check that the mutation parents have actually been set first, though, as we could fail needlessly on tree sequence requirements on a set of tables that has never actually computed the parents in the first place. Easy enough to check |
I've just been working on an algorithm that did some shuffling of mutations around the tree by adding some new rows to the table and deleting a bunch of other rows. Deleting mutations is far too hard at the moment. I tried using variants of @hyanwong's code above couldn't get it to work, and ended up assigning times to all mutations so that they would sort in the correct order and I could then call I think a general Other tables should be easy enough. |
This can now be done by |
With @awohns , we find that we need a function like
ts.delete sites
but which only deletes the mutations at the site, and leaves the site table untouched. This is basically just a slimmed down version of delete_sites, that looks something like the code below.For the moment we will include the function below in tsdate, but it would be nice to get this functionality into tskit, I think. Perhaps it could be done with an extra parameter to the existing
delete_sites
function, or perhaps for didactic reasons we should deprecatedelete_sites
and introducedelete_mutations(site_ids=XXX, delete_site=True)
which does the same as the current delete_sites function? If the latter, I guess in the longer term we could add functionality to delete a specific list of mutations, which need not be all of them at a site, but that's a bit complex and can be kicked down the road.The text was updated successfully, but these errors were encountered: