Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More helpful record_full_arg errors #2143

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions msprime/ancestry.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,16 @@ def _parse_sim_ancestry(
is_dtwf = isinstance(models[0], DiscreteTimeWrightFisher)
is_pedigree = any(isinstance(model, FixedPedigree) for model in models)

if record_full_arg:
if is_dtwf:
raise ValueError(
"Full ARG recording not supported in DiscreteTimeWrightFisher simulation"
)
if is_pedigree:
raise ValueError(
"Full ARG recording not supported in FixedPedigree simulation"
)

if is_pedigree:
if demography is not None:
raise ValueError("Cannot specify demography for FixedPedigree simulation")
Expand All @@ -919,10 +929,6 @@ def _parse_sim_ancestry(
raise ValueError(
"Gene conversion not supported in FixedPedigree simulation"
)
if record_full_arg:
raise ValueError(
"Full ARG recording not supported in FixedPedigree simulation"
)
if record_migrations:
raise ValueError(
"Migration recording not supported in FixedPedigree simulation"
Expand Down
14 changes: 14 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,20 @@ class TestUnsupportedFullArg:
"""

def test_dtwf(self):
for model in [msprime.DiscreteTimeWrightFisher()]:
with pytest.raises(
ValueError, match="not supported in DiscreteTimeWrightFisher"
):
msprime.sim_ancestry(
10,
model=model,
record_full_arg=True,
)

def test_dtwf_simulate(self):
"""
Old "simulate" command gives a less descriptive error message
"""
for model in [msprime.DiscreteTimeWrightFisher()]:
with pytest.raises(_msprime.LibraryError):
msprime.simulate(
Expand Down