ramachandran-lab / SWIFr

Sweep Inference Framework (controlling for correlation)
GNU General Public License v3.0
28 stars 4 forks source link

Aboout cosi simulation #18

Closed Moxsf closed 3 years ago

Moxsf commented 3 years ago

Sorry to bother you.

I have a question about simulating hap_file with the cosi package.

I would like to re-model HAP files to calculate the fractional distribution and then SWIF(r), but some parameter files have been simulated for a long time without results when using coalescent (more than 15 days, I'm a little bit devastated). This is my own parameter file problem, or would some parameters could not be simulated anyway.

I find the parameter of sweep time is the main reason. I use the sweep time divide 25(25 years per generation) to get the sweep generations.

This is my parameter file: # sample file # comments have #s in front of them # newlines don't matter.

#-- options that could be uncommented #infinite_sites yes #random_seed 12345 # Specifies a particular random number seed #number_mutation_sites 2000 # Fixed number of mutation sites

# in bp. length 1000000

# per bp per generation mutation_rate 1.5e-8

recomb_file model.test gene_conversion_rate 4.5e-9

# population info pop_define 1 european pop_define 2 asian pop_define 3 african

#european pop_size 1 7700 sample_size 1 120

#asian pop_size 2 7700 sample_size 2 120

#african pop_size 3 24000 sample_size 3 120

# Migration start pop_event migration_rate "afr->eur migration" 3 1 1505. .000032 pop_event migration_rate "eur->afr migration" 1 3 1504 .000032 pop_event migration_rate "afr->as migration" 3 2 1503. .000008 pop_event migration_rate "as->afr migration" 2 3 1502 .000008

# Migration end pop_event migration_rate "afr->eur migration" 3 1 1996 0 pop_event migration_rate "eur->afr migration" 1 3 1995 0 pop_event migration_rate "afr->as migration" 3 2 1994 0 pop_event migration_rate "as->afr migration" 2 3 1993 0

# Recent Bottlenecks pop_event bottleneck "african bottleneck" 3 1997 .008 pop_event bottleneck "asian bottleneck" 2 1998 .067 pop_event bottleneck "european bottleneck" 1 1999 .02

# Population splits pop_event split "asian and european split" 1 2 2000 pop_event split "out of Africa" 3 1 3500

# Out-of-africa bottleneck pop_event bottleneck "OoA bottleneck" 1 3499 .085

#Ancestral expansion pop_event change_size "agriculture - african" 3 17000 12500

pop_event sweep "selective sweep" 1 800 0.0083 0.5 0.2

image

lasugden commented 3 years ago

I think your issue might be in the sweep simulation, like you said. If I recall correctly, the second input (where you have 800) should be the time of the end of the sweep (i.e. the most RECENT generation). In our simulations, we wanted the sweep to continue to the present, so this number was 1. The other parameters (selection strength and frequency at end of sweep) will determine how far back in time the sweep goes -- if this time ends up overlapping with other demographic events, this can cause problems in cosi. That would be my best guess at what's going on, but you may want to reach out to the folks who wrote cosi if you are still having issues. We have also been using slim (https://messerlab.org/slim/) for simulations recently -- you could check that out as an alternative!

Moxsf commented 3 years ago

Thanks for your help. That is my misunderstanding about the sweep time setting in the parameters.