Closed gtauriello closed 2 years ago
Right, the magic only happens for associated CIFFile
s at the top level. The assumption is if you specify a zip file that you've made that zip file yourself and you don't want python-modelcif to modify or overwrite it. But this could be certainly be changed for CIFFile
s inside ZipFile
to
(1) probably makes little sense since you've already specifically requested via categories
or copy_categories
to write out a file. (2) would be easy to do. (3) would be a bit more involved and I'm a bit reluctant to have too much happen "magically", but we could perhaps make that configurable.
I like option (2). That's what would have been my expected behaviour.
(3) sounds nice as well but it wouldn't really remove much complexity for the user. It's trivial enough to take a few files and package them into a zip-file instead of the library having to make assumptions and guesses on the desired behaviour.
@benmwebb it is awesome that one can add a modelcif.associated.LocalPairwiseQAScoresFile into an modelcif.associated.Repository and the dumper just magically splits the cif file and generates the desired QA file. One issue I observed now though is that this writing doesn't happen if there is a ZipFile in between (which unfortunately is the usecase we have in ModelArchive where all associated files are in a package).
So essentially if you have a LocalPairwiseQAScoresFile
qa_file
and you add it directly into a Repository as in the code below it works as intended and splits up the cif file into two files (output.cif and output_qa.cif)The code below on the other hand doesn't generate the two files due to the ZipFile in between
I modified the mkmodbase example to make a showcase of it which is attached here: mkmodbase-zip.py.zip At line 216 there you can pick whether to add the into a directly or have a ZipFile in between.
Am I doing something wrong or is there a bug somewhere?