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 
34 class DLLEXPORT_OST_IO MMCifInfoStructDetails {
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 
157 class DLLEXPORT_OST_IO MMCifInfoTransOp {
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 
251 class DLLEXPORT_OST_IO MMCifInfoBioUnit {
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 
393 class DLLEXPORT_OST_IO MMCifInfoCitation {
394 public:
396  typedef enum {
397  JOURNAL,
398  BOOK,
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 
687 class DLLEXPORT_OST_IO MMCifInfoObsolete {
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 
766 class DLLEXPORT_OST_IO MMCifInfoRevisions {
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;
846 class DLLEXPORT_OST_IO MMCifInfoStructRef {
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 
882 class DLLEXPORT_OST_IO MMCifInfoStructRefSeq {
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 
910 class DLLEXPORT_OST_IO MMCifInfoStructRefSeqDif {
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 
925 class DLLEXPORT_OST_IO MMCifInfoEntityBranchLink {
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 
962 
964 typedef struct {
965  mol::ChainType type;
966  String entity_type;
967  String entity_poly_type;
968  String branched_type;
969  String details;
970  String seqres;
971  std::vector<String> mon_ids;
972  std::vector<int> hetero_num;
973  std::vector<String> hetero_ids;
974 } MMCifEntityDesc;
975 typedef std::map<String, MMCifEntityDesc> MMCifEntityDescMap;
976 
977 
991 class DLLEXPORT_OST_IO MMCifInfo {
992 public:
994  MMCifInfo(): exptl_method_(""), resolution_(0), em_resolution_(0), r_free_(0),
995  r_work_(0) { }
996 
1000  void AddCitation(MMCifInfoCitation citation) // unit test
1001  {
1002  citations_.push_back(citation);
1003  }
1004 
1009  void AddAuthorsToCitation(StringRef id, std::vector<String> list,
1010  bool fault_tolerant=false); //unit test
1011 
1015  const std::vector<MMCifInfoCitation>& GetCitations() const
1016  {
1017  return citations_;
1018  }
1019 
1023  void SetMethod(String method) { exptl_method_ = method; }
1024 
1028  const StringRef GetMethod() const
1029  {
1030  return StringRef(exptl_method_.c_str(), exptl_method_.length());
1031  }
1032 
1036  void SetResolution(Real res) { resolution_ = res; }
1037 
1041  Real GetResolution() const { return resolution_; }
1042 
1046  void SetEMResolution(Real res) { em_resolution_ = res; }
1047 
1051  Real GetEMResolution() const { return em_resolution_; }
1052 
1056  void SetRFree(Real r_free) { r_free_ = r_free; }
1057 
1061  Real GetRFree() const { return r_free_; }
1062 
1066  void SetRWork(Real r_work) { r_work_ = r_work; }
1067 
1071  Real GetRWork() const { return r_work_; }
1072 
1077  void AddMMCifPDBChainTr(String cif, String pdb);
1078 
1083  String GetMMCifPDBChainTr(String cif) const;
1084 
1089  void AddPDBMMCifChainTr(String pdb, String cif);
1090 
1095  String GetPDBMMCifChainTr(String pdb) const;
1096 
1101  void AddMMCifEntityIdTr(String cif, String ent_id);
1102 
1107  String GetMMCifEntityIdTr(String cif) const;
1108 
1112  void AddBioUnit(MMCifInfoBioUnit bu);
1113 
1117  const std::vector<MMCifInfoBioUnit>& GetBioUnits() const
1118  {
1119  return biounits_;
1120  }
1121 
1125  void AddOperation(MMCifInfoTransOpPtr op) // unit test
1126  {
1127  transops_.push_back(op);
1128  }
1129 
1133  const std::vector<MMCifInfoTransOpPtr>& GetOperations() const
1134  {
1135  return transops_;
1136  }
1137 
1142  {
1143  struct_details_ = details;
1144  }
1145 
1150  {
1151  return struct_details_;
1152  }
1153 
1158  {
1159  obsolete_ = obsolete;
1160  }
1161 
1166  {
1167  return obsolete_;
1168  }
1169  const MMCifInfoStructRefs& GetStructRefs() const { return struct_refs_; }
1170  void SetStructRefs(const MMCifInfoStructRefs& sr) { struct_refs_=sr; }
1171 
1176  {
1177  // only set once
1178  if (revisions_.GetDateOriginal() == "?") {
1179  revisions_.SetDateOriginal(date);
1180  }
1181  }
1182 
1185  void AddRevision(int num, String date, String status, int major = -1,
1186  int minor = -1)
1187  {
1188  revisions_.AddRevision(num, date, status, major, minor);
1189  }
1190 
1195  {
1196  return revisions_;
1197  }
1198 
1204  void AddEntityBranchLink(String chain_name,
1205  mol::AtomHandle atom1,
1206  mol::AtomHandle atom2,
1207  unsigned char bond_order);
1208 
1211  const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchLinks() const;
1212 
1216  const std::vector<MMCifInfoEntityBranchLink> GetEntityBranchByChain(
1217  const String& chain_name) const;
1218 
1221  const std::vector<String> GetEntityBranchChainNames() const;
1222 
1225  const mol::ChainHandleList GetEntityBranchChains() const;
1226 
1229  void ConnectBranchLinks();
1230 
1231  const MMCifEntityDesc& GetEntityDesc(const String& entity_id) const;
1232 
1233  void SetEntityDesc(const String& entity_id,
1234  const MMCifEntityDesc& entity_desc);
1235 
1236  std::vector<String> GetEntityIds() const;
1237 
1238  std::vector<String> GetEntityIdsOfType(const String& type) const;
1239 
1240 //protected:
1241 
1242 private:
1243  // members
1244  String exptl_method_;
1245  Real resolution_;
1246  Real em_resolution_;
1247  Real r_free_;
1248  Real r_work_;
1249  MMCifInfoStructDetails struct_details_;
1250  MMCifInfoObsolete obsolete_;
1251  MMCifInfoRevisions revisions_;
1252  std::vector<MMCifInfoCitation> citations_;
1253  std::vector<MMCifInfoBioUnit> biounits_;
1254  std::vector<MMCifInfoTransOpPtr> transops_;
1255  MMCifInfoStructRefs struct_refs_;
1256  MMCifEntityDescMap entity_desc_;
1257  std::map<String, String> cif_2_pdb_chain_id_;
1258  std::map<String, String> pdb_2_cif_chain_id_;
1259  std::map<String, String> cif_2_entity_id_;
1260  std::map<String, std::vector<MMCifInfoEntityBranchLink> > entity_branches_;
1261 };
1262 
1263 DLLEXPORT_OST_IO std::ostream& operator<<(std::ostream& os,
1264  const MMCifInfoEntityBranchLink& eb);
1265 
1266 DLLEXPORT_OST_IO std::ostream& operator<<(std::ostream& os,
1267  const std::vector<MMCifInfoEntityBranchLink>& eb_list);
1268 }} // ns
1269 
1270 #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:1015
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:1165
const StringRef GetMethod() const
Get an experimental method.
Definition: mmcif_info.hh:1028
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:1185
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:1157
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:1169
MMCifInfo()
Create an info object.
Definition: mmcif_info.hh:994
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:1149
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:1023
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
std::map< String, MMCifEntityDesc > MMCifEntityDescMap
Definition: mmcif_info.hh:975
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:1041
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:1000
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:1066
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
Real GetEMResolution() const
Get EM resolution.
Definition: mmcif_info.hh:1051
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:1175
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:1036
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:1125
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:1133
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:1071
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:1141
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:1170
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:1056
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
void SetEMResolution(Real res)
Set EM resolution.
Definition: mmcif_info.hh:1046
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:1061
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:1117
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:1194
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