Hello everyone,
I am trying to model a population of bird on an island undergoing population contraction. To do so, I use tree-sequence recording to avoid burn-in phase. After a small period of 100 years, I introduce a new beneficial mutation in half of the haplosomes of the individuals of age 0 (as I can't modify age > 0).
Afterward, I spatially explicitly sample the individuals that i want, so that I only have to recapitate and overlay mutations for the individuals I'm interested in.
Next, I load everything into python to output a vcf containing my 17 individuals. However, after simulation, I get absolutely no signal of the sweep (like higher FST around the mutation, or extended haplotypes). Is there something I am doing wrong? I can provide any other useful information if needed.
Thank you for your help!
Best,
Samuel
Here is the code used. I have removed some unnecessary chunks for clarity, but left a "removed" note where they should be. I can of course provide them if needed!
initialize() {
initializeSLiMModelType("nonWF");
initializeSLiMOptions(dimensionality="xy");
initializeSex();
initializeTreeSeq();
// mutations
initializeMutationType("m1", 0.5, "f", 0.0); // non-coding
initializeMutationType("m2", 0.5, "f", 0.1); // beneficial
initializeGenomicElementType("g1", m1, 1); // exon
initializeGenomicElementType("g2", m1, 1); // intron
initializeGenomicElementType("g3", m1, 1); // NC
//Genomic structure
initializeChromosome(1);
//Removed realistic genetic structure
initializeMutationRate(0);
initializeRecombinationRate(3e-8);
initializeChromosome(2);
//Removed realistic genetic structure
initializeMutationRate(0);
initializeRecombinationRate(3e-8);
//Parameters
//Removed ecological parameters
//Interaction types
//Removed interactions
}
//Removed reproduction and modifiy child callbacks
1 early() {
sim.addSubpop("p1", pop);
p1.setSpatialBounds(c(0,0,700,800)); //Spatial bounds of the pop
map_image=Image("../mauritius2.png");
p1.defineSpatialMap("island","xy",1.0-map_image.floatK, valueRange=c(0.0,1.0),colors=c("cyan","forestgreen"));
p1.individuals.setSpatialPosition(p1.pointUniformWithMap(pop,"island"));
p1.individuals.age=sample(age_structure,pop,replace=T); //Realistic age structure for starter
}
//Introduction of the beneficial mutation
100 late() {
//Introduction of the sweep. I can only add new mutations to age 0 individuals
age0=p1.subsetIndividuals(minAge=0,maxAge=0);
nhaplo=asInteger(size(age0)*0.1);
target=sample(age0.haplosomesForChromosomes(2), nhaplo);
target.addNewDrawnMutation(m2, 10000000);
}
101 early(){
//Population and map reduction
}
162 early(){
//Population and map reduction
}
199 early(){
//Population and map reduction
}
265 early(){
//Population and map reduction
}
323 early(){
//Population and map reduction
}
//Death and fitness recalculation
//Happens last, after deforestation and moving
2: early() {
//Divide pop to kill a certain percentage
off=p1.subsetIndividuals(minAge=0,maxAge=0);
iv1=p1.subsetIndividuals(minAge=1,maxAge=1);
iv2=p1.subsetIndividuals(minAge=2,maxAge=2);
//Choose dying individuals
prob_die=c(max(0.0,min(1.0,rnorm(1,0.4,0.05))),
max(0.0,min(1.0,rnorm(1,0.05,0.05))),
max(0.0,min(1.0,rnorm(1,0.05,0.05))),
1.0);
off_dead=sample(off, asInteger(off.size()*prob_die[0]) );
iv1_dead=sample(iv1, asInteger(iv1.size()*prob_die[1]) );
iv2_dead=sample(iv2, asInteger(iv2.size()*prob_die[2]) );
sim.killIndividuals(c(off_dead,iv1_dead,iv2_dead,p1.subsetIndividuals(minAge=3)));
//Density-dep selection
i1.evaluate(p1);
inds = sim.subpopulations.individuals;
inds.fitnessScaling=1/(1+i1.totalOfNeighborStrengths(inds)); //Fitness divided proportionnaly to the number of neighbors
}
//Individual recording
128 late(){ // Year is 1800
//We sample in a small region
cand=p1.individuals[p1.individuals.x>300&p1.individuals.x<370&p1.individuals.y>(800-380)&p1.individuals.y<(800-319)];
//Check if there are individuals inside the area
if(size(cand)<1){
catn("Reached 0, stopping");
sim.simulationFinished();}
to_save=sample(cand, 1);
sim.treeSeqRememberIndividuals(to_save);
}
198 late(){ // Year is 1870
cand=p1.individuals[p1.individuals.x>300&p1.individuals.x<370&p1.individuals.y>(800-380)&p1.individuals.y<(800-319)];
//Check if there are individuals inside the area
if(size(cand)<7){
catn("Reached 0, stopping");
sim.simulationFinished();}
to_save2=sample(cand, 7);
sim.treeSeqRememberIndividuals(to_save2);
}
343 late(){ //We stop in 2015
to_save3=p1.sampleIndividuals(9);
sim.treeSeqRememberIndividuals(to_save3);
sim.killIndividuals(p1.individuals);
sim.treeSeqOutput(paste0("./"+folder+"/trees/"+out+".trees")); sim.simulationFinished();
}