MMTF-C++
The C++ language MMTF libraries
|
Data Structures | |
class | BinaryDecoder |
Helper class to decode msgpack binary into a vector. More... | |
struct | BioAssembly |
Data store for the biological assembly annotation. More... | |
class | BondAdder |
Helper class for adding bonds to a group-redundant system. More... | |
class | DecodeError |
Exception thrown when failing during decoding. More... | |
class | EncodeError |
Exception thrown when failing during encoding. More... | |
struct | Entity |
Entity type. More... | |
struct | GroupType |
Group (residue) level data store. More... | |
class | MapDecoder |
Helper class to decode msgpack maps into object fields. Class cannot be copied as it contains unique pointers to msgpack data. More... | |
struct | StructureData |
Top level MMTF data container. More... | |
struct | Transform |
Transformation definition for a set of chains. More... | |
Functions | |
std::vector< char > | encodeInt8ToByte (std::vector< int8_t > vec_in) |
std::vector< char > | encodeFourByteInt (std::vector< int32_t > const &vec_in) |
std::vector< char > | encodeStringVector (std::vector< std::string > const &in_sv, int32_t const CHAIN_LEN) |
std::vector< char > | encodeRunLengthChar (std::vector< char > const &in_cv) |
std::vector< char > | encodeRunLengthDeltaInt (std::vector< int32_t > int_vec) |
std::vector< char > | encodeRunLengthFloat (std::vector< float > const &floats_in, int32_t const multiplier) |
std::vector< char > | encodeDeltaRecursiveFloat (std::vector< float > const &floats_in, int32_t const multiplier) |
std::vector< char > | encodeRunLengthInt8 (std::vector< int8_t > const &int8_vec) |
void | decodeFromMapDecoder (StructureData &data, MapDecoder &mapDecoder) |
Decode an MMTF data structure from a mapDecoder. | |
void | decodeFromBuffer (StructureData &data, const char *buffer, size_t size) |
Decode an MMTF data structure from a byte buffer. | |
template<typename Stream> | |
void | decodeFromStream (StructureData &data, Stream &stream) |
Decode an MMTF data structure from a stream. | |
void | decodeFromFile (StructureData &data, const std::string &filename) |
Decode an MMTF data structure from an existing file. | |
void | mapDecoderFromBuffer (MapDecoder &mapDecoder, const char *buffer, std::size_t size) |
Get a mapDecoder for un-decoded MMTF data. | |
template<typename Stream> | |
void | mapDecoderFromStream (MapDecoder &mapDecoder, Stream &stream) |
Get a mapDecoder into an un-decoded MMTF data. | |
void | mapDecoderFromFile (MapDecoder &mapDecoder, const std::string &filename) |
Get a mapDecoder into an un-decoded MMTF data. | |
void | encodeToFile (const StructureData &data, const std::string &filename, int32_t coord_divider=1000, int32_t occupancy_b_factor_divider=100, int32_t chain_name_max_length=4) |
Encode an MMTF data structure into a file. | |
template<typename Stream> | |
void | encodeToStream (const StructureData &data, Stream &stream, int32_t coord_divider=1000, int32_t occupancy_b_factor_divider=100, int32_t chain_name_max_length=4) |
Encode an MMTF data structure into a stream. | |
std::map< std::string, msgpack::object > | encodeToMap (const StructureData &data, msgpack::zone &m_zone, int32_t coord_divider=1000, int32_t occupancy_b_factor_divider=100, int32_t chain_name_max_length=4) |
Encode an MMTF data structure into a map of msgpack objects. | |
void | compressGroupList (StructureData &data) |
Eliminate redundant groups from groupList. | |
std::string | getVersionString () |
Get string representation of MMTF spec version implemented here. | |
bool | isVersionSupported (const std::string &version_string) |
Check if version is supported (minor revisions ok, major ones not) | |
template<typename T> | |
T | getDefaultValue () |
Get default value for given type. | |
template<typename T> | |
bool | isDefaultValue (const T &value) |
template<typename T> | |
bool | isDefaultValue (const std::vector< T > &value) |
template<> | |
bool | isDefaultValue (const std::string &value) |
template<> | |
bool | isDefaultValue (const std::map< std::string, msgpack::object > &value) |
template<typename T> | |
void | setDefaultValue (T &value) |
Set default value to given type. | |
bool | is_polymer (const unsigned int chain_index, const std::vector< Entity > &entity_list) |
Check if chain is a polymer chain. | |
bool | is_hetatm (const char *type) |
Check if group type consists of HETATM atoms. | |
bool | is_hetatm (const unsigned int chain_index, const std::vector< Entity > &entity_list, const GroupType &group_type) |
Preferred way to check if group consists of hetatm atoms. | |
template<> | |
bool | isDefaultValue (const std::string &value) |
template<> | |
bool | isDefaultValue (const std::map< std::string, msgpack::object > &value) |
|
inline |
Eliminate redundant groups from groupList.
Modifies groupList and groupTypeList
[in,out] | data | Consistent system |
|
inline |
Decode an MMTF data structure from a byte buffer.
[out] | data | MMTF data structure to be filled |
[in] | buffer | File contents |
[in] | size | Size of buffer |
mmtf::DecodeError | if an error occured |
|
inline |
Decode an MMTF data structure from an existing file.
[out] | data | MMTF data structure to be filled |
[in] | filename | Path to file to load |
mmtf::DecodeError | if an error occured |
|
inline |
Decode an MMTF data structure from a mapDecoder.
[out] | data | MMTF data structure to be filled |
[in] | mapDecoder | MapDecoder holding raw mmtf data |
mmtf::DecodeError | if an error occured |
|
inline |
Decode an MMTF data structure from a stream.
Note that the full stream is read from start to end before decoding it! Use decodeFromBuffer if you wish to use just part of the stream.
[out] | data | MMTF data structure to be filled |
[in] | stream | Stream that holds mmtf data |
Stream | Any stream type compatible to std::istream |
mmtf::DecodeError | if an error occured |
|
inline |
Encode Delta Recursive Float encoding (type 10)
[in] | floats_in | Vector of floats to encode |
[in] | multiplier | Multiplier to convert float to int |
|
inline |
Encode 4 bytes to int encoding (type 4)
[in] | vec_in | Vector of ints to encode |
|
inline |
Encode 8 bit int to bytes encoding (type 2)
[in] | vec_in | Vector of ints to encode |
|
inline |
Encode Run Length Char encoding (type 6)
[in] | in_cv | Vector of chars to encode |
|
inline |
Encode Run Length Delta Int encoding (type 8)
[in] | int_vec | Vector of ints to encode |
|
inline |
Encode Run Length Float encoding (type 9)
[in] | floats_in | Vector of floats to encode |
[in] | multiplier | Multiplier to convert float to int |
|
inline |
Encode Run-Length 8bit int encoding (type 16)
[in] | int8_vec | Vector of ints to encode |
|
inline |
Encode string vector encoding (type 5)
[in] | in_sv | Vector of strings to encode |
[in] | CHAIN_LEN | Maximum length of string |
|
inline |
Encode an MMTF data structure into a file.
[in] | data | MMTF data structure to be stored |
[in] | filename | Path to file to load |
[in] | coord_divider | Divisor for coordinates |
[in] | occupancy_b_factor_divider | Divisor for occupancy and b-factor |
[in] | chain_name_max_length | Max. length for chain name strings |
mmtf::EncodeError | if an error occurred |
Common settings for the divisors are the default values for a loss-less encoding and both set to 10 for a lossy variant.
|
inline |
Encode an MMTF data structure into a map of msgpack objects.
[in] | data | MMTF data structure to be stored |
[in] | m_zone | msgpack::zone object to use |
Other parameters and behavior are as in encodeToFile, but this enables you to add additional fields before packing.
|
inline |
Encode an MMTF data structure into a stream.
[in] | data | MMTF data structure to be stored |
[in] | stream | Stream to encode to |
Stream | Any stream type compatible to std::ostream |
Other parameters and behavior are as in encodeToFile, but this enables you to store the data to other types of storage.
|
inline |
Get default value for given type.
|
inline |
Get string representation of MMTF spec version implemented here.
|
inline |
Check if group type consists of HETATM atoms.
type | Character string of GroupType.chemCompType. |
Relevant threads:
|
inline |
Preferred way to check if group consists of hetatm atoms.
chain_index | Chain index of chain where atom belongs to. |
entity_list | StructureData.entityList with info on given chain. |
group_type | GroupType of group where atom belongs to. |
Follows discussion in https://github.com/rcsb/mmtf/issues/28.
Used in StructureData.print to mark atoms as HETATM. This is a shorthand for is_hetatm(type) || !is_polymer(chain_index, entity_list)
.
Efficient code needing this information should preferably use the or statement above, precompute the is_polymer
output for each chain and the is_hetatm(type)
output for each group instead of calling this on each atom.
|
inline |
Check if chain is a polymer chain.
chain_index | Chain index of chain. |
entity_list | StructureData.entityList with info on given chain. |
mmtf::DecodeError | if chain index doesn't appear in entity list. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
T | Can be any numeric type, vector of string |
|
inline |
Check if version is supported (minor revisions ok, major ones not)
|
inline |
Get a mapDecoder for un-decoded MMTF data.
[out] | mapDecoder | MapDecoder to hold raw mmtf data |
Other parameters and behavior are as in decodeFromBuffer, but this doesn't decode the MMTF content.
|
inline |
Get a mapDecoder into an un-decoded MMTF data.
[out] | mapDecoder | MapDecoder to hold raw mmtf data |
Other parameters and behavior are as in decodeFromFile, but this doesn't decode the MMTF content.
|
inline |
Get a mapDecoder into an un-decoded MMTF data.
[out] | mapDecoder | MapDecoder to hold raw mmtf data |
Other parameters and behavior are as in decodeFromStream, but this doesn't decode the MMTF content.
|
inline |
Set default value to given type.
T | Can be any numeric type (no need for vector or strings here) |