Skip to content

Error in sim_mutations: "AttributeError: 'generator' object has no attribute 'tables'" #2029

Answered by alanrogers
alanrogers asked this question in Q&A
Discussion options

You must be logged in to vote

I think I found an anwer to my own question. When sim_ancestry is called without num_replicates, it returns a value of type tskit.trees.TreeSequence:

>>> ts = msp.sim_ancestry(2, sequence_length=100, random_seed=1234)
>>> type(ts)
<class 'tskit.trees.TreeSequence'>

But when it's called with num_replicates, it returns a value of type generator:

>>> ts = msp.sim_ancestry(2, sequence_length=100, random_seed=1234, num_replicates=2)
>>> type(ts)
<class 'generator'>

sim_mutations wants a value of the former type, not a generator.

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@alanrogers
Comment options

@jeromekelleher
Comment options

@alanrogers
Comment options

@benjeffery
Comment options

@jeromekelleher
Comment options

Answer selected by alanrogers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants