compact

zombi2 tools compact DIR converts a run's per-family files to the compact layout that --compact writes (Appendix B). zombi2 tools expand DIR converts the compact files back to per-family files. Neither simulates anything again.

DIR is a run directory, or a level directory such as out/genomes/. Both tools look in DIR, DIR/genomes/ and DIR/sequences/.

The conversion is exact: the files written are byte for byte the files the run would have written in the other layout. Each tool reads back the files it wrote and compares them with the source files. If they differ, it removes what it wrote and stops with an error. The source files stay unless you pass --remove, which removes them after that check.

expand --flat writes the per-family files beside the compact file, as a --flat run does. compact also finds the per-family files of a --flat run, with no extra flag.

An output can be present in both layouts, for example after expand without --remove. If the two hold the same data, the tools accept that output. If they differ, the tools stop with an error, because nothing in the files says which layout belongs to the run.

From Python, the tools are zombi2.tools.compact.compact_run(directory, remove=False) and expand_run(directory, flat=False, remove=False).

# compact a run, then remove the per-family files
zombi2 tools compact out/ --remove

# per-family files again, for a program that reads one file per family
zombi2 tools expand out/

The old names --bundle, bundle=True, zombi2 tools bundle, zombi2 tools unbundle, zombi2.tools.bundle.bundle_run and zombi2.tools.bundle.unbundle_run still work in 0.52.1. Each prints a warning naming its replacement. The next release will remove them.