Skip to content

make_assembly behaviour change from 0.6.5 to 0.7.5 #410

Description

@jackdent

If I run the following script with this CIF file:

from pathlib import Path

import gemmi


def load_structure(cif_path: Path):
    block: gemmi.cif.Block = gemmi.cif.read(str(cif_path))[0]
    structure: gemmi.Structure = gemmi.make_structure_from_block(block)
    structure.remove_waters()
    structure.transform_to_assembly(
        assembly_name="1",
        how=gemmi.HowToNameCopiedChain.Dup,
    )
    return structure


load_structure(Path("./1AK5.cif"))

On 0.6.5 the file loads successfully, but on 0.7.5 I get RuntimeError: no subchain C:

root@devbox-jack:/workspaces/models# uv pip install gemmi==0.6.5 && python gemmi_test.py 
Using Python 3.11.15 environment at: /opt/venv
Audited 1 package in 3ms
root@devbox-jack:/workspaces/models# uv pip install gemmi==0.7.5 && python gemmi_test.py 
Using Python 3.11.15 environment at: /opt/venv
Resolved 1 package in 1ms
Uninstalled 1 package in 1ms
Installed 1 package in 8ms
 - gemmi==0.6.5
 + gemmi==0.7.5
Traceback (most recent call last):
  File "/workspaces/models/gemmi_test.py", line 17, in <module>
    load_structure(Path("./1AK5.cif"))
  File "/workspaces/models/gemmi_test.py", line 10, in load_structure
    structure.transform_to_assembly(
RuntimeError: no subchain C

Note that if I change the order of removing the waters and transforming assembly, the test case also passes on 0.7.5:

from pathlib import Path

import gemmi


def load_structure(cif_path: Path):
    block: gemmi.cif.Block = gemmi.cif.read(str(cif_path))[0]
    structure: gemmi.Structure = gemmi.make_structure_from_block(block)
    structure.transform_to_assembly(
        assembly_name="1",
        how=gemmi.HowToNameCopiedChain.Dup,
    )
    structure.remove_waters() # N.B. order changed!
    return structure


load_structure(Path("./1AK5.cif"))

Is this change expected? What is the "right" order to call these operations in?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions