bodkan / slendr

Population genetic simulations in R 🌍
https://bodkan.net/slendr
Other
54 stars 5 forks source link

Implement experimental support for the tspop algorithm #145

Closed bodkan closed 10 months ago

bodkan commented 10 months ago

See this for more details: https://tspop.readthedocs.io/en/latest/index.html

The release of tspop is extremely convenient for several of our local projects which are happening right now.

With this PR I'm adding super experimental support for tspop (a new ts_tracts() function) because a) I really need this now, b) I'm fine developing and fixing things as they pop up in active use by students over the coming weeks.

A stable version of ts_tracts() will become part of the next major version of slendr, whenever that happens.

If you stumbled upon this PR by accident, note that you shouldn't be using ts_tracts() in your work unless you're OK with things breaking under your feet. I'll link to a relevant GitHub issue to discuss the details of this soon.

Among other things, there are some non-trivial changes that need to happen at both msprime() and slim() levels in slendr and this PR only adds the barest minimum of things in order to make this work at the msprime() level. The tract extraction works for toy models, but I still have to figure out some things to make everything work for all models in the general case.

petrelharp commented 10 months ago

woot! Check it out, @gtsambos!

bodkan commented 10 months ago

Haha, you have eyes everywhere, @petrelharp! :)

I was trying to sneak this in without anyone noticing at first because I wanted to avoid embarrassment in case I got something very wrong (I probably did). :D There are things I don't understand yet and having an experimental R wrapper inside slendr makes it much easier for me to play around with your algorithm and understand how to use it and how to link to it on the slendr side.

In case you're interested to see my experiments with this in R, I have a "hidden" vignette that's not yet linked from the main docs here. :) I've been collecting notes and questions and have been planning to ping you and @gtsambos once I figure out the basics, fix things which are still broken (broken on my end, that is), and can ask reasonably informed questions.

It's hard to overstate how important and useful tspop is for us here! Until you published it, I had to resort to complicated hacks using SLiM which are not generalizable... Now our students can do projects which used to be tricky to do with only a few lines of code! 👏 But I'll tell you more about it all later. ;)

petrelharp commented 10 months ago

That's great to hear! I just saw this because of github notifications (which I mostly miss...).

Until you published it,

Correction: until @gtsambos published it. =)

bodkan commented 10 months ago

Correction: until @gtsambos published it. =)

This was of course meant to be the plural co-author "you"!!! I'm sorry! 😬


I just left a meeting where I presented tspop to people interested in benchmarking local ancestry inference methods on various complex scenarios... it's really hard to overstat how much of a magic leap forward this is. What used to be days worth of simulations and analyses is now compressed down to a few minutes of coding. It actually took a while to let it sink in. :) Awesome job to @gtsambos and everyone else involved.

Thanks for stopping by! I'll have a couple of questions soon. 😅

gtsambos commented 10 months ago

Woohoo! I'm so excited to see this Martin (and glad to hear tspop has been of help!) Please do ping if there's anything specific I can be of more help with!