-
Hi, I would like to ask, whether data from original cif file is preserved, when we block1 = gemmi.read_structure('./3gqc.cif').make_mmcif_document().sole_block()
block1.get_mmcif_category('_pdbx_unobs_or_zero_occ_residues')
# output: empty dict vs block2 = gemmi.cif.read('./3gqc.cif').sole_block()
block2.get_mmcif_category('_pdbx_unobs_or_zero_occ_residues')
# output: dict with actual data Edit: len(list(block1))
# output: 48
len(list(block2))
# output: 238 Can we create structure from cif document, modify it (say delete some residues) and save new cif with all values of original cif present? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
To preserve Document you can read the structure in two steps: doc = gemmi.cif.read('./3gqc.cif')
structure = gemmi.make_structure_from_block(doc[0]) The same is done internally in Then, after changing the structure, you can modify only selected categories in cif: groups = gemmi.MmcifOutputGroups(False) # False -> start with all groups disabled
groups.atoms = True # enable _atom_site and _atom_site_anisotrop
structure.update_mmcif_block(doc[0], groups) |
Beta Was this translation helpful? Give feedback.
To preserve Document you can read the structure in two steps:
The same is done internally in
read_structure()
, except that Document is not preserved.(Update 2023: you can call read_structure() with option
save_doc
to preserve Document.)Then, after changing the structure, you can modify only selected categories in cif: