Skip to content

New time_units field breaks compression #54

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

Closed
rwaples opened this issue Jan 17, 2022 · 5 comments
Closed

New time_units field breaks compression #54

rwaples opened this issue Jan 17, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@rwaples
Copy link

rwaples commented Jan 17, 2022

Great utility, but I recently ran into an error when trying to use the tszip.compress function within a Python script. It seems to occur even on super simple, just simulated tree-sequences.

The error:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/home/kele/anaconda3/envs/testenv/lib/python3.10/site-packages/tszip/compression.py", line 97, in compress
    compress_zarr(ts, root, variants_only=variants_only)
  File "/home/kele/anaconda3/envs/testenv/lib/python3.10/site-packages/tszip/compression.py", line 239, in compress_zarr
    ).compress(root, compressor)
  File "/home/kele/anaconda3/envs/testenv/lib/python3.10/site-packages/tszip/compression.py", line 127, in compress
    shape = self.array.shape
AttributeError: 'str' object has no attribute 'shape'

I can recreate the error via:

conda create --name testenv msprime tszip --channel conda-forge
conda activate testenv
python -c """import msprime
import tszip
ts = msprime.simulate(10, random_seed=1)
tszip.compress(ts, 'simulation.trees.tsz')"""

This env has Python 3.10.2, msprime 1.1.0, and tszip 0.2.0

Edit: I don't seem to see this problem with tszip v0.1.0

@jeromekelleher jeromekelleher added the bug Something isn't working label Jan 18, 2022
@jeromekelleher
Copy link
Member

I can reproduce this.

@benjeffery - any idea what's happening here?

@benjeffery
Copy link
Member

I can reproduce this.

@benjeffery - any idea what's happening here?

I've narrowed this down to upgrading tskit to 0.4.0. Looking into it.

@benjeffery
Copy link
Member

Ah-ha. We added a string to the top-level of the kastore: time_units and tszip does not like this at all.

@benjeffery benjeffery changed the title Error when using tszip New time_units field breaks compression Jan 20, 2022
@benjeffery
Copy link
Member

@rwaples We've just released version 0.2.1 which should fix this. Upgrade with pip install --upgrade tszip. Thanks again for the report.

@rwaples
Copy link
Author

rwaples commented Jan 31, 2022

Thanks for the quick fix. 0.2.1 works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants