late() {
indv = p1.individuals;
allele1 = indv.haploidGenome1.mutations;
allele2 = indv.haploidGenome2.mutations;
homozygous = allele1 == allele2;
// TODO: optimize
homCount = integer(N);
for (i in seqLen(N)) {
homCount[i] = sum(homozygous[(6 * i):(6 * i + 5)]);
}
indv.fitnessScaling = (1 - s) ^ homCount;
}
The logic is I get two vectors, allele1 and allele2, containing the 6 alleles of all individuals in their haploidGenome1 and haploidGenome2, respectively. Then, I compare these vectors to see whether each individual is homozygous in each of the six loci and count the number of homozygous loci for each individual.
My end goal is simply to count the number of homozygous loci by individual, but this for-loop is taking really long to run. Is there a way to vectorize this operation? I thought of using a matrix, but I didn't find a way to make a vectorized marginal sum, so it didn't remove the need for the loop.
Thanks in advance,
AM
The dominanceCoeff parameter supplies the default dominance coefficient for the mutation type, for all traits; 0.0 produces no dominance, 1.0 complete dominance, and values greater than 1.0, overdominance.
--
SLiM forward genetic simulation: http://messerlab.org/slim/
Before posting, please read http://benhaller.com/slim/bugs_and_questions.html
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/slim-discuss/73f2ff78-5d6d-4a93-b53e-7471c294cd48n%40googlegroups.com.