OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
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_; }
859  MMCifInfoStructRefSeqPtr AddAlignedSeq(const String& align_id,
860  const String& chain_name, int seq_begin,
861  int seq_end, int db_begin, int db_end);
862  MMCifInfoStructRefSeqPtr GetAlignedSeq(const String& align_id) const;
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 
926 public:
928  mol::AtomHandle atom2,
929  unsigned char bond_order):
930 atom1_(atom1), atom2_(atom2), bond_order_(bond_order) {}
931  mol::AtomHandle GetAtom1() const { return atom1_;}
932  mol::AtomHandle GetAtom2() const { return atom2_; }
933  unsigned char GetBondOrder() const { return bond_order_; }
934  void SetAtom1(mol::AtomHandle atom) { atom1_ = atom; }
935  void SetAtom2(mol::AtomHandle atom) { atom2_ = atom; }
936  void SetBondOrder(unsigned char bond_order) { bond_order_ = bond_order; }
938  editor.Connect(atom1_, atom2_, bond_order_);
939  }
940 
941  bool operator==(const MMCifInfoEntityBranchLink& eb) const {
942  if (this->atom1_ != eb.atom1_) {
943  return false;
944  }
945  if (this->atom2_ != eb.atom2_) {
946  return false;
947  }
948  return true;
949  }
950 
951  bool operator!=(const MMCifInfoEntityBranchLink& eb) const {
952  return !this->operator == (eb);
953  }
954 
955 private:
956  mol::AtomHandle atom1_;
957  mol::AtomHandle atom2_;
958  unsigned char bond_order_;
959 };
960 typedef std::map<String, std::vector<MMCifInfoEntityBranchLink> > MMCifInfoEntityBranchLinkMap;
961 
976 public:
978  MMCifInfo(): exptl_method_(""), resolution_(0), r_free_(0), r_work_(0) { }
979 
983  void AddCitation(MMCifInfoCitation citation) // unit test
984  {
985  citations_.push_back(citation);
986  }
987 
992  void AddAuthorsToCitation(StringRef id, std::vector<String> list,
993  bool fault_tolerant=false); //unit test
994 
998  const std::vector<MMCifInfoCitation>& GetCitations() const
999  {
1000  return citations_;
1001  }
1002 
1006  void SetMethod(String method) { exptl_method_ = method; }
1007 
1011  const StringRef GetMethod() const
1012  {
1013  return StringRef(exptl_method_.c_str(), exptl_method_.length());
1014  }
1015 
1019  void SetResolution(Real res) { resolution_ = res; }
1020 
1024  Real GetResolution() const { return resolution_; }
1025 
1029  void SetRFree(Real r_free) { r_free_ = r_free; }
1030 
1034  Real GetRFree() const { return r_free_; }
1035 
1039  void SetRWork(Real r_work) { r_work_ = r_work; }
1040 
1044  Real GetRWork() const { return r_work_; }
1045 
1050  void AddMMCifPDBChainTr(String cif, String pdb);
1051 
1056  String GetMMCifPDBChainTr(String cif) const;
1057 
1062  void AddPDBMMCifChainTr(String pdb, String cif);
1063 
1068  String GetPDBMMCifChainTr(String pdb) const;
1069 
1074  void AddMMCifEntityIdTr(String cif, String ent_id);
1075 
1080  String GetMMCifEntityIdTr(String cif) const;
1081 
1085  void AddBioUnit(MMCifInfoBioUnit bu);
1086 
1090  const std::vector<MMCifInfoBioUnit>& GetBioUnits() const
1091  {
1092  return biounits_;
1093  }
1094 
1098  void AddOperation(MMCifInfoTransOpPtr op) // unit test
1099  {
1100  transops_.push_back(op);
1101  }
1102 
1106  const std::vector<MMCifInfoTransOpPtr>& GetOperations() const
1107  {
1108  return transops_;
1109  }
1110 
1115  {
1116  struct_details_ = details;
1117  }
1118 
1123  {
1124  return struct_details_;
1125  }
1126 
1131  {
1132  obsolete_ = obsolete;
1133  }
1134 
1139  {
1140  return obsolete_;
1141  }
1142  const MMCifInfoStructRefs& GetStructRefs() const { return struct_refs_; }
1143  void SetStructRefs(const MMCifInfoStructRefs& sr) { struct_refs_=sr; }
1144 
1149  {
1150  // only set once
1151  if (revisions_.GetDateOriginal() == "?") {
1152  revisions_.SetDateOriginal(date);
1153  }
1154  }
1155 
1158  void AddRevision(int num, String date, String status, int major = -1,
1159  int minor = -1)
1160  {
1161  revisions_.AddRevision(num, date, status, major, minor);
1162  }
1163 
1168  {
1169  return revisions_;
1170  }
1171 
1177  void AddEntityBranchLink(String chain_name,
1178  mol::AtomHandle atom1,
1179  mol::AtomHandle atom2,
1180  unsigned char bond_order);
1181 
1184  const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchLinks() const;
1185 
1189  const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchByChain(
1190  const String& chain_name) const;
1191 
1194  const std::vector<String> GetEntityBranchChainNames() const;
1195 
1198  const mol::ChainHandleList GetEntityBranchChains() const;
1199 
1202  void ConnectBranchLinks();
1203 
1204 //protected:
1205 
1206 private:
1207  // members
1208  String exptl_method_;
1209  Real resolution_;
1210  Real r_free_;
1211  Real r_work_;
1212  MMCifInfoStructDetails struct_details_;
1213  MMCifInfoObsolete obsolete_;
1214  MMCifInfoRevisions revisions_;
1215  std::vector<MMCifInfoCitation> citations_;
1216  std::vector<MMCifInfoBioUnit> biounits_;
1217  std::vector<MMCifInfoTransOpPtr> transops_;
1218  MMCifInfoStructRefs struct_refs_;
1219  std::map<String, String> cif_2_pdb_chain_id_;
1220  std::map<String, String> pdb_2_cif_chain_id_;
1221  std::map<String, String> cif_2_entity_id_;
1222  std::map<String, std::vector<MMCifInfoEntityBranchLink> > entity_branches_;
1223 };
1224 
1225 DLLEXPORT_OST_IO std::ostream& operator<<(std::ostream& os,
1226  const MMCifInfoEntityBranchLink& eb);
1227 
1228 DLLEXPORT_OST_IO std::ostream& operator<<(std::ostream& os,
1229  const std::vector<MMCifInfoEntityBranchLink>& eb_list);
1230 }} // ns
1231 
1232 #endif
void SetID(String id)
Set ID.
Definition: mmcif_info.hh:409
const std::vector< MMCifInfoCitation > & GetCitations() const
Get the list of citations stored in an info object.
Definition: mmcif_info.hh:998
void SetCitationTypeUnknown()
Set the type of a publication to unknown.
Definition: mmcif_info.hh:558
container class for information on obsolete entries
Definition: mmcif_info.hh:687
String GetID()
Get type of entry.
Definition: mmcif_info.hh:719
const std::vector< std::vector< MMCifInfoTransOpPtr > > & GetOperations() const
Get the list of operations.
Definition: mmcif_info.hh:329
MMCifInfoObsolete GetObsoleteInfo() const
Get information on an obsolete entries.
Definition: mmcif_info.hh:1138
const StringRef GetMethod() const
Get an experimental method.
Definition: mmcif_info.hh:1011
bool operator!=(const MMCifInfoStructDetails &sd) const
Definition: mmcif_info.hh:142
void AddRevision(int num, String date, String status, int major=-1, int minor=-1)
Add a revision to history.
Definition: mmcif_info.hh:1158
convenient datatype for referencing character data
Definition: string_ref.hh:39
void SetTitle(String title)
Set the title of a publication.
Definition: mmcif_info.hh:533
String GetBookPublisher() const
Get the publisher of a book.
Definition: mmcif_info.hh:482
void SetPubMed(int no)
Set the PubMed accession number.
Definition: mmcif_info.hh:511
const std::vector< std::pair< int, int > > & GetOperationsIntervalList() const
Get the list of intervals of operations.
Definition: mmcif_info.hh:321
void SetAuthorList(std::vector< String > list)
Set the list of authors.
Definition: mmcif_info.hh:591
void SetObsoleteInfo(MMCifInfoObsolete obsolete)
Add a block of information on obsolete entries.
Definition: mmcif_info.hh:1130
boost::shared_ptr< MMCifInfoStructRefSeqDif > MMCifInfoStructRefSeqDifPtr
Definition: mmcif_info.hh:841
const String & GetDBAccess() const
Definition: mmcif_info.hh:858
String GetISBN() const
Get an ISBN code.
Definition: mmcif_info.hh:432
std::vector< MMCifInfoStructRefSeqDifPtr > MMCifInfoStructRefSeqDifs
Definition: mmcif_info.hh:845
const MMCifInfoStructRefs & GetStructRefs() const
Definition: mmcif_info.hh:1142
MMCifInfo()
Create an info object.
Definition: mmcif_info.hh:978
container class for additional information from MMCif files
Definition: mmcif_info.hh:975
String GetDetails() const
Get details.
Definition: mmcif_info.hh:277
std::vector< MMCifInfoStructRefSeqPtr > MMCifInfoStructRefSeqs
Definition: mmcif_info.hh:844
const MMCifInfoStructDetails GetStructDetails() const
Get the list of details about structures.
Definition: mmcif_info.hh:1122
int GetMajor(size_t i) const
Definition: mmcif_info.hh:803
void SetType(String type)
Set type.
Definition: mmcif_info.hh:177
MMCifInfoStructDetails()
Create a details object.
Definition: mmcif_info.hh:37
void SetModelTypeDetails(String desc)
Set a description for the type of the structure model.
Definition: mmcif_info.hh:98
void SetMethod(String method)
Set an experimental method.
Definition: mmcif_info.hh:1006
bool IsCitationTypeUnknown() const
Check if the citation type is unknow.
Definition: mmcif_info.hh:584
void SetCitationTypeBook()
Set the type of a publication to book.
Definition: mmcif_info.hh:553
std::string String
Definition: base.hh:54
void SetPublishedIn(String title)
Set a book title or journal name.
Definition: mmcif_info.hh:437
Handle to atom datatype.
Definition: atom_handle.hh:37
float Real
Definition: base.hh:44
char GetCASPFlag() const
Get CASP flag.
Definition: mmcif_info.hh:57
void SetMethodDetails(String method_details)
Set method details.
Definition: mmcif_info.hh:282
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
void SetCitationType(MMCifInfoCType publication_type)
Set the type of a publication.
Definition: mmcif_info.hh:543
void SetDetails(String details)
Set details.
Definition: mmcif_info.hh:273
void SetID(String id)
Set id.
Definition: mmcif_info.hh:168
Real GetResolution() const
Get resolution.
Definition: mmcif_info.hh:1024
MMCifInfoCType GetCitationType() const
Get the type of a publication.
Definition: mmcif_info.hh:565
void AddCitation(MMCifInfoCitation citation)
Add an item to the list of citations.
Definition: mmcif_info.hh:983
bool operator!=(const MMCifInfoBioUnit &bu) const
Definition: mmcif_info.hh:379
boost::shared_ptr< MMCifInfoStructRef > MMCifInfoStructRefPtr
Definition: mmcif_info.hh:836
const String & GetDBName() const
Definition: mmcif_info.hh:855
int GetMinor(size_t i) const
Definition: mmcif_info.hh:804
String GetBookPublisherCity() const
Get the publisher city of a book.
Definition: mmcif_info.hh:494
const String & GetDetails() const
Definition: mmcif_info.hh:916
String GetVolume() const
Get a journal volume.
Definition: mmcif_info.hh:452
def Merge
Definition: table.py:3130
std::map< String, std::vector< MMCifInfoEntityBranchLink > > MMCifInfoEntityBranchLinkMap
Definition: mmcif_info.hh:960
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
String GetID() const
Get ID.
Definition: mmcif_info.hh:413
const std::vector< MMCifInfoStructRefSeqDifPtr > & GetDifs() const
Definition: mmcif_info.hh:899
boost::shared_ptr< MMCifInfoTransOp > MMCifInfoTransOpPtr
Definition: mmcif_info.hh:248
Container class for information on file revisions See Python doc.
Definition: mmcif_info.hh:766
void SetRWork(Real r_work)
Set R-work value.
Definition: mmcif_info.hh:1039
String GetTitle() const
Get the title of a publication.
Definition: mmcif_info.hh:538
String GetLastDate() const
Definition: mmcif_info.hh:807
const String & GetDBID() const
Definition: mmcif_info.hh:856
std::vector< MMCifInfoStructRefPtr > MMCifInfoStructRefs
Definition: mmcif_info.hh:843
void SetTitle(String title)
Set a title for the data block.
Definition: mmcif_info.hh:107
void SetRevisionsDateOriginal(String date)
Set date_original of revisions.
Definition: mmcif_info.hh:1148
Real GetMass() const
Get molecular weight.
Definition: mmcif_info.hh:75
MMCifInfoBioUnit()
Create a biounit.
Definition: mmcif_info.hh:254
String GetDate()
Get the date string.
Definition: mmcif_info.hh:701
void SetCAS(String id)
Set a CAS identifier.
Definition: mmcif_info.hh:418
const std::vector< String > & GetChainList() const
Get vector of chain names.
Definition: mmcif_info.hh:303
void SetResolution(Real res)
Set resolution.
Definition: mmcif_info.hh:1019
void SetReplacedPDBID(String id)
Set id of replaced entry.
Definition: mmcif_info.hh:743
const String & GetID() const
Definition: mmcif_info.hh:854
String GetCAS() const
Get a CAS identifier.
Definition: mmcif_info.hh:422
void AddOperation(MMCifInfoTransOpPtr op)
Add a operation.
Definition: mmcif_info.hh:1098
geom::Vec3 GetVector() const
Get the translational vector.
Definition: mmcif_info.hh:197
const std::vector< String > & GetAuthorList() const
Get the list of authors.
Definition: mmcif_info.hh:596
int GetPubMed() const
Get the PubMed accession number.
Definition: mmcif_info.hh:516
bool operator!=(const MMCifInfoCitation &cit) const
Definition: mmcif_info.hh:663
const String & GetDBRNum() const
Definition: mmcif_info.hh:915
const std::vector< MMCifInfoTransOpPtr > & GetOperations() const
Get the list of operations stored in an info object.
Definition: mmcif_info.hh:1106
String GetID() const
Get id.
Definition: mmcif_info.hh:172
void SetEntryID(String id)
Set id.
Definition: mmcif_info.hh:44
size_t GetFirstRelease() const
Definition: mmcif_info.hh:819
bool operator==(const MMCifInfoCitation &cit) const
Definition: mmcif_info.hh:598
void SetDateOriginal(String date)
Definition: mmcif_info.hh:772
void SetCASPFlag(char flag)
Set CASP flag.
Definition: mmcif_info.hh:53
void SetDate(String date)
Set date of replacement.
Definition: mmcif_info.hh:696
MMCifInfoTransOp()
Create an operation.
Definition: mmcif_info.hh:160
Real GetRWork() const
Get R-work value.
Definition: mmcif_info.hh:1044
String GetPublishedIn() const
Get a book title or journal name.
Definition: mmcif_info.hh:442
const std::vector< std::pair< int, int > > & GetChainIntervalList() const
Get the list of intervals of chains.
Definition: mmcif_info.hh:308
MMCifInfoStructRefSeqDif(int seq_rnum, const String &db_rnum, const String &details)
Definition: mmcif_info.hh:912
bool operator==(const MMCifInfoStructDetails &sd) const
Definition: mmcif_info.hh:113
Three dimensional vector class, using Real precision.
Definition: vec3.hh:43
void SetStructDetails(MMCifInfoStructDetails details)
Add a set of structure details.
Definition: mmcif_info.hh:1114
external coordinate system editor
Definition: xcs_editor.hh:36
void AddRevision(int num, String date, String status, int major=-1, int minor=-1)
Definition: mmcif_info.hh:776
void SetID(String id)
Set id.
Definition: mmcif_info.hh:264
String GetDate(size_t i) const
Definition: mmcif_info.hh:800
void SetMassMethod(String method)
Set the method how the molecular weight was detected.
Definition: mmcif_info.hh:80
bool IsCitationTypeBook() const
Check a citation to be published in a book.
Definition: mmcif_info.hh:577
#define DLLEXPORT_OST_IO
String GetType() const
Get type.
Definition: mmcif_info.hh:181
void SetStructRefs(const MMCifInfoStructRefs &sr)
Definition: mmcif_info.hh:1143
String GetModelDetails() const
Get the details how the structure was determined.
Definition: mmcif_info.hh:93
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
void SetRFree(Real r_free)
Set R-free value.
Definition: mmcif_info.hh:1029
boost::shared_ptr< MMCifInfoStructRefSeq > MMCifInfoStructRefSeqPtr
Definition: mmcif_info.hh:840
void SetBookPublisherCity(String publisher_city)
Set the publisher city for a book.
Definition: mmcif_info.hh:487
bool operator==(const MMCifInfoBioUnit &bu) const
Definition: mmcif_info.hh:334
bool IsCitationTypeJournal() const
Check a citation to be published in a journal.
Definition: mmcif_info.hh:570
void SetPageFirst(String first)
Set the start page for a publication.
Definition: mmcif_info.hh:457
void SetMass(Real mass)
Set mass.
Definition: mmcif_info.hh:71
String GetPageFirst() const
Get the start page of a publication.
Definition: mmcif_info.hh:462
void SetID(StringRef type)
Set type of entry.
Definition: mmcif_info.hh:706
void SetBookPublisher(String publisher)
Set the publisher for a book.
Definition: mmcif_info.hh:477
const String & GetEntityID() const
Definition: mmcif_info.hh:857
String GetID() const
Get id.
Definition: mmcif_info.hh:268
String GetMassMethod() const
Get the method how the molecular weight was determined.
Definition: mmcif_info.hh:84
int GetYear() const
Get the year of a publication.
Definition: mmcif_info.hh:527
String GetEntryID() const
Get id.
Definition: mmcif_info.hh:48
const String & GetID() const
Definition: mmcif_info.hh:891
const String & GetChainName() const
Definition: mmcif_info.hh:892
void SetModelDetails(String desc)
Set the description about the production of this structure.
Definition: mmcif_info.hh:89
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
MMCifInfoObsolete()
Create an object of information about an obsolete entry.
Definition: mmcif_info.hh:690
void SetPageLast(String last)
Set the end page for a publication.
Definition: mmcif_info.hh:467
void SetCitationTypeJournal()
Set the type of a publication to journal.
Definition: mmcif_info.hh:548
String GetMethodDetails() const
Get method details.
Definition: mmcif_info.hh:288
String GetDateOriginal() const
Definition: mmcif_info.hh:773
std::ostream & operator<<(std::ostream &stream, const FormattedLine &line)
BondHandle Connect(const AtomHandle &first, const AtomHandle &second)
connect two atoms with bond
bool operator==(const MMCifInfoTransOp &op) const
Definition: mmcif_info.hh:221
String GetDOI() const
Get the DOI of a document.
Definition: mmcif_info.hh:506
String GetPageLast() const
Get the last page of a publication.
Definition: mmcif_info.hh:472
MMCifInfoRevisions()
Start recording a revision process.
Definition: mmcif_info.hh:769
void SetISBN(String code)
Set an ISBN code.
Definition: mmcif_info.hh:427
Real GetRFree() const
Get R-free value.
Definition: mmcif_info.hh:1034
String GetStatus(size_t i) const
Definition: mmcif_info.hh:802
void SetDescriptor(String desc)
Set descriptor.
Definition: mmcif_info.hh:62
bool operator!=(const MMCifInfoTransOp &op) const
Definition: mmcif_info.hh:238
MMCifInfoStructRefSeqs GetAlignedSeqs() const
Definition: mmcif_info.hh:863
const std::vector< MMCifInfoBioUnit > & GetBioUnits() const
Get the list of biounits stored in an info object.
Definition: mmcif_info.hh:1090
String GetDescriptor() const
Get CASP flag.
Definition: mmcif_info.hh:66
int GetNum(size_t i) const
Definition: mmcif_info.hh:801
MMCifInfoRevisions GetRevisions() const
Get history.
Definition: mmcif_info.hh:1167
String GetModelTypeDetails() const
Get the description for the type of the structure model.
Definition: mmcif_info.hh:102
std::vector< ChainHandle > ChainHandleList
String GetPDBID()
Get id of replacement.
Definition: mmcif_info.hh:738
geom::Mat3 GetMatrix() const
Get the rotational matrix.
Definition: mmcif_info.hh:219
void SetVector(Real x, Real y, Real z)
Set the translational vector.
Definition: mmcif_info.hh:188
MMCifInfoCitation()
Create a citation.
Definition: mmcif_info.hh:403
String GetTitle() const
Get the title of the structure model.
Definition: mmcif_info.hh:111
void SetYear(int year)
Set the year of a publication.
Definition: mmcif_info.hh:521
void SetPDBID(String id)
Set id of replacement.
Definition: mmcif_info.hh:733
void SetVolume(String volume)
Set a journal volume.
Definition: mmcif_info.hh:447
void SetDOI(String doi)
Set the DOI of a document.
Definition: mmcif_info.hh:501
String GetReplacedPDBID()
Get id of replaced entry.
Definition: mmcif_info.hh:748