﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
1969	mmCIF write/restore transforms pseudobonds into bonds	Tristan Croll	Eric Pettersen	"Sorry to do this so close to the 0.9 release, but I spent yesterday working on fitting a new cryo-EM map for a colleague, and it threw up a number of bugs in both PDB and mmCIF I/O (some of which I would swear had been fixed last year). I'll attach the example model - the provenance of this is that it started as the ""biological assembly 1"" PDB file for 5u8r from the RCSB website. That's provided as the two relevant copies of the asymmetric unit between MODEL...ENDMDL cards. I hacked the starting PDB file together with a text editor - just cut out the second model, changed the chain IDs and put it back, deleting the MODEL and ENDMDL cards. Of course, I forgot to duplicate the SSBOND and LINK records for the second copy... my bad. Anyway, here is a short list of what went wrong from that point:

- adding the missing bonds (disulfides and Asn-NAG glycosidic bonds) by deleting the extraneous hydrogens and then using `AtomicStructure.new_bond(atom1, atom2)` works fine for the session, but does not update the SSBOND and LINK records when saving a PDB so next time the file is loaded those bonds are gone.

- (possibly the cause of the above) the PDB metadata is silently read-only. If I do:

{{{
md = model.metadata
ssbonds = md['SSBOND']
ssbonds.extend(new_ss_bonds)
md['SSBOND']=ssbonds
}}}

  ... there is no error message, but the metadata doesn't actually change.

- I can't replicate this now, but in one instance after saving and reloading (can't remember if mmCIF or PDB - I've tried both and can't find it) I ended up with a spurious bond between the two oxygens in an acid sidechain. Deleting the CONECT records seemed to get rid of that - but since I can't replicate it I'm not sure if that was actually the solution.

- Saving as mmCIF *does* save the new bonds, but the pseudobonds between chain breaks are treated as bona fide bonds on reloading. But if I save *that* as a PDB file and reload, then everything seems fine - all the necessary SSBONDs and LINKs are there, and the chain breaks are back to being breaks.

- Somewhere in the middle of that, I accidentally entered ""save structure.cif"" without specifying a model when I had three structures opened. The resulting .cif file caused a segmentation fault when I attempted to open it."	defect	closed	moderate		Input/Output		fixed		Eric Pettersen				all	ChimeraX
