diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d700a34a01a9c17d2128d8c8062c78c9cebf1e1..8141de3b24adbb7d9ab0c00cdb92c9cb30fd8b46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) project(OpenStructure CXX C) set (OST_VERSION_MAJOR 1) set (OST_VERSION_MINOR 4) -set (OST_VERSION_PATCH 0) +set (OST_VERSION_PATCH 1) set (OST_VERSION_STRING ${OST_VERSION_MAJOR}.${OST_VERSION_MINOR}.${OST_VERSION_PATCH} ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake_support) include(OST) diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index d3213357183cf73841d9d1386e612b6e0828ca40..824d70340208f61ac9959cddcff4902833f1bed4 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -171,7 +171,8 @@ void export_mmcif_io() .add_property("details", make_function(&MMCifInfoStructRefSeqDif::GetDetails, return_value_policy<copy_const_reference>())) .add_property("seq_rnum", &MMCifInfoStructRefSeqDif::GetSeqRNum) - .add_property("db_rnum", &MMCifInfoStructRefSeqDif::GetDBRNum) + .add_property("db_rnum", make_function(&MMCifInfoStructRefSeqDif::GetDBRNum, + return_value_policy<copy_const_reference>())) ; typedef std::pair<int, int> IntPair; diff --git a/modules/io/src/mol/mmcif_info.cc b/modules/io/src/mol/mmcif_info.cc index e7f391894cab4e8ace515de79fa14f6e047fd683..e7d47078cc5ae4c9f3c4dabee23dd55c72dd12e1 100644 --- a/modules/io/src/mol/mmcif_info.cc +++ b/modules/io/src/mol/mmcif_info.cc @@ -168,7 +168,7 @@ MMCifInfoStructRef::GetAlignedSeq(const String& aid) const } MMCifInfoStructRefSeqDifPtr -MMCifInfoStructRefSeq::AddDif(int seq_rnum, int db_rnum, const String& details) +MMCifInfoStructRefSeq::AddDif(int seq_rnum, const String& db_rnum, const String& details) { MMCifInfoStructRefSeqDifPtr d(new MMCifInfoStructRefSeqDif(seq_rnum, db_rnum, details)); diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index 593fed6f2b70e25c777454bd3e8d95db8554ef56..ca8da62036b5151ff38cbefe65645515be2b0851 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -817,8 +817,8 @@ public: int GetSeqEnd() const { return seq_end_; } int GetDBBegin() const { return db_begin_; } int GetDBEnd() const { return db_end_; } - MMCifInfoStructRefSeqDifPtr AddDif(int seq_num, int db_num, - const String& details); + MMCifInfoStructRefSeqDifPtr AddDif(int seq_num, const String& db_rnum, + const String& details); const std::vector<MMCifInfoStructRefSeqDifPtr>& GetDifs() const { return difs_; } private: String id_; @@ -832,14 +832,14 @@ private: class DLLEXPORT_OST_IO MMCifInfoStructRefSeqDif { public: - MMCifInfoStructRefSeqDif(int seq_rnum, int db_rnum, const String& details): + MMCifInfoStructRefSeqDif(int seq_rnum, const String& db_rnum, const String& details): seq_rnum_(seq_rnum), db_rnum_(db_rnum), details_(details) {} int GetSeqRNum() const { return seq_rnum_;} - int GetDBRNum() const { return db_rnum_; } + const String& GetDBRNum() const { return db_rnum_; } const String& GetDetails() const { return details_; } private: int seq_rnum_; - int db_rnum_; + String db_rnum_; String details_; }; diff --git a/modules/io/src/mol/mmcif_reader.cc b/modules/io/src/mol/mmcif_reader.cc index a4c9ca313f3dcdeb5f1434884cb57c00d72ab9df..93807f921e50c1457dc3cf7d0cc890375900183f 100644 --- a/modules/io/src/mol/mmcif_reader.cc +++ b/modules/io/src/mol/mmcif_reader.cc @@ -805,7 +805,7 @@ void MMCifReader::ParseCitation(const std::vector<StringRef>& columns) } } if (indices_[YEAR] != -1) { - if (columns[indices_[YEAR]][0]!='?') { + if (!is_undef(columns[indices_[YEAR]])) { cit.SetYear(this->TryGetInt(columns[indices_[YEAR]], "citation.year")); } } @@ -1542,33 +1542,30 @@ void MMCifReader::ParseStructRefSeq(const std::vector<StringRef>& columns) void MMCifReader::ParseStructRefSeqDif(const std::vector<StringRef>& columns) { - String aln_id=columns[indices_[SRSD_ALIGN_ID]].str(); - std::pair<bool,int> db_rnum(true, -1); - if (!is_undef(columns[indices_[SRSD_DB_RNUM]])) { - db_rnum=this->TryGetInt(columns[indices_[SRSD_DB_RNUM]], - "_struct_ref_seq_dif.pdbx_seq_db_seq_num", - profile_.fault_tolerant); - - } - std::pair<bool,int> seq_rnum(true, -1); - if (!is_undef(columns[indices_[SRSD_SEQ_RNUM]])) { - seq_rnum=this->TryGetInt(columns[indices_[SRSD_SEQ_RNUM]], - "_struct_ref_seq_dif.seq_num", - profile_.fault_tolerant); - - } - if (!seq_rnum.first || !db_rnum.first) { - return; - } + String aln_id=columns[indices_[SRSD_ALIGN_ID]].str(); + String db_rnum; + if (!is_undef(columns[indices_[SRSD_DB_RNUM]])) { + db_rnum=columns[indices_[SRSD_DB_RNUM]].str(); + } + std::pair<bool,int> seq_rnum(true, -1); + if (!is_undef(columns[indices_[SRSD_SEQ_RNUM]])) { + seq_rnum=this->TryGetInt(columns[indices_[SRSD_SEQ_RNUM]], + "_struct_ref_seq_dif.seq_num", + profile_.fault_tolerant); + + } + if (!seq_rnum.first) { + return; + } String details; if (indices_[SRSD_DETAILS]!=-1) { details=columns[indices_[SRSD_DETAILS]].str(); - } - bool found=false; + } + bool found=false; for (MMCifInfoStructRefs::iterator i=struct_refs_.begin(), e=struct_refs_.end(); i!=e; ++i) { if (MMCifInfoStructRefSeqPtr s=(*i)->GetAlignedSeq(aln_id)) { - s->AddDif(seq_rnum.second, db_rnum.second, details); + s->AddDif(seq_rnum.second, db_rnum, details); found=true; break; } diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 6f6866622c49c5a6e2f0259339e3c6b5508f4024..3a1906df9ea7c8f7ffc0dae6f79fcc9a54b7972e 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -584,16 +584,20 @@ BOOST_AUTO_TEST_CASE(mmcif_citation_tests) tmmcif_h.SetCategory(StringRef("citation", 8)); tmmcif_h.Add(StringRef("id", 2)); + tmmcif_h.Add(StringRef("year", 4)); tmmcif_h.Add(StringRef("book_title", 10)); tmmcif_h.Add(StringRef("journal_abbrev", 14)); tmmcif_p.OnBeginLoop(tmmcif_h); columns.push_back(StringRef("Foo", 3)); + columns.push_back(StringRef("1979", 4)); columns.push_back(StringRef("The Guide", 9)); columns.push_back(StringRef(".", 1)); BOOST_CHECK_NO_THROW(tmmcif_p.ParseCitation(columns)); + BOOST_CHECK(tmmcif_p.GetInfo().GetCitations().back().GetYear() == 1979); + columns.pop_back(); columns.pop_back(); columns.push_back(StringRef(".", 1)); diff --git a/scripts/ost_startup.py.in b/scripts/ost_startup.py.in index 73cf24e88ac07829f9b93f09b433ba27c2c5bf57..612b6485cf2515deffe6023f80e3ea4ea14e8ce5 100644 --- a/scripts/ost_startup.py.in +++ b/scripts/ost_startup.py.in @@ -30,20 +30,21 @@ _site_packs='python%d.%d/site-packages' % sys.version_info[0:2] _base_dir=os.getenv('DNG_ROOT') sys.path.insert(0, os.path.join(_base_dir, '@LIBDIR@', _site_packs)) -from ost import * -import ost +from ost import SetPrefixPath, GetSharedDataPath, conop -ost.SetPrefixPath(_base_dir) +SetPrefixPath(_base_dir) def _InitRuleBasedProcessor(): - compound_lib_path=os.path.join(ost.GetSharedDataPath(), 'compounds.chemlib') + compound_lib_path=os.path.join(GetSharedDataPath(), 'compounds.chemlib') if os.path.exists(compound_lib_path): compound_lib=conop.CompoundLib.Load(compound_lib_path) conop.SetDefaultLib(compound_lib) - io.profiles['DEFAULT'].processor = conop.RuleBasedProcessor(compound_lib) # switch to rule-based processor, if compound library is available _InitRuleBasedProcessor() +from ost import * +import ost + import os.path HistoryFile=os.path.expanduser('~/.ost_history')