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

Seg Site difference with 'ghost' unsampled pops compared to ms #121

Closed
stsmall opened this issue Aug 21, 2018 · 2 comments
Closed

Seg Site difference with 'ghost' unsampled pops compared to ms #121

stsmall opened this issue Aug 21, 2018 · 2 comments
Labels
Milestone

Comments

@stsmall
Copy link

stsmall commented Aug 21, 2018

Hi @paulstaab,
I was attempting to understand the affect of admixture on the SFS, when I came across an inconsistency (likely my misunderstanding) between ms and scrm. If I run the following code:

scrm 20 100 -t 142 -r 195 10001 -I 3 0 20 0 -n 2 0.5 -n 3 0.25 -es 0.08 2 .2 -en 0.08 4 .025 -ej 0.08 4 1 -ej 0.08 2 3 -ej 1 1 3
avg segsites scrm: 176

ms 20 100 -t 142 -r 195 10001 -I 3 0 20 0 -n 2 0.5 -n 3 0.25 -es 0.08 2 .2 -en 0.08 4 .025 -ej 0.08 4 1 -ej 0.08 2 3 -ej 1 1 3
avg segsites ms: 466

If I change the code to -I 3 20 20 20, the results are the similar: ms=930, scrm=896

Is this something I am misunderstanding?
thank you,
@stsmall

@paulstaab
Copy link
Member

Thanks for the report and sorry that scrm does not seem to work correctly here.

It looks like it is sorting the events at time 0.08 in the wrong order:

scrm 20 100 -t 142 -r 195 10001 -I 3 0 20 0 -n 2 0.5 -n 3 0.25 -es 0.08 2 .2 -ej 0.08 2 3 -ej 0.08 4 1 -ej 1 1 3 --print-model
[...]
At Time 3200:
 Population Sizes:      10000      5000      2500     10000
 Growth Rates:              0         0         0         0
 Migration Matrix: 
         0         0         0         0
         0         0         0         0
         0         0         0         0
         0         0         0         0
 100% of pop 2 move to pop 3
 80% of pop 2 move to pop 4
 100% of pop 4 move to pop 1
[...]

so that no lines are moved to pop 4. I confirmed this by removing the -ej 0.08 4 1. Then, scrm continues to work, which it shouldn't because lines in pop 3 & 4 can not merge anymore if any lines are assigned to pop 4.

I will look into why this happens, but this may take a while.

I the meanwhile, you can use the -eps argument of scrm. The command

scrm 20 100 -t 142 -r 195 10001 -I 3 0 20 0 -n 2 0.5 -n 3 0.25 -eps 0.08 2 1 .2 -ej 0.08 2 3 -ej 1 1 3 --print-model

produces

At Time 3200:
 Population Sizes:      10000      5000      2500
 Growth Rates:              0         0         0
 Migration Matrix: 
         0         0         0
         0         0         0
         0         0         0
 80% of pop 2 move to pop 1
 100% of pop 2 move to pop 3

and numbers of segsites that look comparable with ms.

Hope this helps!

Best wishes,
Paul

@paulstaab
Copy link
Member

Note for myself: Model::addSingleMigrationEvent stores all events in a matrix for each time point, and thereby causes the events to be executed in basically random order. This needs to be reworked completely.

@paulstaab paulstaab added the bug label Nov 17, 2018
@paulstaab paulstaab added this to the Version 1.7.3 milestone Nov 17, 2018
paulstaab added a commit that referenced this issue Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants