ihmwg / python-modelcif

Python package for handling ModelCIF mmCIF and BinaryCIF files
MIT License
10 stars 1 forks source link

modelcif.associated.LocalPairwiseQAScoresFile path should be relative #17

Closed bienchen closed 2 years ago

bienchen commented 2 years ago

The path used in modelcif.associated.LocalPairwiseQAScoresFile should be relative to the one used in modelcif.dumper.write(), I think.

Imagine I have a directory A with my models. Then I read the data needed for the ModelCIF file from A and I also want to write the file to A/model1.cif, A/model2.cif, .... If I create associated files for the local pairwise scores, I would like to write them to A, also. That means

modelcif.associated.LocalPairwiseQAScoresFile("A/model1_local_pae.cif", ...)

which stores the associated file in the right directory, but gives me

_ma_entry_associated_files.file_url A/model1_local_pae.cif

while I think that should be

_ma_entry_associated_files.file_url model1_local_pae.cif

without pointing to a subdirectory A/A.

Of course I can achieve this by cding into A before writing but that is inconvenient.

Or do I oversea an easy way to get this?

benmwebb commented 2 years ago

Well, what if when you deposit the file you do put it in the A subdirectory? python-modelcif has no way to know either way - it would be surprising to the user if it just ignored the path provided (as usually this is intended to be part of the URL). One option for CifFile subclasses would be to allow providing a different path for the local file (and default to the same as the URL path).

We have a more complicated solution for python-ihm, the Repository class, but that's probably overkill here since we generally don't have a lot of these associated files.

bienchen commented 2 years ago

I agree, an additional path parameter sounds the easiest way. Then the URL can be the final location and the path would just be used for writing the file.