Skip to content

Conversation

Aalhad-Bhatt
Copy link

… to run on multiple demes

Code to run a selective sweep based on reading the events from a binary file in a specified format. The C side also implements nearest neighbour migration with multiple demes. This does not interface with the Python version yet.

… to run on multiple demes

Code to run a selective sweep based on reading the events from a binary file in a specified format.  The C side also implements nearest neighbour migration with multiple demes. This does not interface with the Python version yet.
… to run on multiple demes

Code to run a selective sweep based on reading the events from a binary file in a specified format. The C side also implements nearest neighbour migration with multiple demes. This does not interface with the Python version yet.
@jeromekelleher
Copy link
Member

Wow, this looks great @Aalhad-Bhatt! I'll need to spend some time with it, but from a first glance it looks like you've done an excellent job.

We are trying to get version 1.4 shipped (https://github.com/tskit-dev/msprime/milestone/19), so I think what we'll do is get that out the door as soon as possible and then focus on merging this in, and figuring out the next steps.

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have to remove the reliance on a file before we can merge here @Aalhad-Bhatt as the code is currently untestable and we'll end up doing a bunch of work to accomodate the file pattern than we later undo.

For the first pass, I think what we want is

  1. Remove the reliance on a file, where we pass in the arrays when we call set_simulation_model., which we take copies of.
  2. For the C tests, we just need some example trajectories that'll help us test the code. Nothing realistic is needed.

Given that, I think It would be easier to back out of the Python level changes for the moment, and try and get the C side of things basically ironed out. If we have full test coverage on the new code, then I think we can merge happily enough as it doesn't affect other models.

Following that, we can then add Python support and perhaps some ways of generating useful trajectories from Python.

Does this sound like a good path?

msp_set_node_mapping_block_size(&msp, 65536);
msp_set_segment_block_size(&msp, 65536);

ret = msp_set_simulation_model_sweep_genic_selection_reverse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, here instead of passing in the filename we would pass parameters required to describe the sweep.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the C code tests we won't need anything realistic, just some way of generating trajectories that'll test all the different code paths.


typedef struct _sweep_reverse_t {
double position;
const char *filename;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we need to include the paramters required to describe the sweep, so from your code above:

1. Number of steps
2. Number of demes
3. Pop size
4. Migration rate
5. State after finishing the backward sim
6. state at the start of the backward sim
8. Time, type, and start and end locations for each event

So, I think 1-6 are just standard variables and the you have 4 arrays to describe the events? This would looks something like

typedef struct _sweep_reverse_t {
    double position;
    // other params
    tsk_id_t *end_deme;
}

So, the struct holds pointers, which we can fill in with arrays later as needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super helpful. Thanks!

Folder notebooks, with forward sim and sample file
Folder notebooks, with forward sim and sample file
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

Successfully merging this pull request may close these issues.

2 participants