Issues with complex demography and old selection events
Closed this issue · 4 comments
I have issues when I try to simulate selection in a complex demographic model (Demographic model of one population experiencing growth and then spliting in 2 subpopulations, which both experience pop growth followed by a sever bottleneck followed by a final episode of pop growth). I get the same complains when try with one single population with selection occurring at any statge older than the begining of the most recent growth phase.
The msms command for the 2 populations model without selection is:
./msms 20 1 -t 2000 -N 1e6 -I 2 10 10 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -ej 6.5e-6 2 1 -Smark
ms 20 1 -t 2000 -N 1e6 -I 2 10 10 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -ej 6.5e-6 2 1 -Smark
//
segsites: 6
positions: 0.00799 0.09204 0.16127 0.50000 0.56513 0.72685
101000
001000
001000
001000
The msms command for the 2 populations model with selection at the most recent step is:
./msms 20 1 -t 2000 -N 1e6 -I 2 10 10 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -ej 6.5e-6 2 1 -Sc 0 1 2e5 1e5 0 -SI 3.3e-6 1 0.001 -Smark
ms 20 1 -t 2000 -N 1e6 -I 2 10 10 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -ej 6.5e-6 2 1 -Sc 0 1 2e5 1e5 0 -SI 3.3e-6 1 0.001 -Smark
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at at.mabs.model.FrequencyState.getFrequency(FrequencyState.java:56)
at at.mabs.model.selection.SelectionData.setFrequencyToEnd(SelectionData.java:255)
at at.mabs.model.ModelHistroy.simulateSelection(ModelHistroy.java:397)
at at.MSLike.run(MSLike.java:299)
at at.MSLike.runThreads(MSLike.java:424)
at at.MSLike.runMe(MSLike.java:191)
at at.MSLike.main(MSLike.java:541)
at at.MSLike.main(MSLike.java:585)
The msms command for the 2 populations model with selection at a latter step (at the time of the split) is:
./msms 20 1 -t 2000 -N 1e6 -I 2 10 10 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -ej 6.5e-6 2 1 -SI 6.5e-6 1 0.001 -Smark
ms 20 1 -t 2000 -N 1e6 -I 2 10 10 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -ej 6.5e-6 2 1 -SI 6.5e-6 1 0.001 -Smark
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at at.mabs.model.FrequencyState.getFrequency(FrequencyState.java:56)
at at.mabs.model.selection.SelectionData.setFrequencyToEnd(SelectionData.java:255)
at at.mabs.model.ModelHistroy.simulateSelection(ModelHistroy.java:397)
at at.MSLike.run(MSLike.java:299)
at at.MSLike.runThreads(MSLike.java:424)
at at.MSLike.runMe(MSLike.java:191)
at at.MSLike.main(MSLike.java:541)
at at.MSLike.main(MSLike.java:585)
The msms command for the simplest model (one single population) with selection at the begining of the most recent growth phase is:
./msms 20 1 -t 2000 -N 1e6 -I 1 20 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -Sc 0 1 2e5 1e5 0 -SI 3.3e-6 1 0.001 -Smark
ms 20 1 -t 2000 -N 1e6 -I 1 20 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -Sc 0 1 2e5 1e5 0 -SI 3.3e-6 1 0.001 -Smark
//
segsites: 7
positions: 0.21031 0.31732 0.42932 0.50000 0.62945 0.80273 0.96672
1000000
0110110
1000000
1000000
1000000
The msms command for the one population with selection at a latter step (at the time of the split) is:
./msms 20 1 -t 2000 -N 1e6 -I 1 20 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -Sc 0 1 2e5 1e5 0 -SI 6.5e-6 1 0.001 -Smark
ms 20 1 -t 2000 -N 1e6 -I 1 20 -G 2.1e6 -eN 3.3e-6 0.001 -eG 3.3e-6 1.1e6 -eN 6.5e-6 0.001 -eG 6.5e-6 7.1e5 -eN 9.8e-06 0.001 -Sp 0.5 -Sc 0 1 2e5 1e5 0 -SI 6.5e-6 1 0.001 -Smark
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at at.mabs.model.selection.SuperFrequencyTrace.getFrequencys(SuperFrequencyTrace.java:142)
at at.mabs.model.selection.SelectionData.getFrequency(SelectionData.java:268)
at at.mabs.model.selection.SelectionData.coalescentCumulantIntegration(SelectionData.java:296)
at at.mabs.coalescent.CoalescentEventCalculator.nextCoalescentSelection(CoalescentEventCalculator.java:361)
at at.mabs.coalescent.CoalescentEventCalculator.nextEventSelection(CoalescentEventCalculator.java:90)
at at.mabs.coalescent.CoalescentEventCalculator.calculateCoalescentHistory(CoalescentEventCalculator.java:520)
at at.MSLike.run(MSLike.java:301)
at at.MSLike.runThreads(MSLike.java:424)
at at.MSLike.runMe(MSLike.java:191)
at at.MSLike.main(MSLike.java:541)
at at.MSLike.main(MSLike.java:585)
We have a workaround. use -SA 1e5 rather than the -Sc option.
Greg, I looked at the -SA option and don't see how to set up the time for the start of selection.
What's the way to start selection at a particular time when using this option?
-SA (The selection strenght for haploids)
Anna
De: Greg [notifications@github.com]
Enviat el: dilluns, 13 / maig / 2013 14:15
Per a: delt0r/msms
Cc: Ferrer Admetlla Anna
Tema: Re: [msms] Issues with complex demography and old selection events (#14)
We have a workaround. use -SA 1e5 rather than the -Sc option.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-17807919.
The -Sc does not specify selection start time either. What -Sc sets is selection strength. -SI sets the start time.
There is also another problem with the -SI option. It need to state the number of demes at that time. In this case its 2. -ej options does not reduce the deme count.