MMTF-C++
The C++ language MMTF libraries
structure_data.hpp
Go to the documentation of this file.
1 // *************************************************************************
2 //
3 // Licensed under the MIT License (see accompanying LICENSE file).
4 //
5 // The authors of this code are: Gabriel Studer, Gerardo Tauriello
6 //
7 // Based on mmtf_c developed by Julien Ferte (http://www.julienferte.com/),
8 // Anthony Bradley, Thomas Holder with contributions from Yana Valasatava,
9 // Gazal Kalyan, Alexander Rose. Updated 2018 by Daniel Farrell.
10 //
11 // *************************************************************************
12 
13 #ifndef MMTF_STRUCTURE_DATA_H
14 #define MMTF_STRUCTURE_DATA_H
15 
16 #include <string>
17 #include <vector>
18 #include <stdint.h>
19 #include <sstream>
20 #include <limits>
21 #include <msgpack.hpp>
22 #include <iostream>
23 #include <iomanip>
24 
25 namespace mmtf {
26 
30 #define MMTF_SPEC_VERSION_MAJOR 1
31 #define MMTF_SPEC_VERSION_MINOR 0
32 
36 inline std::string getVersionString();
37 
42 inline bool isVersionSupported(const std::string& version_string);
43 
49 struct GroupType { // NOTE: can't use MSGPACK_DEFINE_MAP due to char
50  std::vector<int32_t> formalChargeList;
51  std::vector<std::string> atomNameList;
52  std::vector<std::string> elementList;
53  std::vector<int32_t> bondAtomList;
54  std::vector<int8_t> bondOrderList;
55  std::string groupName;
57  std::string chemCompType;
58 
59  bool operator==(GroupType const & c) const {
60  return(
63  elementList == c.elementList &&
66  groupName == c.groupName &&
69  }
70 };
71 
77 struct Entity {
78  std::vector<int32_t> chainIndexList;
79  std::string description;
80  std::string type;
81  std::string sequence;
82 
83  bool operator==(Entity const & c) const {
84  return(
86  description == c.description &&
87  type == c.type &&
88  sequence == c.sequence);
89  }
90 
94  type,
95  sequence);
96 };
97 
103 struct Transform {
104  std::vector<int32_t> chainIndexList;
105  float matrix[16];
106 
107  bool operator==(Transform const & c) const {
108  bool comp = true;
109  for(size_t i = 16; i--;) {
110  if ( matrix[i] != c.matrix[i] ) {
111  comp = false;
112  break;
113  }
114  }
115  return (chainIndexList == c.chainIndexList && comp);
116  }
117 
119 };
120 
126 struct BioAssembly {
127  std::vector<Transform> transformList;
128  std::string name;
129 
130  bool operator==(BioAssembly const & c) const {
131  return (
133  name == c.name);
134  }
135 
137 };
138 
152  std::string mmtfVersion;
153  std::string mmtfProducer;
154  std::vector<float> unitCell;
155  std::string spaceGroup;
156  std::string structureId;
157  std::string title;
158  std::string depositionDate;
159  std::string releaseDate;
160  std::vector<std::vector<float> > ncsOperatorList;
161  std::vector<BioAssembly> bioAssemblyList;
162  std::vector<Entity> entityList;
163  std::vector<std::string> experimentalMethods;
164  float resolution;
165  float rFree;
166  float rWork;
167  int32_t numBonds;
168  int32_t numAtoms;
169  int32_t numGroups;
170  int32_t numChains;
171  int32_t numModels;
172  std::vector<GroupType> groupList;
173  std::vector<int32_t> bondAtomList;
174  std::vector<int8_t> bondOrderList;
175  std::vector<float> xCoordList;
176  std::vector<float> yCoordList;
177  std::vector<float> zCoordList;
178  std::vector<float> bFactorList;
179  std::vector<int32_t> atomIdList;
180  std::vector<char> altLocList;
181  std::vector<float> occupancyList;
182  std::vector<int32_t> groupIdList;
183  std::vector<int32_t> groupTypeList;
184  std::vector<int8_t> secStructList;
185  std::vector<char> insCodeList;
186  std::vector<int32_t> sequenceIndexList;
187  std::vector<std::string> chainIdList;
188  std::vector<std::string> chainNameList;
189  std::vector<int32_t> groupsPerChain;
190  std::vector<int32_t> chainsPerModel;
191 
195  StructureData();
196 
204  bool hasConsistentData(bool verbose=false, uint32_t chain_name_max_length = 4) const;
205 
206 
214  std::string print(std::string delim="\t");
215 
220  bool operator==(StructureData const & c) const {
221  return (
222  mmtfVersion == c.mmtfVersion &&
223  mmtfProducer == c.mmtfProducer &&
224  unitCell == c.unitCell &&
225  spaceGroup == c.spaceGroup &&
226  structureId == c.structureId &&
227  title == c.title &&
229  releaseDate == c.releaseDate &&
232  entityList == c.entityList &&
234  resolution == c.resolution &&
235  rFree == c.rFree &&
236  rWork == c.rWork &&
237  numBonds == c.numBonds &&
238  numAtoms == c.numAtoms &&
239  numGroups == c.numGroups &&
240  numChains == c.numChains &&
241  numModels == c.numModels &&
242  groupList == c.groupList &&
243  bondAtomList == c.bondAtomList &&
245  xCoordList == c.xCoordList &&
246  yCoordList == c.yCoordList &&
247  zCoordList == c.zCoordList &&
248  bFactorList == c.bFactorList &&
249  atomIdList == c.atomIdList &&
250  altLocList == c.altLocList &&
252  groupIdList == c.groupIdList &&
255  insCodeList == c.insCodeList &&
257  chainIdList == c.chainIdList &&
261  }
262 };
263 
264 
268 template <typename T>
269 inline T getDefaultValue();
270 
271 
276 template <typename T>
277 inline bool isDefaultValue(const T& value);
278 template <typename T>
279 inline bool isDefaultValue(const std::vector<T>& value);
280 template <>
281 inline bool isDefaultValue(const std::string& value);
282 
283 
288 template <typename T>
289 inline void setDefaultValue(T& value);
290 
301 inline bool is_hetatm(const char* type);
302 
303 // *************************************************************************
304 // IMPLEMENTATION
305 // *************************************************************************
306 
307 // helpers in anonymous namespace (only visible in this file)
308 namespace {
309 
310 // check optional date string
311 // -> either default or "YYYY-MM-DD" (only string format checked, not date)
312 bool isValidDateFormatOptional(const std::string& s) {
313  // default?
314  if (isDefaultValue(s)) return true;
315  // check length
316  if (s.length() != 10) return false;
317  // check delimiters
318  if (s[4] != '-' || s[7] != '-') return false;
319  // check format
320  std::istringstream is(s);
321  int d, m, y;
322  char dash1, dash2;
323  if (is >> y >> dash1 >> m >> dash2 >> d) {
324  return (dash1 == '-' && dash2 == '-');
325  } else {
326  return false;
327  }
328 }
329 
330 // check if optional vector has right size
331 template<typename T>
332 bool hasRightSizeOptional(const std::vector<T>& v, int exp_size) {
333  return (isDefaultValue(v) || (int)v.size() == exp_size);
334 }
335 
336 // check if all indices in vector are in [0, num-1] (T = integer type)
337 template<typename T, typename Tnum>
338 bool hasValidIndices(const T* v, size_t size, Tnum num) {
339  T tnum = T(num);
340  for (size_t i = 0; i < size; ++i) {
341  if (v[i] < T(0) || v[i] >= tnum) return false;
342  }
343  return true;
344 }
345 template<typename T, typename Tnum>
346 bool hasValidIndices(const std::vector<T>& v, Tnum num) {
347  if (v.empty()) return true;
348  else return hasValidIndices(&v[0], v.size(), num);
349 }
350 
351 } // anon ns
352 
353 // VERSIONING
354 
355 inline std::string getVersionString() {
356  std::stringstream version;
358  return version.str();
359 }
360 
361 inline bool isVersionSupported(const std::string& version_string) {
362  std::stringstream ss(version_string);
363  int major = -1;
364  return ((ss >> major) && (major <= MMTF_SPEC_VERSION_MAJOR));
365 }
366 
367 // DEFAULT VALUES
368 
369 template <typename T>
370 inline T getDefaultValue() { return std::numeric_limits<T>::max(); }
371 
372 template <typename T>
373 inline bool isDefaultValue(const T& value) {
374  return (value == getDefaultValue<T>());
375 }
376 template <typename T>
377 inline bool isDefaultValue(const std::vector<T>& value) {
378  return value.empty();
379 }
380 template <>
381 inline bool isDefaultValue(const std::string& value) {
382  return value.empty();
383 }
384 
385 template <typename T>
386 inline void setDefaultValue(T& value) {
387  value = getDefaultValue<T>();
388 }
389 
390 // HELPERS
391 
402 bool is_hetatm(const char* type) {
403  const char* hetatm_type[] = {
404  "D-BETA-PEPTIDE, C-GAMMA LINKING",
405  "D-GAMMA-PEPTIDE, C-DELTA LINKING",
406  "D-PEPTIDE COOH CARBOXY TERMINUS",
407  "D-PEPTIDE NH3 AMINO TERMINUS",
408  "D-PEPTIDE LINKING",
409  "D-SACCHARIDE",
410  "D-SACCHARIDE 1,4 AND 1,4 LINKING",
411  "D-SACCHARIDE 1,4 AND 1,6 LINKING",
412  "DNA OH 3 PRIME TERMINUS",
413  "DNA OH 5 PRIME TERMINUS",
414  "DNA LINKING",
415  "L-DNA LINKING",
416  "L-RNA LINKING",
417  "L-BETA-PEPTIDE, C-GAMMA LINKING",
418  "L-GAMMA-PEPTIDE, C-DELTA LINKING",
419  "L-PEPTIDE COOH CARBOXY TERMINUS",
420  "L-PEPTIDE NH3 AMINO TERMINUS",
421  //"L-PEPTIDE LINKING", // All canonical L AA
422  "L-SACCHARIDE",
423  "L-SACCHARIDE 1,4 AND 1,4 LINKING",
424  "L-SACCHARIDE 1,4 AND 1,6 LINKING",
425  "RNA OH 3 PRIME TERMINUS",
426  "RNA OH 5 PRIME TERMINUS",
427  "RNA LINKING",
428  "NON-POLYMER",
429  "OTHER",
430  //"PEPTIDE LINKING", // GLY
431  "PEPTIDE-LIKE",
432  "SACCHARIDE",
433  0 };
434  for (int i=0; hetatm_type[i]; ++i) {
435  if (strcmp(type,hetatm_type[i]) == 0) return true;
436  }
437  return false;
438 }
439 
440 // CLASS StructureData
441 
443  // no need to do anything with strings and vectors
447  // numXX set to 0 to have consistent data
448  numBonds = 0;
449  numAtoms = 0;
450  numGroups = 0;
451  numChains = 0;
452  numModels = 0;
453  // set version and producer
455  mmtfProducer = "mmtf-cpp library (github.com/rcsb/mmtf-cpp)";
456 }
457 
458 inline bool StructureData::hasConsistentData(bool verbose, uint32_t chain_name_max_length) const {
459  // check unitCell: if given, must be of length 6
460  if (!hasRightSizeOptional(unitCell, 6)) {
461  if (verbose) {
462  std::cout << "inconsistent unitCell (unitCell length != 6)" << std::endl;
463  }
464  return false;
465  }
466  // check dates
467  if (!isValidDateFormatOptional(depositionDate)) {
468  if (verbose) {
469  std::cout << "inconsistent depositionDate (does not match 'YYYY-MM-DD' "
470  "or empty)" << std::endl;
471  }
472  return false;
473  }
474  if (!isValidDateFormatOptional(releaseDate)) {
475  if (verbose) {
476  std::cout << "inconsistent releaseDate (does not match 'YYYY-MM-DD' "
477  "or empty)" << std::endl;
478  }
479  return false;
480  }
481  // check ncsOperatorList: all elements must have length 16
482  for (size_t i = 0; i < ncsOperatorList.size(); ++i) {
483  if ((int)ncsOperatorList[i].size() != 16) {
484  if (verbose) {
485  std::cout << "inconsistent ncsOperatorList idx: " << i << " found size: "
486  << ncsOperatorList[i].size() << " != 16" << std::endl;
487  }
488  return false;
489  }
490  }
491  // check chain indices in bioAssembly-transforms and entities
492  for (size_t i = 0; i < bioAssemblyList.size(); ++i) {
493  const BioAssembly& ba = bioAssemblyList[i];
494  for (size_t j = 0; j < ba.transformList.size(); ++j) {
495  const Transform & t = ba.transformList[j];
496  if (!hasValidIndices(t.chainIndexList, numChains)) {
497  if (verbose) {
498  std::cout << "inconsistent BioAssemby transform i j: " << i
499  << " " << j << std::endl;
500  }
501  return false;
502  }
503  }
504  }
505  for (size_t i = 0; i < entityList.size(); ++i) {
506  const Entity& ent = entityList[i];
507  if (!hasValidIndices(ent.chainIndexList, numChains)) {
508  if (verbose) {
509  std::cout << "inconsistent entity idx: " << i << std::endl;
510  }
511  return false;
512  }
513  }
514  // check groups
515  for (size_t i = 0; i < groupList.size(); ++i) {
516  const GroupType& g = groupList[i];
517  const size_t num_atoms = g.formalChargeList.size();
518  if (g.atomNameList.size() != num_atoms) {
519  if (verbose) {
520  std::cout << "inconsistent group::atomNameList size at idx: "
521  << i << std::endl;
522  }
523  return false;
524  }
525  if (g.elementList.size() != num_atoms) {
526  if (verbose) {
527  std::cout << "inconsistent group::elementList size at idx: "
528  << i << std::endl;
529  }
530  return false;
531  }
532  if (!isDefaultValue(g.bondOrderList)) {
533  if (g.bondAtomList.size() != g.bondOrderList.size() * 2) {
534  if (verbose) {
535  std::cout << "inconsistent group::bondAtomList size: " <<
536  g.bondAtomList.size() << " != group::bondOrderList size(*2): " <<
537  g.bondOrderList.size()*2 << " at idx: " << i << std::endl;
538  }
539  return false;
540  }
541  }
542  if (!hasValidIndices(g.bondAtomList, num_atoms)) {
543  if (verbose) {
544  std::cout << "inconsistent group::bondAtomList indices (not all in [0, "
545  << num_atoms - 1 << "]) at idx: " << i << std::endl;
546  }
547  return false;
548  }
549  }
550  // check global bonds
552  if (bondAtomList.size() != bondOrderList.size() * 2) {
553  if (verbose) {
554  std::cout << "inconsistent bondAtomList size: " <<
555  bondAtomList.size() << " != bondOrderList size(*2): " <<
556  bondOrderList.size()*2 << std::endl;
557  }
558  return false;
559  }
560  }
561  if (!hasValidIndices(bondAtomList, numAtoms)) {
562  if (verbose) {
563  std::cout << "inconsistent bondAtomList indices (not all in [0, "
564  << numAtoms - 1 << "])" << std::endl;
565  }
566  return false;
567  }
568  // check vector sizes
569  if ((int)xCoordList.size() != numAtoms) {
570  if (verbose) {
571  std::cout << "inconsistent xCoordList size" << std::endl;
572  }
573  return false;
574  }
575  if ((int)yCoordList.size() != numAtoms) {
576  if (verbose) {
577  std::cout << "inconsistent yCoordList size" << std::endl;
578  }
579  return false;
580  }
581  if ((int)zCoordList.size() != numAtoms) {
582  if (verbose) {
583  std::cout << "inconsistent zCoordList size" << std::endl;
584  }
585  return false;
586  }
587  if (!hasRightSizeOptional(bFactorList, numAtoms)) {
588  if (verbose) {
589  std::cout << "inconsistent bFactorList size" << std::endl;
590  }
591  return false;
592  }
593  if (!hasRightSizeOptional(atomIdList, numAtoms)) {
594  if (verbose) {
595  std::cout << "inconsistent atomIdList size" << std::endl;
596  }
597  return false;
598  }
599  if (!hasRightSizeOptional(altLocList, numAtoms)) {
600  if (verbose) {
601  std::cout << "inconsistent altLocList size" << std::endl;
602  }
603  return false;
604  }
605  if (!hasRightSizeOptional(occupancyList, numAtoms)) {
606  if (verbose) {
607  std::cout << "inconsistent occupancyList size" << std::endl;
608  }
609  return false;
610  }
611  if ((int)groupIdList.size() != numGroups) {
612  if (verbose) {
613  std::cout << "inconsistent groupIdList size" << std::endl;
614  }
615  return false;
616  }
617  if ((int)groupTypeList.size() != numGroups) {
618  if (verbose) {
619  std::cout << "inconsistent groupTypeList size" << std::endl;
620  }
621  return false;
622  }
623  if (!hasRightSizeOptional(secStructList, numGroups)) {
624  if (verbose) {
625  std::cout << "inconsistent secStructList size" << std::endl;
626  }
627  return false;
628  }
629  if (!hasRightSizeOptional(insCodeList, numGroups)) {
630  if (verbose) {
631  std::cout << "inconsistent insCodeList size" << std::endl;
632  }
633  return false;
634  }
635  if (!hasRightSizeOptional(sequenceIndexList, numGroups)) {
636  if (verbose) {
637  std::cout << "inconsistent sequenceIndexList size" << std::endl;
638  }
639  return false;
640  }
641  if ((int)chainIdList.size() != numChains) {
642  if (verbose) {
643  std::cout << "inconsistent chainIdList size" << std::endl;
644  }
645  return false;
646  }
647  if (!hasRightSizeOptional(chainNameList, numChains)) {
648  if (verbose) {
649  std::cout << "inconsistent chainNameList size" << std::endl;
650  }
651  return false;
652  }
653  if ((int)groupsPerChain.size() != numChains) {
654  if (verbose) {
655  std::cout << "inconsistent groupsPerChain size" << std::endl;
656  }
657  return false;
658  }
659  if ((int)chainsPerModel.size() != numModels) {
660  if (verbose) {
661  std::cout << "inconsistent chainsPerModel size" << std::endl;
662  }
663  return false;
664  }
665  // check indices
666  if (!hasValidIndices(groupTypeList, groupList.size())) {
667  if (verbose) {
668  std::cout << "inconsistent groupTypeList indices (not all in [0, "
669  << groupList.size() - 1 << "])" << std::endl;
670  }
671  return false;
672  }
673  // collect sequence lengths from entities and use to check
674  std::vector<int32_t> sequenceIndexSize(numChains);
675  for (size_t i = 0; i < entityList.size(); ++i) {
676  const Entity& ent = entityList[i];
677  for (size_t j = 0; j < ent.chainIndexList.size(); ++j) {
678  sequenceIndexSize[ent.chainIndexList[j]] = ent.sequence.length();
679  }
680  }
681  // traverse structure for more checks
682  int bond_count_from_atom = 0;
683  int bond_count_from_order = 0;
684  bool all_bond_orderLists_are_default = true;
685  bool all_bond_atomLists_are_default = true;
687  all_bond_orderLists_are_default = false;
688  bond_count_from_order = bondOrderList.size();
689  }
691  all_bond_atomLists_are_default = false;
692  bond_count_from_atom = bondAtomList.size()/2;
693  }
694  int chain_idx = 0; // will be count at end of loop
695  int group_idx = 0; // will be count at end of loop
696  int atom_idx = 0; // will be count at end of loop
697  // traverse models
698  for (int model_idx = 0; model_idx < numModels; ++model_idx) {
699  // traverse chains
700  for (int j = 0; j < chainsPerModel[model_idx]; ++j, ++chain_idx) {
701  // check chain names (fixed length)
702  if (chainIdList[chain_idx].size() > chain_name_max_length) {
703  if (verbose) {
704  std::cout << "inconsistent chainIdList size at chain_idx: "
705  << chain_idx << " size: "
706  << chainIdList[chain_idx].size() << std::endl;
707  }
708  return false;
709  }
711  && chainNameList[chain_idx].size() > chain_name_max_length) {
712  if (verbose) {
713  std::cout << "inconsistent chainNameList size at chain_idx:"
714  << chain_idx << " size: "
715  << chainNameList[chain_idx].size() << std::endl;
716  }
717  return false;
718  }
719  // traverse groups
720  for (int k = 0; k < groupsPerChain[chain_idx]; ++k, ++group_idx) {
721  // check seq. idx
723  const int32_t idx = sequenceIndexList[group_idx];
724  // -1 is ok here
725  if (idx < -1 || idx >= sequenceIndexSize[chain_idx]) {
726  if (verbose) {
727  std::cout << "inconsistent sequenceIndexSize at"
728  " chain_idx: " << chain_idx << std::endl;
729  }
730  return false;
731  }
732  }
733  // count atoms
734  const GroupType& group = groupList[groupTypeList[group_idx]];
735  atom_idx += group.atomNameList.size();
736  // count bonds
737  if (!isDefaultValue(group.bondOrderList)) {
738  all_bond_orderLists_are_default = false;
739  bond_count_from_order += group.bondOrderList.size();
740  }
741  if (!isDefaultValue(group.bondAtomList)) {
742  all_bond_atomLists_are_default = false;
743  bond_count_from_atom += group.bondAtomList.size()/2;
744  }
745 
746  }
747  }
748  }
749  // check sizes
750  if (!all_bond_orderLists_are_default) {
751  if (bond_count_from_order != numBonds) {
752  if (verbose) {
753  std::cout << "inconsistent numBonds vs bond order count" << std::endl;
754  }
755  return false;
756  }
757  }
758  if (!all_bond_atomLists_are_default) {
759  if (bond_count_from_atom != numBonds) {
760  if (verbose) {
761  std::cout << "inconsistent numBonds vs bond atom list count" << std::endl;
762  }
763  return false;
764  }
765  }
766  if (chain_idx != numChains) {
767  if (verbose) {
768  std::cout << "inconsistent numChains" << std::endl;
769  }
770  return false;
771  }
772  if (group_idx != numGroups) {
773  if (verbose) {
774  std::cout << "inconsistent numGroups size" << std::endl;
775  }
776  return false;
777  }
778  if (atom_idx != numAtoms) {
779  if (verbose) {
780  std::cout << "inconsistent numAtoms size" << std::endl;
781  }
782  return false;
783  }
784  // All looks good :)
785  return true;
786 }
787 
788 inline std::string StructureData::print(std::string delim) {
789  std::ostringstream out;
790  int modelIndex = 0;
791  int chainIndex = 0;
792  int groupIndex = 0;
793  int atomIndex = 0;
794 
795  //# traverse models
796  for (int i = 0; i < numModels; i++, modelIndex++) {
797  // # traverse chains
798  for (int j = 0; j < chainsPerModel[modelIndex]; j++, chainIndex++) {
799  // # traverse groups
800  for (int k = 0; k < groupsPerChain[chainIndex]; k++, groupIndex++) {
801  const mmtf::GroupType& group =
802  groupList[groupTypeList[groupIndex]];
803  int groupAtomCount = group.atomNameList.size();
804 
805  for (int l = 0; l < groupAtomCount; l++, atomIndex++) {
806  // ATOM or HETATM
807  if (is_hetatm(group.chemCompType.c_str()))
808  out << "HETATM" << delim;
809  else
810  out << "ATOM" << delim;
811  // Atom serial
813  out << std::setfill('0') << std::internal << std::setw(6) <<
814  std::right << atomIdList[atomIndex] << delim;
815  } else out << "." << delim;
816  // Atom name
817  out << group.atomNameList[l] << delim;
818  // Alternate location
820  if ( altLocList[atomIndex] == ' ' ||
821  altLocList[atomIndex] == 0x00 )
822  out << "." << delim;
823  else out << altLocList[atomIndex] << delim;
824  } else out << "." << delim;
825  // Group name
826  out << group.groupName << delim;
827  // Chain
828  out << chainIdList[chainIndex] << delim;
830  out << chainNameList[chainIndex];
831  out << delim;
832  } else out << "." << delim;
833  // Group serial
834  out << groupIdList[groupIndex] << delim;
835  // Insertion code
837  if ( insCodeList[groupIndex] == ' ' ||
838  insCodeList[groupIndex] == 0x00 )
839  out << "." << delim;
840  else out << int(insCodeList[groupIndex]) << delim;
841  } else out << ". ";
842  // x, y, z
843  out << std::fixed << std::setprecision(3);
844  out << xCoordList[atomIndex] << delim;
845  out << yCoordList[atomIndex] << delim;
846  out << zCoordList[atomIndex] << delim;
847 
848  // B-factor
850  out << bFactorList[atomIndex] << delim;
851  } else out << "." << delim;
852  // Occupancy
854  out << occupancyList[atomIndex] << delim;
855  } else out << "." << delim;
856  // Element
857  out << group.elementList[l] << delim;
858  // Charge
859  out << group.formalChargeList[l] << "\n";
860  }
861  }
862  }
863  }
864  return out.str();
865 }
866 
867 } // mmtf namespace
868 
869 #endif
870 
mmtf::getDefaultValue
T getDefaultValue()
Get default value for given type.
Definition: structure_data.hpp:370
mmtf::StructureData::sequenceIndexList
std::vector< int32_t > sequenceIndexList
Definition: structure_data.hpp:186
mmtf::StructureData::unitCell
std::vector< float > unitCell
Definition: structure_data.hpp:154
mmtf::Transform::matrix
float matrix[16]
Definition: structure_data.hpp:105
mmtf::StructureData::StructureData
StructureData()
Construct object with default values set.
Definition: structure_data.hpp:442
mmtf::Entity
Entity type.
Definition: structure_data.hpp:77
mmtf::Transform::operator==
bool operator==(Transform const &c) const
Definition: structure_data.hpp:107
mmtf::Entity::operator==
bool operator==(Entity const &c) const
Definition: structure_data.hpp:83
mmtf::StructureData::bFactorList
std::vector< float > bFactorList
Definition: structure_data.hpp:178
mmtf::StructureData::occupancyList
std::vector< float > occupancyList
Definition: structure_data.hpp:181
mmtf::StructureData::rWork
float rWork
Definition: structure_data.hpp:166
mmtf::StructureData::numChains
int32_t numChains
Definition: structure_data.hpp:170
mmtf::StructureData
Top level MMTF data container.
Definition: structure_data.hpp:151
mmtf::GroupType::operator==
bool operator==(GroupType const &c) const
Definition: structure_data.hpp:59
mmtf::GroupType::atomNameList
std::vector< std::string > atomNameList
Definition: structure_data.hpp:51
mmtf::StructureData::resolution
float resolution
Definition: structure_data.hpp:164
MMTF_SPEC_VERSION_MAJOR
#define MMTF_SPEC_VERSION_MAJOR
MMTF spec version which this library implements.
Definition: structure_data.hpp:30
mmtf::StructureData::print
std::string print(std::string delim="\t")
Read out the contents of mmtf::StructureData in a PDB-like fashion Columns are in order: ATOM/HETATM ...
Definition: structure_data.hpp:788
mmtf::StructureData::numBonds
int32_t numBonds
Definition: structure_data.hpp:167
mmtf::Transform::MSGPACK_DEFINE_MAP
MSGPACK_DEFINE_MAP(chainIndexList, matrix)
mmtf::BioAssembly::transformList
std::vector< Transform > transformList
Definition: structure_data.hpp:127
mmtf::GroupType
Group (residue) level data store.
Definition: structure_data.hpp:49
mmtf::StructureData::xCoordList
std::vector< float > xCoordList
Definition: structure_data.hpp:175
mmtf::GroupType::bondAtomList
std::vector< int32_t > bondAtomList
Definition: structure_data.hpp:53
mmtf::StructureData::yCoordList
std::vector< float > yCoordList
Definition: structure_data.hpp:176
mmtf::StructureData::groupsPerChain
std::vector< int32_t > groupsPerChain
Definition: structure_data.hpp:189
mmtf::StructureData::chainsPerModel
std::vector< int32_t > chainsPerModel
Definition: structure_data.hpp:190
mmtf::StructureData::groupList
std::vector< GroupType > groupList
Definition: structure_data.hpp:172
mmtf::isVersionSupported
bool isVersionSupported(const std::string &version_string)
Check if version is supported (minor revisions ok, major ones not)
Definition: structure_data.hpp:361
mmtf::StructureData::ncsOperatorList
std::vector< std::vector< float > > ncsOperatorList
Definition: structure_data.hpp:160
mmtf::StructureData::spaceGroup
std::string spaceGroup
Definition: structure_data.hpp:155
mmtf::StructureData::groupTypeList
std::vector< int32_t > groupTypeList
Definition: structure_data.hpp:183
mmtf::StructureData::rFree
float rFree
Definition: structure_data.hpp:165
mmtf::StructureData::structureId
std::string structureId
Definition: structure_data.hpp:156
mmtf::StructureData::bondAtomList
std::vector< int32_t > bondAtomList
Definition: structure_data.hpp:173
mmtf::Entity::description
std::string description
Definition: structure_data.hpp:79
mmtf::StructureData::secStructList
std::vector< int8_t > secStructList
Definition: structure_data.hpp:184
mmtf::getVersionString
std::string getVersionString()
Get string representation of MMTF spec version implemented here.
Definition: structure_data.hpp:355
mmtf::StructureData::entityList
std::vector< Entity > entityList
Definition: structure_data.hpp:162
MMTF_SPEC_VERSION_MINOR
#define MMTF_SPEC_VERSION_MINOR
Definition: structure_data.hpp:31
mmtf::isDefaultValue
bool isDefaultValue(const T &value)
Definition: structure_data.hpp:373
mmtf::StructureData::insCodeList
std::vector< char > insCodeList
Definition: structure_data.hpp:185
mmtf::StructureData::atomIdList
std::vector< int32_t > atomIdList
Definition: structure_data.hpp:179
mmtf::Entity::type
std::string type
Definition: structure_data.hpp:80
mmtf::StructureData::numAtoms
int32_t numAtoms
Definition: structure_data.hpp:168
mmtf::GroupType::elementList
std::vector< std::string > elementList
Definition: structure_data.hpp:52
mmtf::StructureData::altLocList
std::vector< char > altLocList
Definition: structure_data.hpp:180
mmtf::StructureData::operator==
bool operator==(StructureData const &c) const
compare two StructureData classes
Definition: structure_data.hpp:220
mmtf::StructureData::groupIdList
std::vector< int32_t > groupIdList
Definition: structure_data.hpp:182
mmtf::GroupType::chemCompType
std::string chemCompType
Definition: structure_data.hpp:57
mmtf::StructureData::hasConsistentData
bool hasConsistentData(bool verbose=false, uint32_t chain_name_max_length=4) const
Check consistency of structural data.
Definition: structure_data.hpp:458
mmtf::BioAssembly
Data store for the biological assembly annotation.
Definition: structure_data.hpp:126
mmtf::Transform
Transformation definition for a set of chains.
Definition: structure_data.hpp:103
mmtf::StructureData::bioAssemblyList
std::vector< BioAssembly > bioAssemblyList
Definition: structure_data.hpp:161
mmtf::Transform::chainIndexList
std::vector< int32_t > chainIndexList
Definition: structure_data.hpp:104
mmtf::BioAssembly::operator==
bool operator==(BioAssembly const &c) const
Definition: structure_data.hpp:130
mmtf::setDefaultValue
void setDefaultValue(T &value)
Set default value to given type.
Definition: structure_data.hpp:386
mmtf::StructureData::mmtfProducer
std::string mmtfProducer
Definition: structure_data.hpp:153
mmtf::StructureData::experimentalMethods
std::vector< std::string > experimentalMethods
Definition: structure_data.hpp:163
mmtf::StructureData::numGroups
int32_t numGroups
Definition: structure_data.hpp:169
mmtf::GroupType::groupName
std::string groupName
Definition: structure_data.hpp:55
mmtf::StructureData::zCoordList
std::vector< float > zCoordList
Definition: structure_data.hpp:177
mmtf::StructureData::chainNameList
std::vector< std::string > chainNameList
Definition: structure_data.hpp:188
mmtf::Entity::chainIndexList
std::vector< int32_t > chainIndexList
Definition: structure_data.hpp:78
mmtf::StructureData::numModels
int32_t numModels
Definition: structure_data.hpp:171
mmtf::Entity::MSGPACK_DEFINE_MAP
MSGPACK_DEFINE_MAP(chainIndexList, description, type, sequence)
mmtf::GroupType::formalChargeList
std::vector< int32_t > formalChargeList
Definition: structure_data.hpp:50
mmtf::StructureData::depositionDate
std::string depositionDate
Definition: structure_data.hpp:158
mmtf::StructureData::bondOrderList
std::vector< int8_t > bondOrderList
Definition: structure_data.hpp:174
mmtf::is_hetatm
bool is_hetatm(const char *type)
Check if type is hetatm.
Definition: structure_data.hpp:402
mmtf::Entity::sequence
std::string sequence
Definition: structure_data.hpp:81
mmtf::GroupType::singleLetterCode
char singleLetterCode
Definition: structure_data.hpp:56
mmtf
Definition: binary_decoder.hpp:24
mmtf::BioAssembly::MSGPACK_DEFINE_MAP
MSGPACK_DEFINE_MAP(transformList, name)
mmtf::StructureData::chainIdList
std::vector< std::string > chainIdList
Definition: structure_data.hpp:187
mmtf::BioAssembly::name
std::string name
Definition: structure_data.hpp:128
mmtf::StructureData::title
std::string title
Definition: structure_data.hpp:157
mmtf::StructureData::releaseDate
std::string releaseDate
Definition: structure_data.hpp:159
mmtf::StructureData::mmtfVersion
std::string mmtfVersion
Definition: structure_data.hpp:152
mmtf::GroupType::bondOrderList
std::vector< int8_t > bondOrderList
Definition: structure_data.hpp:54