ihmwg / python-ihm

Python package for handling IHM mmCIF and BinaryCIF files
MIT License
14 stars 7 forks source link

Expose model_id #121

Closed aozalevsky closed 1 year ago

aozalevsky commented 1 year ago

model_id is a useful attribute, especially when the validation is performed by external software (like MolProbity). It would be nice to have it exposed.

I believe the dictionary doesn't require the models to be sorted, thus depth-first enumeration (state groups/states/model groups/model) might return the numbering different from the file.

As a side note, the majority of tables have model_id but _atom_site has ihm_model_id and pdbx_PDB_model_num. Wouldn't it be easier to unify the definition with majority of tables havemodel_idbut_atom_sitehasihm_model_idandpdbx_PDB_model_num` since it's required by the core dictionary?

benmwebb commented 1 year ago

The model ID is already available, as are the IDs of all python-ihm objects that correspond to mmCIF tables, in the standard Python "semi-private, for advanced users only" fashion with an underscore prefix, i.e. Model._id. So you can certainly display that if you like or even sort by it (although most IDs in mmCIF are not required to be integers).