Closed bienchen closed 2 years ago
I think your fix for is_polymer()
should be fine. I'll commit a fix. A single-residue entity is likely so rare in regular usage that I doubt anything will break[*], but we should do what PDB does.
[*] Lots of ihm (and probably ma) categories only work with polymeric entities. For example a cross-link cannot be made to a non-polymer since it uses seq_id
which is only defined for polymers. But a cross-link (or a model of any kind) involving single-residue entities probably makes no sense anyway.
I tested the fix and it works as expected (I prepared unit tests for all cases with my lazy fix). Thanks a lot for the fast response!
I do compare mmCIF files generated with
python-ihm
against PDB entries, as a test. Now I stumbled up on theentity.type
of a single glycine as a compound in PDB entry 3LMS. In the PDB mmCIF file, the glycine is marked as non-polymer entity. Therefore it has apdbx_entity_nonpoly
entry and noentity_poly
entry. In thechem_comp
category, it's marked as 'peptide linking'. When I runpython-ihm
to write a mmCIF file with a single glycine, its marked as polymer, gets an entry inentity_poly
and nopdbx_entity_nonpoly
. I would expectpython-ihm
to handle entities the same way as the PDB does.Here is an example to reproduce the behaviour:
The second half of the example writes the mmCIF file as I would expect it by overriding
ihm.Entity.is_polymer()
, but I'm not sure if this does not break the scheme at a different place.