diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index fb35827a11e0c046c14d999d5cc9d0da79c1f85a..d61cde02622c5a61366b987d831c3d372bc1123a 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -78,6 +78,10 @@ void export_mmcif_io() .def("GetYear", &MMCifInfoCitation::GetYear) .def("SetTitle", &MMCifInfoCitation::SetTitle) .def("GetTitle", &MMCifInfoCitation::GetTitle) + .def("SetBookPublisher", &MMCifInfoCitation::SetBookPublisher) + .def("GetBookPublisher", &MMCifInfoCitation::GetBookPublisher) + .def("SetBookPublisherCity", &MMCifInfoCitation::SetBookPublisherCity) + .def("GetBookPublisherCity", &MMCifInfoCitation::GetBookPublisherCity) .def("SetCitationType", &MMCifInfoCitation::SetCitationType) .def("SetCitationTypeJournal", &MMCifInfoCitation::SetCitationTypeJournal) .def("SetCitationTypeBook", &MMCifInfoCitation::SetCitationTypeBook) @@ -108,6 +112,11 @@ void export_mmcif_io() &MMCifInfoCitation::SetYear) .add_property("title", &MMCifInfoCitation::GetTitle, &MMCifInfoCitation::SetTitle) + .add_property("book_publisher", &MMCifInfoCitation::GetBookPublisher, + &MMCifInfoCitation::SetBookPublisher) + .add_property("book_publisher_city", + &MMCifInfoCitation::GetBookPublisherCity, + &MMCifInfoCitation::SetBookPublisherCity) .add_property("citation_type", &MMCifInfoCitation::GetCitationType, &MMCifInfoCitation::SetCitationType) .add_property("authors", make_function(&MMCifInfoCitation::GetAuthorList, diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index 9b781e40712b1c75dd66dac920da5ec16693349d..68d60318f9fe1328eca94b7fc33daca14236749e 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -400,8 +400,7 @@ public: /// \brief Create a citation. MMCifInfoCitation(): id_(""), where_(UNKNOWN), cas_(""), published_in_(""), volume_(""), page_first_(""), page_last_(""), doi_(""), pubmed_(0), - year_(0), title_("") {}; - + year_(0), title_(""), book_publisher_(""), book_publisher_city_("") {}; /// \brief Set ID /// /// \param id ID @@ -470,12 +469,35 @@ public: /// \return last page String GetPageLast() const { return page_last_; } + /// \brief Set the publisher for a book + /// + /// \param publisher + void SetBookPublisher(String publisher) { book_publisher_ = publisher; } + + /// \brief Get the publisher of a book + /// + /// \return publisher + String GetBookPublisher() const { return book_publisher_; } + + /// \brief Set the publisher city for a book + /// + /// \param publisher_city + void SetBookPublisherCity(String publisher_city) { + book_publisher_city_ = publisher_city; + } + + /// \brief Get the publisher city of a book + /// + /// \return publisher_city + String GetBookPublisherCity() const { return book_publisher_city_; } + +//book_publisher_city_ + /// \brief Set the DOI of a document /// /// \param doi void SetDOI(String doi) { doi_ = doi; } - /// \brief Get the DOI of a document /// /// \return DOI @@ -617,6 +639,18 @@ public: StringRef(cit.title_.c_str(), cit.title_.length())) { return false; } + if (StringRef(this->book_publisher_.c_str(), + this->book_publisher_.length()) != + StringRef(cit.book_publisher_.c_str(), + cit.book_publisher_.length())) { + return false; + } + if (StringRef(this->book_publisher_city_.c_str(), + this->book_publisher_city_.length()) != + StringRef(cit.book_publisher_city_.c_str(), + cit.book_publisher_city_.length())) { + return false; + } if (this->authors_ != cit.authors_) { return false; } @@ -629,19 +663,21 @@ public: } private: - String id_; ///< internal identifier - MMCifInfoCType where_; ///< journal or book? - String cas_; ///< CAS identifier - String isbn_; ///< ISBN no. of medium - String published_in_; ///< book title or full journal name - String volume_; ///< journal volume - String page_first_; ///< first page - String page_last_; ///< last page - String doi_; ///< DOI identifier - int pubmed_; ///< accession no. - int year_; ///< year of publication - String title_; ///< title of the publication - std::vector<String> authors_; ///< author information + String id_; ///< internal identifier + MMCifInfoCType where_; ///< journal or book? + String cas_; ///< CAS identifier + String isbn_; ///< ISBN no. of medium + String published_in_; ///< book title or journal name + String volume_; ///< journal volume + String page_first_; ///< first page + String page_last_; ///< last page + String doi_; ///< DOI identifier + int pubmed_; ///< accession no. + int year_; ///< year of publication + String title_; ///< title of the publication + String book_publisher_; ///< name of publisher + String book_publisher_city_; ///< location of publisher + std::vector<String> authors_; ///< author information }; /// \brief container class for information on obsolete entries diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index 71ddf9ecd35a91fe51e8148918eecb4f4429df7e..dfd12ee30a384b35ca5bcf0e545c9a3528624396 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -40,6 +40,12 @@ class TestMMCifInfo(unittest.TestCase): # test title setting/ getting c.SetTitle('Foo') self.assertEquals(c.GetTitle(), 'Foo') + # test book_publisher set & get + c.SetBookPublisher("Hugo") + self.assertEquals(c.GetBookPublisher(), "Hugo") + # test book_publisher_city set & get + c.SetBookPublisherCity("Basel") + self.assertEquals(c.book_publisher_city, "Basel") # test citation type self.assertTrue(c.IsCitationTypeUnknown()) self.assertEquals(c.citation_type, io.MMCifInfoCType.Unknown) diff --git a/modules/io/tests/test_mmcif_info.cc b/modules/io/tests/test_mmcif_info.cc index bef7ed4922b31af5363da757d074668d3c5e9a6d..6707ff930cf29eded775b6f85d3ad57c0dc19cb4 100644 --- a/modules/io/tests/test_mmcif_info.cc +++ b/modules/io/tests/test_mmcif_info.cc @@ -72,6 +72,8 @@ BOOST_AUTO_TEST_CASE(mmcif_info_citation) cit.SetPubMed(815); cit.SetYear(815); cit.SetTitle("Foo"); + cit.SetBookPublisher("Brackelmann and Sons"); + cit.SetBookPublisherCity("Stenkelfeld"); cit.SetAuthorList(author_list); cit.SetCitationType(MMCifInfoCitation::JOURNAL); author_list.clear(); @@ -87,6 +89,8 @@ BOOST_AUTO_TEST_CASE(mmcif_info_citation) BOOST_CHECK(cit.GetPubMed() == 815); BOOST_CHECK(cit.GetYear() == 815); BOOST_CHECK(cit.GetTitle() == "Foo"); + BOOST_CHECK(cit.GetBookPublisher() == "Brackelmann and Sons"); + BOOST_CHECK(cit.GetBookPublisherCity() == "Stenkelfeld"); BOOST_CHECK(cit.GetCitationType() == MMCifInfoCitation::JOURNAL); BOOST_CHECK(cit.IsCitationTypeJournal() == true); BOOST_CHECK(cit.IsCitationTypeBook() == false);