From fd0b2986f6110823f5f29cfd4ca706c4527c5794 Mon Sep 17 00:00:00 2001 From: Jamie Rowe Date: Fri, 23 Oct 2026 11:06:09 +0100 Subject: [PATCH] Add CIF format PR MDAnalysis/mdanalysis#4712 added an mmCIF reader and parser registered as CIF, CIF.GZ, MMCIF and MMCIF.GZ, which caused the userguide to fail with KeyError: 'CIF'. - add a CIF entry to DESCRIPTIONS - add `.upper` to format dictionary key selection to avoid having to define entries for cif.gz, mmcif and mmcif.gz --- doc/source/scripts/core.py | 1 + .../scripts/gen_format_overview_classes.py | 2 +- .../test_gen_format_overview_classes.ambr | 56 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/doc/source/scripts/core.py b/doc/source/scripts/core.py index 9b1455a50..37f2356f8 100644 --- a/doc/source/scripts/core.py +++ b/doc/source/scripts/core.py @@ -4,6 +4,7 @@ DESCRIPTIONS = { "CHEMFILES": "use readers from `chemfiles `_ library", + "CIF": "PDBx/mmCIF file", "CRD": "CHARMM CARD file", "CONFIG": "DL_Poly CONFIG file", "COOR": "NAMD binary restart file", diff --git a/doc/source/scripts/gen_format_overview_classes.py b/doc/source/scripts/gen_format_overview_classes.py index e733f0a9b..25b173223 100644 --- a/doc/source/scripts/gen_format_overview_classes.py +++ b/doc/source/scripts/gen_format_overview_classes.py @@ -46,7 +46,7 @@ def _create_key(fmt: str, handlers: dict[HANDLER_T, Type[Any]]) -> str: if fmt in DESCRIPTIONS: key = fmt else: - key = list(handlers.values())[0].format[0] + key = list(handlers.values())[0].format[0].upper() # raise an informative error if key not in DESCRIPTIONS: diff --git a/doc/source/scripts/tests/snapshot/__snapshots__/test_gen_format_overview_classes.ambr b/doc/source/scripts/tests/snapshot/__snapshots__/test_gen_format_overview_classes.ambr index e9bd3e623..e49e1c26b 100644 --- a/doc/source/scripts/tests/snapshot/__snapshots__/test_gen_format_overview_classes.ambr +++ b/doc/source/scripts/tests/snapshot/__snapshots__/test_gen_format_overview_classes.ambr @@ -13,6 +13,18 @@ '', '', ]), + list([ + ':ref:`CIF `', + 'PDBx/mmCIF file', + '', + '', + ]), + list([ + ':ref:`CIF.GZ `', + 'PDBx/mmCIF file', + '', + '', + ]), list([ ':ref:`CONFIG `', 'DL_Poly CONFIG file', @@ -133,6 +145,18 @@ '', '', ]), + list([ + ':ref:`MMCIF `', + 'PDBx/mmCIF file', + '', + '', + ]), + list([ + ':ref:`MMCIF.GZ `', + 'PDBx/mmCIF file', + '', + '', + ]), list([ ':ref:`MMTF `', 'MMTF file', @@ -291,6 +315,22 @@ '✓', '✓', ]), + list([ + ':ref:`CIF `', + 'PDBx/mmCIF file', + '✓', + '✓', + '✓', + '', + ]), + list([ + ':ref:`CIF.GZ `', + 'PDBx/mmCIF file', + '✓', + '✓', + '✓', + '', + ]), list([ ':ref:`CONFIG `', 'DL_Poly CONFIG file', @@ -459,6 +499,22 @@ '✓', '', ]), + list([ + ':ref:`MMCIF `', + 'PDBx/mmCIF file', + '✓', + '✓', + '✓', + '', + ]), + list([ + ':ref:`MMCIF.GZ `', + 'PDBx/mmCIF file', + '✓', + '✓', + '✓', + '', + ]), list([ ':ref:`MMTF `', 'MMTF file',