Comments (6)
I think this makes sense @petrelharp, and can be tried without needing to make any changes internally to msprime. I guess msprime could provide a function remap_coordinates(ts, recombination_map)
which does what you describe, if it works. You can then recapitate with the output of remap_coordinates
(this is better than doing this internally within msprime.simulate
I think, because the interface is already complex enough).
Unfortunately I don't have time to work on this at the moment though.
from pyslim.
Sounds good. I don't have time to do this quite at the moment either, but can populate an issue over at msprime with our notes on this process if someone else wants to start on it.
from pyslim.
This problem should go away entirely after msprime 1.0.
from pyslim.
So far, we haven't been able to see how to do this without major replumbing under the msprime
hood.
But, as I write this...
The basic problem is that the recombination breakpoints output by SLiM may not match the possible recombination breakpoints that msprime will use. Because of how msprime works under the hood, they have to. But, we could
- make a maximally-fine-but-still-discrete recombination map in msprime
- remap the breakpoint positions in the input tree sequence to their nearest smaller position in the msprime map
- warn/error if this has moved any breakpoints more than some distance or has caused anything else bad to happen
- proceed with recapitation
Perhaps steps 2 and 3 would be a method that would take a tree sequence and a recombination map. This should work just fine, moving breakpoints by no more than something very small unless there are regions with zero recombination rate. At first I thought it should be in pyslim
because you're doing something not-quite-right with a tree sequence that is mostly useful for SLiM->msprime; but actually you'd run into the same problem if you tried to do msprime.simulate(... from_ts=ts)
with a ts
that was made with a different recombination map.
What do you think, @jeromekelleher? Does this, vaguely, make sense?
from pyslim.
This has been possible since 1223afd (?)
from pyslim.
This has been possible since 1223afd (?)
True - you can pass in a recombination map - the thing quoted above was saying that it's not always possible to have exactly the same recombination map, for reasons related to discretization.
But - not an issue any more. I'll close this and open an issue saying that we should document this or give an example.
from pyslim.
Related Issues (20)
- recapitating merged trees HOT 9
- add VCF example to tutorial
- recapitate has surprisingly small diversity if WF simulation is started and saved in `late` HOT 7
- release tasks
- tsinfered tree sequences don't have 'type' key in top-level metdata but `set_tree_sequence_metadata` expects they do
- provide example of annotating existing mutations
- test on annotating tsinfer'ed tree sequence
- recapitation root time auto-adjust fails with root times > 1e5, resulting in an `msprime.InputError` HOT 2
- release tasks
- Annotating tree sequence with pre-existing (node) metadata can lead to erroneous metadata HOT 1
- AttributeError in jsonschema HOT 3
- edges are lost from tree sequence after SLiM step HOT 6
- Potential to use .frequencies() method in /tutorial.html
- update quickreference list at top of docs
- default sex ratio 0.0 HOT 1
- Discrepancies in diversity after recapitation and mutation overlay HOT 1
- Recapitation for complex demography with populations that died out HOT 11
- Strange warning in recapitation HOT 2
- Typo in `recapitate` function docstring HOT 1
- :meth: is not working in documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyslim.