OpenStructure
mmcif_info.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_MMCIF_INFO_HH
20 #define OST_MMCIF_INFO_HH
21 
22 #include <vector>
23 #include <map>
24 #include <boost/shared_ptr.hpp>
25 #include <ost/seq/sequence_list.hh>
26 #include <ost/geom/geom.hh>
27 #include <ost/string_ref.hh>
28 #include <ost/io/module_config.hh>
29 #include <ost/mol/mol.hh>
30 #include <ost/io/io_exception.hh>
31 
32 namespace ost { namespace io {
33 
35 public:
37  MMCifInfoStructDetails(): entry_id_(""), title_(""), casp_flag_('\0'),
38  descriptor_(""), mass_(0.0), mass_method_(""), model_details_(""),
39  model_type_details_("") {};
40 
44  void SetEntryID(String id) { entry_id_ = id; }
48  String GetEntryID() const { return entry_id_; }
49 
53  void SetCASPFlag(char flag) { casp_flag_ = flag; }
57  char GetCASPFlag() const { return casp_flag_; }
58 
62  void SetDescriptor(String desc) { descriptor_ = desc; }
66  String GetDescriptor() const { return descriptor_; }
67 
71  void SetMass(Real mass) { mass_ = mass; }
75  Real GetMass() const { return mass_; }
76 
80  void SetMassMethod(String method) { mass_method_ = method; }
84  String GetMassMethod() const { return mass_method_; }
85 
89  void SetModelDetails(String desc) { model_details_ = desc; }
93  String GetModelDetails() const { return model_details_; }
94 
98  void SetModelTypeDetails(String desc) { model_type_details_ = desc; }
102  String GetModelTypeDetails() const { return model_type_details_; }
103 
107  void SetTitle(String title) { title_ = title; }
111  String GetTitle() const { return title_; }
112 
113  bool operator==(const MMCifInfoStructDetails& sd) const {
114  if (this->entry_id_ != sd.entry_id_) {
115  return false;
116  }
117  if (this->casp_flag_ != sd.casp_flag_) {
118  return false;
119  }
120  if (this->descriptor_ != sd.descriptor_) {
121  return false;
122  }
123  if (this->mass_ != sd.mass_) {
124  return false;
125  }
126  if (this->mass_method_ != sd.mass_method_) {
127  return false;
128  }
129  if (this->model_details_ != sd.model_details_) {
130  return false;
131  }
132  if (this->model_type_details_ != sd.model_type_details_) {
133  return false;
134  }
135  if (this->title_ != sd.title_) {
136  return false;
137  }
138 
139  return true;
140  }
141 
142  bool operator!=(const MMCifInfoStructDetails& sd) const {
143  return !this->operator == (sd);
144  }
145 
146 private:
147  String entry_id_;
148  String title_;
149  char casp_flag_;
150  String descriptor_;
151  Real mass_;
152  String mass_method_;
153  String model_details_;
154  String model_type_details_;
155 };
156 
158 public:
160  MMCifInfoTransOp(): id_(""), type_("")
161  {
162  translation_ = geom::Vec3();
163  };
164 
168  void SetID(String id) { id_ = id; }
172  String GetID() const { return id_; }
173 
177  void SetType(String type) { type_ = type; }
181  String GetType() const { return type_; }
182 
188  void SetVector(Real x, Real y, Real z)
189  {
190  translation_.SetX(x);
191  translation_.SetY(y);
192  translation_.SetZ(z);
193  }
197  geom::Vec3 GetVector() const { return translation_; }
198 
210  void SetMatrix(Real i00, Real i01, Real i02,
211  Real i10, Real i11, Real i12,
212  Real i20, Real i21, Real i22)
213  {
214  rotation_ = geom::Mat3(i00,i01,i02, i10,i11,i12, i20,i21,i22);
215  }
219  geom::Mat3 GetMatrix() const { return rotation_; }
220 
221  bool operator==(const MMCifInfoTransOp& op) const {
222  if (this->id_ != op.id_) {
223  return false;
224  }
225  if (this->type_ != op.type_) {
226  return false;
227  }
228  if (this->translation_ != op.translation_) {
229  return false;
230  }
231  if (this->rotation_ != op.rotation_) {
232  return false;
233  }
234 
235  return true;
236  }
237 
238  bool operator!=(const MMCifInfoTransOp& op) const {
239  return !this->operator==(op);
240  }
241 
242 private:
243  String id_;
244  String type_;
245  geom::Vec3 translation_;
246  geom::Mat3 rotation_;
247 };
248 typedef boost::shared_ptr<MMCifInfoTransOp> MMCifInfoTransOpPtr;
249 
250 
252 public:
254  MMCifInfoBioUnit(): id_(""), details_("") {};
255 
259  void Merge(MMCifInfoBioUnit& from);
260 
264  void SetID(String id) { id_ = id; }
268  String GetID() const { return id_; }
269 
273  void SetDetails(String details) { details_ = details; }
277  String GetDetails() const { return details_; }
278 
282  void SetMethodDetails(String method_details) {
283  method_details_ = method_details;
284  }
288  String GetMethodDetails() const { return method_details_; }
289 
293  void AddChain(String chain);
294 
298  void SetChainList(std::vector<String> chains);
299 
303  const std::vector<String>& GetChainList() const { return chains_; }
304 
308  const std::vector<std::pair<int, int> >& GetChainIntervalList() const
309  {
310  return tr_chains_;
311  }
312 
316  void AddOperations(std::vector<MMCifInfoTransOpPtr> operations);
317 
321  const std::vector<std::pair<int, int> >& GetOperationsIntervalList() const
322  {
323  return tr_operations_;
324  }
325 
329  const std::vector<std::vector<MMCifInfoTransOpPtr> >& GetOperations() const
330  {
331  return operations_;
332  }
333 
334  bool operator==(const MMCifInfoBioUnit& bu) const {
335  if (this->id_ != bu.id_) {
336  return false;
337  }
338  if (this->details_ != bu.details_) {
339  return false;
340  }
341  if (this->chains_ != bu.chains_) {
342  return false;
343  }
344  if (this->tr_chains_ != bu.tr_chains_) {
345  return false;
346  }
347  if (this->tr_operations_ != bu.tr_operations_) {
348  return false;
349  }
350  if (this->operations_.size() == bu.operations_.size()) {
351  std::vector<std::vector<MMCifInfoTransOpPtr> >::const_iterator th_ops_it;
352  std::vector<std::vector<MMCifInfoTransOpPtr> >::const_iterator bu_ops_it;
353  std::vector<MMCifInfoTransOpPtr>::const_iterator th_op_it;
354  std::vector<MMCifInfoTransOpPtr>::const_iterator bu_op_it;
355 
356  for (th_ops_it = this->operations_.begin(),
357  bu_ops_it = bu.operations_.begin();
358  th_ops_it != this->operations_.end();
359  ++th_ops_it, ++bu_ops_it) {
360  if (th_ops_it->size() == bu_ops_it->size()) {
361  for (th_op_it = th_ops_it->begin(), bu_op_it = bu_ops_it->begin();
362  th_op_it != th_ops_it->end();
363  ++th_op_it, ++bu_op_it) {
364  if (*th_op_it != *bu_op_it) {
365  return false;
366  }
367  }
368  } else {
369  return false;
370  }
371  }
372  } else {
373  return false;
374  }
375 
376  return true;
377  }
378 
379  bool operator!=(const MMCifInfoBioUnit& bu) const {
380  return !this->operator==(bu);
381  }
382 
383 private:
384  String id_;
385  String details_;
386  String method_details_;
387  std::vector<String> chains_;
388  std::vector<std::pair<int, int> > tr_chains_; //< chains of a transformation
389  std::vector<std::vector<MMCifInfoTransOpPtr> > operations_;
390  std::vector<std::pair<int, int> > tr_operations_; //< ops. of a transformation
391 };
392 
394 public:
396  typedef enum {
399  UNKNOWN
400  } MMCifInfoCType;
401 
403  MMCifInfoCitation(): id_(""), where_(UNKNOWN), cas_(""), published_in_(""),
404  volume_(""), page_first_(""), page_last_(""), doi_(""), pubmed_(0),
405  year_(0), title_(""), book_publisher_(""), book_publisher_city_("") {};
409  void SetID(String id) { id_ = id; }
413  String GetID() const { return id_; }
414 
418  void SetCAS(String id) { cas_ = id; }
422  String GetCAS() const { return cas_; }
423 
427  void SetISBN(String code) { isbn_ = code; }
428 
432  String GetISBN() const { return isbn_; }
433 
437  void SetPublishedIn(String title) { published_in_ = title; }
438 
442  String GetPublishedIn() const { return published_in_; }
443 
447  void SetVolume(String volume) { volume_ = volume; }
448 
452  String GetVolume() const { return volume_; }
453 
457  void SetPageFirst(String first) { page_first_ = first; }
458 
462  String GetPageFirst() const { return page_first_; }
463 
467  void SetPageLast(String last) { page_last_ = last; }
468 
472  String GetPageLast() const { return page_last_; }
473 
477  void SetBookPublisher(String publisher) { book_publisher_ = publisher; }
478 
482  String GetBookPublisher() const { return book_publisher_; }
483 
487  void SetBookPublisherCity(String publisher_city) {
488  book_publisher_city_ = publisher_city;
489  }
490 
494  String GetBookPublisherCity() const { return book_publisher_city_; }
495 
496 //book_publisher_city_
497 
501  void SetDOI(String doi) { doi_ = doi; }
502 
506  String GetDOI() const { return doi_; }
507 
511  void SetPubMed(int no) { pubmed_ = no; }
512 
516  int GetPubMed() const { return pubmed_; }
517 
521  void SetYear(int year) { year_ = year; }
522 
523 
527  int GetYear() const { return year_; }
528 
529 
533  void SetTitle(String title) { title_ = title; }
534 
538  String GetTitle() const { return title_; }
539 
543  void SetCitationType(MMCifInfoCType publication_type) {
544  where_ = publication_type;
545  }
546 
550  }
551 
554  where_ = MMCifInfoCitation::BOOK;
555  }
556 
560  }
561 
565  MMCifInfoCType GetCitationType() const { return where_; }
566 
570  bool IsCitationTypeJournal() const {
571  return where_ == MMCifInfoCitation::JOURNAL;
572  }
573 
577  bool IsCitationTypeBook() const {
578  return where_ == MMCifInfoCitation::BOOK;
579  }
580 
584  bool IsCitationTypeUnknown() const {
585  return where_ == MMCifInfoCitation::UNKNOWN;
586  }
587 
591  void SetAuthorList(std::vector<String> list) { authors_ = list; }
592 
596  const std::vector<String>& GetAuthorList() const { return authors_; }
597 
598  bool operator==(const MMCifInfoCitation& cit) const {
599  if (this->year_ != cit.year_) {
600  return false;
601  }
602  if (this->pubmed_ != cit.pubmed_) {
603  return false;
604  }
605  if (this->where_ != cit.where_) {
606  return false;
607  }
608  if (StringRef(this->id_.c_str(), this->id_.length()) !=
609  StringRef(cit.id_.c_str(), cit.id_.length())) {
610  return false;
611  }
612  if (StringRef(this->cas_.c_str(), this->cas_.length()) !=
613  StringRef(cit.cas_.c_str(), cit.cas_.length())) {
614  return false;
615  }
616  if (StringRef(this->isbn_.c_str(), this->isbn_.length()) !=
617  StringRef(cit.isbn_.c_str(), cit.isbn_.length())) {
618  return false;
619  }
620  if (StringRef(this->published_in_.c_str(), this->published_in_.length()) !=
621  StringRef(cit.published_in_.c_str(), cit.published_in_.length())) {
622  return false;
623  }
624  if (StringRef(this->volume_.c_str(), this->volume_.length()) !=
625  StringRef(cit.volume_.c_str(), cit.volume_.length())) {
626  return false;
627  }
628  if (StringRef(this->page_first_.c_str(), this->page_first_.length()) !=
629  StringRef(cit.page_first_.c_str(), cit.page_first_.length())) {
630  return false;
631  }
632  if (StringRef(this->page_last_.c_str(), this->page_last_.length()) !=
633  StringRef(cit.page_last_.c_str(), cit.page_last_.length())) {
634  return false;
635  }
636  if (StringRef(this->doi_.c_str(), this->doi_.length()) !=
637  StringRef(cit.doi_.c_str(), cit.doi_.length())) {
638  return false;
639  }
640  if (StringRef(this->title_.c_str(), this->title_.length()) !=
641  StringRef(cit.title_.c_str(), cit.title_.length())) {
642  return false;
643  }
644  if (StringRef(this->book_publisher_.c_str(),
645  this->book_publisher_.length()) !=
646  StringRef(cit.book_publisher_.c_str(),
647  cit.book_publisher_.length())) {
648  return false;
649  }
650  if (StringRef(this->book_publisher_city_.c_str(),
651  this->book_publisher_city_.length()) !=
652  StringRef(cit.book_publisher_city_.c_str(),
653  cit.book_publisher_city_.length())) {
654  return false;
655  }
656  if (this->authors_ != cit.authors_) {
657  return false;
658  }
659 
660  return true;
661  }
662 
663  bool operator!=(const MMCifInfoCitation& cit) const {
664  return !this->operator==(cit);
665  }
666 
667 private:
668  String id_;
669  MMCifInfoCType where_;
670  String cas_;
671  String isbn_;
672  String published_in_;
673  String volume_;
674  String page_first_;
675  String page_last_;
676  String doi_;
677  int pubmed_;
678  int year_;
679  String title_;
680  String book_publisher_;
681  String book_publisher_city_;
682  std::vector<String> authors_;
683 };
684 
688 public:
690  MMCifInfoObsolete(): date_(""), id_(UNKNOWN), pdb_id_(""),
691  replaced_pdb_id_("") {};
692 
696  void SetDate(String date) { date_ = date; }
697 
701  String GetDate() { return date_; }
702 
706  void SetID(StringRef type)
707  {
708  if (type == StringRef("OBSLTE", 6)) {
709  id_ = OBSLTE;
710  }
711  else if (type == StringRef("SPRSDE", 6)) {
712  id_ = SPRSDE;
713  }
714  }
715 
720  {
721  if (id_ == OBSLTE) {
722  return "Obsolete";
723  }
724  if (id_ == SPRSDE) {
725  return "Supersede";
726  }
727  return "Unknown";
728  }
729 
733  void SetPDBID(String id) { pdb_id_ = id; }
734 
738  String GetPDBID() { return pdb_id_; }
739 
743  void SetReplacedPDBID(String id) { replaced_pdb_id_ = id; }
744 
748  String GetReplacedPDBID() { return replaced_pdb_id_; }
749 
750 private:
752  typedef enum {
753  OBSLTE,
754  SPRSDE,
755  UNKNOWN
756  } MMCifObsoleteType;
757 
758  String date_;
759  MMCifObsoleteType id_;
760  String pdb_id_;
761  String replaced_pdb_id_;
762 };
763 
767 public:
769  MMCifInfoRevisions(): date_original_("?"), first_release_(0) {};
770 
771  // original depositon date
772  void SetDateOriginal(String date) { date_original_ = date; }
773  String GetDateOriginal() const { return date_original_; }
774 
775  // revision history
776  void AddRevision(int num, String date, String status, int major = -1,
777  int minor = -1)
778  {
779  if (num_.size() && (num_.back() >= num)) {
780  std::stringstream ss;
781  ss << "Unique ID of revision has to increase with every revision, "
782  << "last was " << num_.back() << ", trying to add " << num;
783  throw IOException(ss.str());
784  }
785  num_.push_back(num);
786  date_.push_back(date);
787  status_.push_back(status);
788  major_.push_back(major);
789  minor_.push_back(minor);
790  // set first release date if not already occupied
791  if (first_release_ == 0) {
792  if (status == "full release" || status == "Initial release") {
793  first_release_ = status_.size();
794  }
795  }
796  }
797 
798  // revision history getters
799  size_t GetSize() const { return num_.size(); }
800  String GetDate(size_t i) const { return date_.at(i); }
801  int GetNum(size_t i) const { return num_.at(i); }
802  String GetStatus(size_t i) const { return status_.at(i); }
803  int GetMajor(size_t i) const { return major_.at(i); }
804  int GetMinor(size_t i) const { return minor_.at(i); }
805 
806  // get info of first and last revision
807  String GetLastDate() const {
808  if (date_.empty()) return "?";
809  else return date_.back();
810  }
811  int GetLastMajor() const {
812  if (major_.empty()) return -1;
813  else return major_.back();
814  }
815  int GetLastMinor() const {
816  if (minor_.empty()) return -1;
817  else return minor_.back();
818  }
819  size_t GetFirstRelease() const {
820  return first_release_;
821  }
822 
823 private:
824  String date_original_;
825  size_t first_release_;
826  std::vector<int> num_;
827  std::vector<String> date_;
828  std::vector<String> status_;
829  std::vector<int> major_;
830  std::vector<int> minor_;
831 };
832 
833 
834 class MMCifInfoStructRef;
835 class MMCifInfoStructRefSeq;
836 class MMCifInfoStructRefSeqDif;
837 
838 
839 typedef boost::shared_ptr<MMCifInfoStructRef> MMCifInfoStructRefPtr;
840 typedef boost::shared_ptr<MMCifInfoStructRefSeq> MMCifInfoStructRefSeqPtr;
841 typedef boost::shared_ptr<MMCifInfoStructRefSeqDif> MMCifInfoStructRefSeqDifPtr;
842 
843 typedef std::vector<MMCifInfoStructRefPtr> MMCifInfoStructRefs;
844 typedef std::vector<MMCifInfoStructRefSeqPtr> MMCifInfoStructRefSeqs;
845 typedef std::vector<MMCifInfoStructRefSeqDifPtr> MMCifInfoStructRefSeqDifs;
847 public:
848  MMCifInfoStructRef(const String& id, const String& ent_id,
849  const String& db_name,
850  const String& db_ident, const String& db_access):
851  id_(id), ent_id_(ent_id), db_name_(db_name), db_ident_(db_ident),
852  db_access_(db_access)
853  { }
854  const String& GetID() const { return id_; }
855  const String& GetDBName() const { return db_name_; }
856  const String& GetDBID() const { return db_ident_; }
857  const String& GetEntityID() const { return ent_id_; }
858  const String& GetDBAccess() const { return db_access_; }
860  const String& chain_name, int seq_begin,
861  int seq_end, int db_begin, int db_end);
864  {
866  seqs.reserve(seqs_.size());
867  for (std::map<String, MMCifInfoStructRefSeqPtr>::const_iterator
868  i=seqs_.begin(), e=seqs_.end(); i!=e; ++i) {
869  seqs.push_back(i->second);
870  }
871  return seqs;
872  }
873 private:
874  String id_;
875  String ent_id_;
876  String db_name_;
877  String db_ident_;
878  String db_access_;
879  std::map<String, MMCifInfoStructRefSeqPtr> seqs_;
880 };
881 
883 public:
884  MMCifInfoStructRefSeq(const String& align_id, const String& chain_name,
885  int seq_begin, int seq_end,
886  int db_begin, int db_end):
887  id_(align_id), chain_name_(chain_name),
888  seq_begin_(seq_begin), seq_end_(seq_end), db_begin_(db_begin), db_end_(db_end)
889  { }
890 
891  const String& GetID() const { return id_; }
892  const String& GetChainName() const { return chain_name_; }
893  int GetSeqBegin() const { return seq_begin_; }
894  int GetSeqEnd() const { return seq_end_; }
895  int GetDBBegin() const { return db_begin_; }
896  int GetDBEnd() const { return db_end_; }
897  MMCifInfoStructRefSeqDifPtr AddDif(int seq_num, const String& db_rnum,
898  const String& details);
899  const std::vector<MMCifInfoStructRefSeqDifPtr>& GetDifs() const { return difs_; }
900 private:
901  String id_;
902  String chain_name_;
903  int seq_begin_;
904  int seq_end_;
905  int db_begin_;
906  int db_end_;
907  std::vector<MMCifInfoStructRefSeqDifPtr> difs_;
908 };
909 
911 public:
912  MMCifInfoStructRefSeqDif(int seq_rnum, const String& db_rnum, const String& details):
913  seq_rnum_(seq_rnum), db_rnum_(db_rnum), details_(details) {}
914  int GetSeqRNum() const { return seq_rnum_;}
915  const String& GetDBRNum() const { return db_rnum_; }
916  const String& GetDetails() const { return details_; }
917 private:
918  int seq_rnum_;
919  String db_rnum_;
920  String details_;
921 };
922 
927  int rnum2,
928  const String& aname1,
929  const String& aname2,
930  unsigned char bond_order): rnum1(rnum1), rnum2(rnum2),
931  aname1(aname1), aname2(aname2),
932  bond_order(bond_order) { }
933 
934  bool operator==(const MMCifInfoEntityBranchLink& rhs) const {
935  return rnum1 == rhs.rnum1 && rnum2 == rhs.rnum2 &&
936  aname1 == rhs.aname1 && aname2 == rhs.aname2 &&
937  bond_order == rhs.bond_order;
938  }
939 
940  bool operator!=(const MMCifInfoEntityBranchLink& rhs) const {
941  return !((*this) == rhs);
942  }
943 
944  int rnum1;
945  int rnum2;
948  unsigned char bond_order;
949 };
950 typedef std::map<String, std::vector<MMCifInfoEntityBranchLink> > MMCifInfoEntityBranchLinkMap;
951 
952 
954 typedef struct {
962  std::vector<String> mon_ids;
963  std::vector<int> hetero_num;
964  std::vector<String> hetero_ids;
966 typedef std::map<String, MMCifEntityDesc> MMCifEntityDescMap;
967 
968 
983 public:
985  MMCifInfo(): exptl_method_(""), resolution_(0), em_resolution_(0), r_free_(0),
986  r_work_(0) { }
987 
991  void AddCitation(MMCifInfoCitation citation) // unit test
992  {
993  citations_.push_back(citation);
994  }
995 
1000  void AddAuthorsToCitation(StringRef id, std::vector<String> list,
1001  bool fault_tolerant=false); //unit test
1002 
1006  const std::vector<MMCifInfoCitation>& GetCitations() const
1007  {
1008  return citations_;
1009  }
1010 
1014  void SetMethod(String method) { exptl_method_ = method; }
1015 
1019  const StringRef GetMethod() const
1020  {
1021  return StringRef(exptl_method_.c_str(), exptl_method_.length());
1022  }
1023 
1027  void SetResolution(Real res) { resolution_ = res; }
1028 
1032  Real GetResolution() const { return resolution_; }
1033 
1037  void SetEMResolution(Real res) { em_resolution_ = res; }
1038 
1042  Real GetEMResolution() const { return em_resolution_; }
1043 
1047  void SetRFree(Real r_free) { r_free_ = r_free; }
1048 
1052  Real GetRFree() const { return r_free_; }
1053 
1057  void SetRWork(Real r_work) { r_work_ = r_work; }
1058 
1062  Real GetRWork() const { return r_work_; }
1063 
1069  bool fault_tolerant=false);
1070 
1076 
1082  bool fault_tolerant=false);
1083 
1089 
1095  bool fault_tolerant=false);
1096 
1102 
1107 
1111  const std::vector<MMCifInfoBioUnit>& GetBioUnits() const
1112  {
1113  return biounits_;
1114  }
1115 
1119  void AddOperation(MMCifInfoTransOpPtr op) // unit test
1120  {
1121  transops_.push_back(op);
1122  }
1123 
1127  const std::vector<MMCifInfoTransOpPtr>& GetOperations() const
1128  {
1129  return transops_;
1130  }
1131 
1136  {
1137  struct_details_ = details;
1138  }
1139 
1144  {
1145  return struct_details_;
1146  }
1147 
1152  {
1153  obsolete_ = obsolete;
1154  }
1155 
1160  {
1161  return obsolete_;
1162  }
1163  const MMCifInfoStructRefs& GetStructRefs() const { return struct_refs_; }
1164  void SetStructRefs(const MMCifInfoStructRefs& sr) { struct_refs_=sr; }
1165 
1170  {
1171  // only set once
1172  if (revisions_.GetDateOriginal() == "?") {
1173  revisions_.SetDateOriginal(date);
1174  }
1175  }
1176 
1179  void AddRevision(int num, String date, String status, int major = -1,
1180  int minor = -1)
1181  {
1182  revisions_.AddRevision(num, date, status, major, minor);
1183  }
1184 
1189  {
1190  return revisions_;
1191  }
1192 
1198  void AddEntityBranchLink(String chain_name,
1199  int rnum1, int rnum2,
1200  const String& aname1,
1201  const String& aname2,
1202  unsigned char bond_order);
1203 
1207  const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchByChain(
1208  const String& chain_name) const;
1209 
1212  const std::vector<String> GetEntityBranchChainNames() const;
1213 
1214  const MMCifEntityDesc& GetEntityDesc(const String& entity_id) const;
1215 
1216  void SetEntityDesc(const String& entity_id,
1217  const MMCifEntityDesc& entity_desc);
1218 
1219  std::vector<String> GetEntityIds() const;
1220 
1221  std::vector<String> GetEntityIdsOfType(const String& type) const;
1222 
1223 //protected:
1224 
1225 private:
1226  // members
1227  String exptl_method_;
1228  Real resolution_;
1229  Real em_resolution_;
1230  Real r_free_;
1231  Real r_work_;
1232  MMCifInfoStructDetails struct_details_;
1233  MMCifInfoObsolete obsolete_;
1234  MMCifInfoRevisions revisions_;
1235  std::vector<MMCifInfoCitation> citations_;
1236  std::vector<MMCifInfoBioUnit> biounits_;
1237  std::vector<MMCifInfoTransOpPtr> transops_;
1238  MMCifInfoStructRefs struct_refs_;
1239  MMCifEntityDescMap entity_desc_;
1240  std::map<String, String> cif_2_pdb_chain_id_;
1241  std::map<String, String> pdb_2_cif_chain_id_;
1242  std::map<String, String> cif_2_entity_id_;
1243  std::map<String, std::vector<MMCifInfoEntityBranchLink> > entity_branches_;
1244 };
1245 
1246 DLLEXPORT_OST_IO std::ostream& operator<<(std::ostream& os,
1247  const MMCifInfoEntityBranchLink& eb);
1248 
1249 DLLEXPORT_OST_IO std::ostream& operator<<(std::ostream& os,
1250  const std::vector<MMCifInfoEntityBranchLink>& eb_list);
1251 }} // ns
1252 
1253 #endif
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
convenient datatype for referencing character data
Definition: string_ref.hh:39
void AddOperations(std::vector< MMCifInfoTransOpPtr > operations)
Add a set of operations.
void AddChain(String chain)
Add a chain name.
void Merge(MMCifInfoBioUnit &from)
Merge chains & operations, set intervals.
const std::vector< std::vector< MMCifInfoTransOpPtr > > & GetOperations() const
Get the list of operations.
Definition: mmcif_info.hh:329
const std::vector< std::pair< int, int > > & GetOperationsIntervalList() const
Get the list of intervals of operations.
Definition: mmcif_info.hh:321
bool operator!=(const MMCifInfoBioUnit &bu) const
Definition: mmcif_info.hh:379
void SetMethodDetails(String method_details)
Set method details.
Definition: mmcif_info.hh:282
const std::vector< std::pair< int, int > > & GetChainIntervalList() const
Get the list of intervals of chains.
Definition: mmcif_info.hh:308
void SetChainList(std::vector< String > chains)
Set a vector of chain names.
void SetID(String id)
Set id.
Definition: mmcif_info.hh:264
const std::vector< String > & GetChainList() const
Get vector of chain names.
Definition: mmcif_info.hh:303
void SetDetails(String details)
Set details.
Definition: mmcif_info.hh:273
String GetMethodDetails() const
Get method details.
Definition: mmcif_info.hh:288
String GetDetails() const
Get details.
Definition: mmcif_info.hh:277
MMCifInfoBioUnit()
Create a biounit.
Definition: mmcif_info.hh:254
String GetID() const
Get id.
Definition: mmcif_info.hh:268
bool operator==(const MMCifInfoBioUnit &bu) const
Definition: mmcif_info.hh:334
String GetISBN() const
Get an ISBN code.
Definition: mmcif_info.hh:432
void SetPubMed(int no)
Set the PubMed accession number.
Definition: mmcif_info.hh:511
void SetTitle(String title)
Set the title of a publication.
Definition: mmcif_info.hh:533
void SetCitationTypeUnknown()
Set the type of a publication to unknown.
Definition: mmcif_info.hh:558
void SetISBN(String code)
Set an ISBN code.
Definition: mmcif_info.hh:427
void SetCitationTypeJournal()
Set the type of a publication to journal.
Definition: mmcif_info.hh:548
void SetCAS(String id)
Set a CAS identifier.
Definition: mmcif_info.hh:418
String GetTitle() const
Get the title of a publication.
Definition: mmcif_info.hh:538
bool IsCitationTypeJournal() const
Check a citation to be published in a journal.
Definition: mmcif_info.hh:570
String GetPageLast() const
Get the last page of a publication.
Definition: mmcif_info.hh:472
int GetYear() const
Get the year of a publication.
Definition: mmcif_info.hh:527
void SetCitationTypeBook()
Set the type of a publication to book.
Definition: mmcif_info.hh:553
MMCifInfoCitation()
Create a citation.
Definition: mmcif_info.hh:403
void SetPageLast(String last)
Set the end page for a publication.
Definition: mmcif_info.hh:467
String GetCAS() const
Get a CAS identifier.
Definition: mmcif_info.hh:422
void SetBookPublisher(String publisher)
Set the publisher for a book.
Definition: mmcif_info.hh:477
void SetDOI(String doi)
Set the DOI of a document.
Definition: mmcif_info.hh:501
String GetDOI() const
Get the DOI of a document.
Definition: mmcif_info.hh:506
void SetAuthorList(std::vector< String > list)
Set the list of authors.
Definition: mmcif_info.hh:591
String GetPublishedIn() const
Get a book title or journal name.
Definition: mmcif_info.hh:442
MMCifInfoCType GetCitationType() const
Get the type of a publication.
Definition: mmcif_info.hh:565
void SetCitationType(MMCifInfoCType publication_type)
Set the type of a publication.
Definition: mmcif_info.hh:543
bool operator==(const MMCifInfoCitation &cit) const
Definition: mmcif_info.hh:598
bool operator!=(const MMCifInfoCitation &cit) const
Definition: mmcif_info.hh:663
bool IsCitationTypeUnknown() const
Check if the citation type is unknow.
Definition: mmcif_info.hh:584
bool IsCitationTypeBook() const
Check a citation to be published in a book.
Definition: mmcif_info.hh:577
void SetID(String id)
Set ID.
Definition: mmcif_info.hh:409
int GetPubMed() const
Get the PubMed accession number.
Definition: mmcif_info.hh:516
void SetBookPublisherCity(String publisher_city)
Set the publisher city for a book.
Definition: mmcif_info.hh:487
const std::vector< String > & GetAuthorList() const
Get the list of authors.
Definition: mmcif_info.hh:596
void SetPublishedIn(String title)
Set a book title or journal name.
Definition: mmcif_info.hh:437
String GetPageFirst() const
Get the start page of a publication.
Definition: mmcif_info.hh:462
void SetYear(int year)
Set the year of a publication.
Definition: mmcif_info.hh:521
void SetVolume(String volume)
Set a journal volume.
Definition: mmcif_info.hh:447
String GetBookPublisherCity() const
Get the publisher city of a book.
Definition: mmcif_info.hh:494
String GetBookPublisher() const
Get the publisher of a book.
Definition: mmcif_info.hh:482
void SetPageFirst(String first)
Set the start page for a publication.
Definition: mmcif_info.hh:457
String GetID() const
Get ID.
Definition: mmcif_info.hh:413
String GetVolume() const
Get a journal volume.
Definition: mmcif_info.hh:452
container class for additional information from MMCif files
Definition: mmcif_info.hh:982
const std::vector< MMCifInfoBioUnit > & GetBioUnits() const
Get the list of biounits stored in an info object.
Definition: mmcif_info.hh:1111
std::vector< String > GetEntityIds() const
const std::vector< MMCifInfoEntityBranchLink > GetEntityBranchByChain(const String &chain_name) const
Check if a chain is a branched entity and return it.
void SetEMResolution(Real res)
Set EM resolution.
Definition: mmcif_info.hh:1037
void SetMethod(String method)
Set an experimental method.
Definition: mmcif_info.hh:1014
MMCifInfo()
Create an info object.
Definition: mmcif_info.hh:985
MMCifInfoRevisions GetRevisions() const
Get history.
Definition: mmcif_info.hh:1188
void AddMMCifPDBChainTr(String cif, String pdb, bool fault_tolerant=false)
Add a new mmCIF/ PDB chain name tuple.
void AddMMCifEntityIdTr(String cif, String ent_id, bool fault_tolerant=false)
Add a new mmCIF chain name / entity ID tuple.
MMCifInfoObsolete GetObsoleteInfo() const
Get information on an obsolete entries.
Definition: mmcif_info.hh:1159
String GetPDBMMCifChainTr(String pdb) const
Get a CIF chain name for a PDB chain name.
Real GetEMResolution() const
Get EM resolution.
Definition: mmcif_info.hh:1042
void AddPDBMMCifChainTr(String pdb, String cif, bool fault_tolerant=false)
Add a new PDB/ mmCIF chain name tuple.
void AddEntityBranchLink(String chain_name, int rnum1, int rnum2, const String &aname1, const String &aname2, unsigned char bond_order)
Add bond information for a branched entity.
const std::vector< String > GetEntityBranchChainNames() const
Get the names of all chains of branched entities.
const MMCifInfoStructDetails GetStructDetails() const
Get the list of details about structures.
Definition: mmcif_info.hh:1143
Real GetRWork() const
Get R-work value.
Definition: mmcif_info.hh:1062
void SetResolution(Real res)
Set resolution.
Definition: mmcif_info.hh:1027
const MMCifEntityDesc & GetEntityDesc(const String &entity_id) const
Real GetRFree() const
Get R-free value.
Definition: mmcif_info.hh:1052
const MMCifInfoStructRefs & GetStructRefs() const
Definition: mmcif_info.hh:1163
const std::vector< MMCifInfoTransOpPtr > & GetOperations() const
Get the list of operations stored in an info object.
Definition: mmcif_info.hh:1127
void AddRevision(int num, String date, String status, int major=-1, int minor=-1)
Add a revision to history.
Definition: mmcif_info.hh:1179
void AddBioUnit(MMCifInfoBioUnit bu)
Add a biounit.
void SetStructRefs(const MMCifInfoStructRefs &sr)
Definition: mmcif_info.hh:1164
void AddOperation(MMCifInfoTransOpPtr op)
Add a operation.
Definition: mmcif_info.hh:1119
const StringRef GetMethod() const
Get an experimental method.
Definition: mmcif_info.hh:1019
void SetEntityDesc(const String &entity_id, const MMCifEntityDesc &entity_desc)
void AddAuthorsToCitation(StringRef id, std::vector< String > list, bool fault_tolerant=false)
Add a list of authors to a specific citation.
Real GetResolution() const
Get resolution.
Definition: mmcif_info.hh:1032
std::vector< String > GetEntityIdsOfType(const String &type) const
void SetStructDetails(MMCifInfoStructDetails details)
Add a set of structure details.
Definition: mmcif_info.hh:1135
void SetObsoleteInfo(MMCifInfoObsolete obsolete)
Add a block of information on obsolete entries.
Definition: mmcif_info.hh:1151
String GetMMCifEntityIdTr(String cif) const
Get the entity ID for a CIF chain name.
void SetRWork(Real r_work)
Set R-work value.
Definition: mmcif_info.hh:1057
const std::vector< MMCifInfoCitation > & GetCitations() const
Get the list of citations stored in an info object.
Definition: mmcif_info.hh:1006
void AddCitation(MMCifInfoCitation citation)
Add an item to the list of citations.
Definition: mmcif_info.hh:991
String GetMMCifPDBChainTr(String cif) const
Get a PDB chain name for a CIF chain name.
void SetRevisionsDateOriginal(String date)
Set date_original of revisions.
Definition: mmcif_info.hh:1169
void SetRFree(Real r_free)
Set R-free value.
Definition: mmcif_info.hh:1047
container class for information on obsolete entries
Definition: mmcif_info.hh:687
String GetID()
Get type of entry.
Definition: mmcif_info.hh:719
String GetPDBID()
Get id of replacement.
Definition: mmcif_info.hh:738
String GetDate()
Get the date string.
Definition: mmcif_info.hh:701
void SetReplacedPDBID(String id)
Set id of replaced entry.
Definition: mmcif_info.hh:743
MMCifInfoObsolete()
Create an object of information about an obsolete entry.
Definition: mmcif_info.hh:690
void SetPDBID(String id)
Set id of replacement.
Definition: mmcif_info.hh:733
void SetDate(String date)
Set date of replacement.
Definition: mmcif_info.hh:696
void SetID(StringRef type)
Set type of entry.
Definition: mmcif_info.hh:706
String GetReplacedPDBID()
Get id of replaced entry.
Definition: mmcif_info.hh:748
Container class for information on file revisions See Python doc.
Definition: mmcif_info.hh:766
MMCifInfoRevisions()
Start recording a revision process.
Definition: mmcif_info.hh:769
size_t GetFirstRelease() const
Definition: mmcif_info.hh:819
int GetNum(size_t i) const
Definition: mmcif_info.hh:801
int GetMinor(size_t i) const
Definition: mmcif_info.hh:804
void AddRevision(int num, String date, String status, int major=-1, int minor=-1)
Definition: mmcif_info.hh:776
String GetStatus(size_t i) const
Definition: mmcif_info.hh:802
String GetDateOriginal() const
Definition: mmcif_info.hh:773
void SetDateOriginal(String date)
Definition: mmcif_info.hh:772
String GetDate(size_t i) const
Definition: mmcif_info.hh:800
int GetMajor(size_t i) const
Definition: mmcif_info.hh:803
String GetLastDate() const
Definition: mmcif_info.hh:807
void SetTitle(String title)
Set a title for the data block.
Definition: mmcif_info.hh:107
char GetCASPFlag() const
Get CASP flag.
Definition: mmcif_info.hh:57
String GetTitle() const
Get the title of the structure model.
Definition: mmcif_info.hh:111
void SetEntryID(String id)
Set id.
Definition: mmcif_info.hh:44
String GetMassMethod() const
Get the method how the molecular weight was determined.
Definition: mmcif_info.hh:84
void SetMassMethod(String method)
Set the method how the molecular weight was detected.
Definition: mmcif_info.hh:80
MMCifInfoStructDetails()
Create a details object.
Definition: mmcif_info.hh:37
String GetModelTypeDetails() const
Get the description for the type of the structure model.
Definition: mmcif_info.hh:102
void SetCASPFlag(char flag)
Set CASP flag.
Definition: mmcif_info.hh:53
Real GetMass() const
Get molecular weight.
Definition: mmcif_info.hh:75
void SetModelDetails(String desc)
Set the description about the production of this structure.
Definition: mmcif_info.hh:89
String GetModelDetails() const
Get the details how the structure was determined.
Definition: mmcif_info.hh:93
void SetDescriptor(String desc)
Set descriptor.
Definition: mmcif_info.hh:62
String GetDescriptor() const
Get CASP flag.
Definition: mmcif_info.hh:66
void SetModelTypeDetails(String desc)
Set a description for the type of the structure model.
Definition: mmcif_info.hh:98
String GetEntryID() const
Get id.
Definition: mmcif_info.hh:48
bool operator==(const MMCifInfoStructDetails &sd) const
Definition: mmcif_info.hh:113
void SetMass(Real mass)
Set mass.
Definition: mmcif_info.hh:71
bool operator!=(const MMCifInfoStructDetails &sd) const
Definition: mmcif_info.hh:142
const String & GetDBAccess() const
Definition: mmcif_info.hh:858
const String & GetDBName() const
Definition: mmcif_info.hh:855
MMCifInfoStructRef(const String &id, const String &ent_id, const String &db_name, const String &db_ident, const String &db_access)
Definition: mmcif_info.hh:848
MMCifInfoStructRefSeqPtr AddAlignedSeq(const String &align_id, const String &chain_name, int seq_begin, int seq_end, int db_begin, int db_end)
MMCifInfoStructRefSeqs GetAlignedSeqs() const
Definition: mmcif_info.hh:863
const String & GetDBID() const
Definition: mmcif_info.hh:856
const String & GetEntityID() const
Definition: mmcif_info.hh:857
const String & GetID() const
Definition: mmcif_info.hh:854
MMCifInfoStructRefSeqPtr GetAlignedSeq(const String &align_id) const
const String & GetDBRNum() const
Definition: mmcif_info.hh:915
const String & GetDetails() const
Definition: mmcif_info.hh:916
MMCifInfoStructRefSeqDif(int seq_rnum, const String &db_rnum, const String &details)
Definition: mmcif_info.hh:912
const std::vector< MMCifInfoStructRefSeqDifPtr > & GetDifs() const
Definition: mmcif_info.hh:899
MMCifInfoStructRefSeq(const String &align_id, const String &chain_name, int seq_begin, int seq_end, int db_begin, int db_end)
Definition: mmcif_info.hh:884
const String & GetChainName() const
Definition: mmcif_info.hh:892
MMCifInfoStructRefSeqDifPtr AddDif(int seq_num, const String &db_rnum, const String &details)
const String & GetID() const
Definition: mmcif_info.hh:891
bool operator!=(const MMCifInfoTransOp &op) const
Definition: mmcif_info.hh:238
bool operator==(const MMCifInfoTransOp &op) const
Definition: mmcif_info.hh:221
void SetMatrix(Real i00, Real i01, Real i02, Real i10, Real i11, Real i12, Real i20, Real i21, Real i22)
Set the rotational matrix.
Definition: mmcif_info.hh:210
String GetType() const
Get type.
Definition: mmcif_info.hh:181
void SetVector(Real x, Real y, Real z)
Set the translational vector.
Definition: mmcif_info.hh:188
void SetType(String type)
Set type.
Definition: mmcif_info.hh:177
void SetID(String id)
Set id.
Definition: mmcif_info.hh:168
geom::Mat3 GetMatrix() const
Get the rotational matrix.
Definition: mmcif_info.hh:219
geom::Vec3 GetVector() const
Get the translational vector.
Definition: mmcif_info.hh:197
MMCifInfoTransOp()
Create an operation.
Definition: mmcif_info.hh:160
String GetID() const
Get id.
Definition: mmcif_info.hh:172
#define DLLEXPORT_OST_IO
float Real
Definition: base.hh:44
std::string String
Definition: base.hh:54
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
boost::shared_ptr< MMCifInfoTransOp > MMCifInfoTransOpPtr
Definition: mmcif_info.hh:248
boost::shared_ptr< MMCifInfoStructRefSeqDif > MMCifInfoStructRefSeqDifPtr
Definition: mmcif_info.hh:841
std::map< String, std::vector< MMCifInfoEntityBranchLink > > MMCifInfoEntityBranchLinkMap
Definition: mmcif_info.hh:950
std::vector< MMCifInfoStructRefSeqPtr > MMCifInfoStructRefSeqs
Definition: mmcif_info.hh:844
std::vector< MMCifInfoStructRefSeqDifPtr > MMCifInfoStructRefSeqDifs
Definition: mmcif_info.hh:845
std::vector< MMCifInfoStructRefPtr > MMCifInfoStructRefs
Definition: mmcif_info.hh:843
boost::shared_ptr< MMCifInfoStructRefSeq > MMCifInfoStructRefSeqPtr
Definition: mmcif_info.hh:840
std::map< String, MMCifEntityDesc > MMCifEntityDescMap
Definition: mmcif_info.hh:966
std::ostream & operator<<(std::ostream &stream, const FormattedLine &line)
boost::shared_ptr< MMCifInfoStructRef > MMCifInfoStructRefPtr
Definition: mmcif_info.hh:836
Definition: base.dox:1
String details
description of this entity
Definition: mmcif_info.hh:959
String seqres_pdbx
_entity_poly.pdbx_seq_one_letter_code
Definition: mmcif_info.hh:961
String branched_type
value of _pdbx_entity_branch.type
Definition: mmcif_info.hh:958
std::vector< String > hetero_ids
names of heterogeneous compounds
Definition: mmcif_info.hh:964
std::vector< int > hetero_num
res num of heterogeneous compounds
Definition: mmcif_info.hh:963
String seqres_canonical
_entity_poly.pdbx_seq_one_letter_code_can
Definition: mmcif_info.hh:960
String entity_poly_type
value of _entity_poly.type
Definition: mmcif_info.hh:957
mol::ChainType type
characterise entity
Definition: mmcif_info.hh:955
std::vector< String > mon_ids
list of monomer names from _entity_poly_seq
Definition: mmcif_info.hh:962
String entity_type
value of _entity.type
Definition: mmcif_info.hh:956