Closed dargen3 closed 1 month ago
Thanks for the report! I will look into it tomorrow
Unrelated to this bug, in general I recommend setting the structure directly to file to be written, as set_structure()
does not only set atom_site
, but also struct_conn
(and chem_comp_bond
if include_bonds=True
).
import biotite.structure.io.pdbx as mmCIF
import biotite.structure as structure
import hydride
mmCIF_file = mmCIF.CIFFile.read("9bfl.cif")
protein = mmCIF.get_structure(mmCIF_file,
model=1,
extra_fields=["charge"],
include_bonds=True)
protein = protein[protein.element != "H"] # remove all hydrogens
protein_with_hydrogens, _ = hydride.add_hydrogen(protein)
mmCIF.set_structure(mmCIF_file, protein_with_hydrogens)
mmCIF_file.write("9bfl_protonated.cif")
Thank you for the quick fix. And thanks for the tips. Sounds good!
Hello,
'd like to report a probable error. When I change a block in the mmCIF file and save it, a format break occurs. Items are written directly after the # character instead of on the next line. For example, instead of
is written to the file
Code to reproduce (Used PDB can be downloaded from here: