Module: MmtfUtils

mmtf utils module.

Methods


<static> decodeDelta(dataArray)

perform delta decoding of the input array by iterativly adding the ith element's value to the i+1th example: dataArray: [ 0, 2, 1, 2, 1, 1, -4, -2, 9 ] return: [ 0, 2, 3, 5, 6, 7, 3, 1, 10 ]
Parameters:
Name Type Description
dataArray TypedArray | Array delta encoded input array
Returns:
decoded array
Type
TypedArray | Array

<static> decodeInt16(view, dataArray)

get an Int16Array copy of the the input array data
Parameters:
Name Type Argument Description
view TypedArray input data in big endian format
dataArray Int16Array <optional>
pre-allocated output array
Returns:
copy of the input array data
Type
Int16Array

<static> decodeInt32(view, dataArray)

get an Int32Array copy of the the input array data
Parameters:
Name Type Argument Description
view TypedArray input data in big endian format
dataArray Int32Array <optional>
pre-allocated output array
Returns:
copy of the input array data
Type
Int32Array

<static> decodeInteger(intArray, divisor, dataArray)

decode integers into floats using given divisor example: intArray: [ 12, 34, 543, 687, 2, 0, 4689 ] divisor: 100 return: [ 0.12, 0.34, 5.43, 6.87, 0.02, 0.00, 46.89 ]
Parameters:
Name Type Argument Description
intArray TypedArray | Array input array containing integers
divisor Number number to devide the integers to obtain floats
dataArray Float32Array <optional>
pre-allocated output array
Returns:
decoded array
Type
Float32Array

<static> decodeIntegerRun(array, divisor, dataArray)

perform run-length decoding followed (@see decodeRunLength) by decoding integers into floats using given divisor (@see decodeIntegerToFloat) example: array: [ 320, 3, 100, 2 ] divisor: 100 return: [ 3.20, 3.20, 3.20, 1.00, 1.00 ]
Parameters:
Name Type Description
array Uint8Array run-length encoded int32 array as bytes in big endian format
divisor Integer number to devide the integers to obtain floats
dataArray Float32Array pre-allocated output array
Returns:
decoded array
Type
Float32Array

<static> decodeRun(array, dataArray)

perform run-length decoding of input array example: array: [ 0, 2, 3, 5 ] // pairs of values and length of a run return: [ 0, 0, 3, 3, 3, 3, 3 ]
Parameters:
Name Type Argument Description
array TypedArray | Array run-length encoded input array
dataArray TypedArray | Array <optional>
pre-allocated output array
Returns:
decoded array
Type
TypedArray | Array

<static> encodeInt16(array)

make big endian buffer of an int16 array
Parameters:
Name Type Description
array Array | TypedArray array of int16 values
Returns:
big endian buffer
Type
ArrayBuffer

<static> encodeInt32(array)

make big endian buffer of an int32 array
Parameters:
Name Type Description
array Array | TypedArray array of int32 values
Returns:
big endian buffer
Type
ArrayBuffer

<static> getInt8View(dataArray)

get an Int8Array view on the input array memory
Parameters:
Name Type Description
dataArray TypedArray input array
Returns:
new view on the input array memory
Type
Int8Array

<static> getInt16View(dataArray)

get an Int16Array view on the input array memory
Parameters:
Name Type Description
dataArray TypedArray input array
Returns:
new view on the input array memory
Type
Int16Array

<static> getInt32View(dataArray)

get an Int32Array view on the input array memory
Parameters:
Name Type Description
dataArray TypedArray input array
Returns:
new view on the input array memory
Type
Int32Array

<static> getUint8View(dataArray)

get an Uint8Array view on the input array memory
Parameters:
Name Type Description
dataArray TypedArray input array
Returns:
new view on the input array memory
Type
Uint8Array

<inner> decodePacking(int16or8, output)

[decodePacking description]
Parameters:
Name Type Description
int16or8 Int16Array | Int8Array [description]
output Int32Array [description]
Returns:
[description]
Type
Int32Array

<inner> encodePacking(intArray, useInt8)

integer packing using recursive indexing
Parameters:
Name Type Description
intArray Array | TyepedArray [description]
useInt8 Boolean [description]
Returns:
[description]
Type
Int16Array | Int8Array