|
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 dictvs block2 = gemmi.cif.read('./3gqc.cif').sole_block()
block2.get_mmcif_category('_pdbx_unobs_or_zero_occ_residues')
# output: dict with actual dataEdit: len(list(block1))
# output: 48
len(list(block2))
# output: 238Can we create structure from cif document, modify it (say delete some residues) and save new cif with all values of original cif present? |
Answered by
wojdyr
Dec 16, 2021
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) |
5 replies
Answer selected by
hlvlad
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_docto preserve Document.)Then, after changing the structure, you can modify only selected categories in cif: