Closed speleo3 closed 5 years ago
File was created with this script:
import struct
import msgpack
pdbid = '3NJW'
optionalkeys = '''unitCell spaceGroup structureId title depositionDate
releaseDate ncsOperatorList bioAssemblyList entityList experimentalMethods
resolution rFree rWork bondAtomList bondOrderList bFactorList atomIdList
altLocList occupancyList secStructList insCodeList sequenceIndexList
chainNameList
'''.split()
with open(pdbid + '.mmtf', 'rb') as f:
d = msgpack.unpack(f, encoding='utf-8')
if 'bondOrderList' in d:
n = struct.unpack('>i', d['bondOrderList'][4:8])[0]
d['numBonds'] -= n
for key in optionalkeys:
d.pop(key, None)
with open(pdbid + '-onlyrequired.mmtf', 'wb') as f:
msgpack.pack(d, f, use_bin_type=True)
Any reason why this hasn't been merged yet?
thanks @josemduarte !
3NJW with all optional fields removed.
A file like this should help testing downstream software to comply with the spec and not fail if optional fields are missing. Example: https://github.com/MDAnalysis/mdanalysis/issues/2193
Closes #26