moleculekit.pdbx.writer.BinaryCifWriter module#

class moleculekit.pdbx.writer.BinaryCifWriter.BinaryCifEncoders(defaultStringEncoding='utf-8', storeStringsAsBytes=False, useFloat64=False)#

Bases: object

Column-oriented Binary CIF encoders implementing StringArray, ByteArray, IntegerPacking, Delta, RunLength, and FixedPoint encoders from the BinaryCIF specification described in molstar/BinaryCIF

byteArrayEncoderTyped(colTypedDataList, dataType)#
deltaEncoderTyped(colTypedDataList, minLen=40)#
encode(colDataList, encodingTypeList, dataType)#
encodeWithMask(colDataList, colMaskList, encodingType)#
floatArrayMaskedEncoder(colDataList, colMaskList)#
getMask(colDataList)#

Return per-row mask: 0 = present, 1 = ‘.’, 2 = ‘?’/None. None if no mask needed.

intArrayMaskedEncoder(colDataList, colMaskList)#
integerPackingEncoderTyped(colTypedDataList)#
runLengthEncoderTyped(colTypedDataList, minLen=40)#
stringArrayMaskedEncoder(colDataList, colMaskList)#
class moleculekit.pdbx.writer.BinaryCifWriter.BinaryCifWriter(typeHints=None, storeStringsAsBytes=False, defaultStringEncoding='utf-8', useFloat64=False)#

Bases: object

Writer for the binary CIF format.

Type hints are supplied explicitly:

typeHints = {

“atom_site”: {“id”: “integer”, “Cartn_x”: “float”, …}, …

}

Attributes not present in typeHints[category] default to “string”.

serialize(filePathOrFileObj, containerList)#

Serialize containerList to BCIF.

filePathOrFileObj may be a filesystem path or any binary file-like object (anything with a write method). Passing a file object lets callers write directly into wrappers like gzip.open(…) without materializing an intermediate file.

class moleculekit.pdbx.writer.BinaryCifWriter.TypedArray(data, dtype=None)#

Bases: object

Small wrapper that pairs a data list with its declared bCIF type code.

data#
dtype#