Skip to content

Commit 6fa7a41

Browse files
committed
fix #545, calcMeanFroh() does the wrong thing in multichrom models
1 parent a6cd141 commit 6fa7a41

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ development head (in the master branch):
1818
calcFST() with a windowed range (start/end) would error; was missing a unit test (#548)
1919
calcSFS() with an integer (non-NULL) binCount would error in multi-chromosome models if mutations from multiple chromosomes (or NULL) were given
2020
survival() callback that moves individuals did not correctly update has_null_haplosomes_, leading to a crash or a DEBUG raise (#549)
21+
calcMeanFroh() did not focus on the specified chromosome correctly, in multi-species models, and thus produced incorrect results (#545)
2122

2223

2324
version 5.0 (Eidos version 4.0):

core/slim_functions.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,14 @@ R"V0G0N({
261261
262262
for (chr in chromosomes)
263263
{
264-
// get the haplosomes we will operate over
264+
// get the haplosomes we will operate over, for the focal chromosome
265265
haplosomes = individual.haplosomesForChromosomes(chr, includeNulls=F);
266266
267267
if (haplosomes.length() != 2)
268268
next;
269269
270-
het_pos = individual.mutationsFromHaplosomes("heterozygous").position;
270+
// get the mutations that are heterozygous, for the focal chromosome
271+
het_pos = individual.mutationsFromHaplosomes("heterozygous", chromosomes=chr).position;
271272
het_pos_1 = c(-1, het_pos);
272273
het_pos_2 = c(het_pos, chr.lastPosition + 1);
273274
roh = (het_pos_2 - het_pos_1) - 1;

0 commit comments

Comments
 (0)