Skip to content

Commit 8d615be

Browse files
committed
[estimate] fix monomorphic sites instead of exiting
1 parent 1aa7700 commit 8d615be

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

smcpp/data_filter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ def run(self, c):
113113
np.all(c.data[:, 2::3] == c.data[:, 3::3], axis=1) &
114114
np.any(c.data[:, 3::3] > 0, axis=1))
115115
if np.any(nonseg):
116-
logger.error("In file %s, observations %s:", c.fn, np.where(nonseg)[0])
117-
logger.error("Data set contains sites where every "
118-
"individual is homozygous for the derived allele. "
119-
"Please recode these as non-segregating (homozygous ancestral).")
120-
raise RuntimeError("data validation failed")
116+
logger.debug("In file %s, observations %s:", c.fn, np.where(nonseg)[0])
117+
logger.debug("Data set contains sites where every "
118+
"individual is homozygous for the derived allele.")
119+
a = c.data[nonseg, 1::3]
120+
a[a >= 0] = 0
121+
c.data[nonseg, 2::3] = 0
121122
bad = (c.data[:, 0] <= 0 |
122123
np.any(c.data[:, 1::3] > c.a[None, :], axis=1) |
123124
np.any(c.data[:, 2::3] > c.data[:, 3::3], axis=1) |

0 commit comments

Comments
 (0)