Msprime: TableCollection pickle not passing valid tree sequence

Created on 15 Aug 2018  路  4Comments  路  Source: tskit-dev/msprime

Some issue with round tripping TableCollections through pickle:

import msprime
import pickle

ts = msprime.simulate(10, random_seed=2)
x = pickle.dumps(ts.tables)
tables = pickle.loads(x)
# tables is OK
ts = t2.tree_sequence() # Fails

Thanks to @molpopgen for pointing it out.

bug

All 4 comments

I get a different error. I just pip3 install --upgrade msprime a few minutes ago.

import msprime
import pickle

ts = msprime.simulate(10,mutation_rate=10,recombination_rate=10)
p = pickle.dumps(ts.tables)
python3 pickle_tables.py 
Traceback (most recent call last):
  File "pickle_tables.py", line 5, in <module>
    p = pickle.dumps(ts.tables)
TypeError: can't pickle _msprime.TableCollection objects

Yes, that makes much more sense, basically pickle wasn't implemented at all. I'm guessing you're on a newer version of Python than me, which gives a better error.

I'm implementing over in #577. Should be released in a week or so.

I'm on 3.6.5.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ismael-mendoza picture ismael-mendoza  路  7Comments

jeromekelleher picture jeromekelleher  路  3Comments

eldonb picture eldonb  路  5Comments

jeromekelleher picture jeromekelleher  路  8Comments

jeromekelleher picture jeromekelleher  路  11Comments