diff --git a/modules/io/src/mol/mmcif_reader.cc b/modules/io/src/mol/mmcif_reader.cc index 2df3966fa93ae8d304333144cee362a4537dc759..1bd0011c8ea69b49300f8d4571ff96ca2d97ce64 100644 --- a/modules/io/src/mol/mmcif_reader.cc +++ b/modules/io/src/mol/mmcif_reader.cc @@ -797,31 +797,25 @@ void MMCifReader::ParseCitation(const std::vector<StringRef>& columns) cit.SetISBN(columns[indices_[BOOK_ID_ISBN]].str()); } } + if (indices_[JOURNAL_ABBREV] != -1) { + if ((columns[indices_[JOURNAL_ABBREV]] != StringRef(".", 1)) && + (columns[indices_[JOURNAL_ABBREV]][0] != '?')) { + cit.SetPublishedIn(columns[indices_[JOURNAL_ABBREV]].str()); + cit.SetCitationTypeJournal(); + } + } if (indices_[BOOK_TITLE] != -1) { // this is only set in few PDB entries and RCSB overrides it with // the journal_abbrev for their citations // -> as of August 1, 2017, 5 entries known: 5b1j, 5b1k, 5fax, 5fbz, 5ffn // -> all those have journal_abbrev set if ((columns[indices_[BOOK_TITLE]] != StringRef(".", 1)) && - (columns[indices_[BOOK_TITLE]][0]!='?')) { + (columns[indices_[BOOK_TITLE]][0] != '?')) { + // This will override published_in if already set by journal_abbrev. We + // consider this OK for now since usually the book title is copied to + // the journal_abbrev attribute. cit.SetPublishedIn(columns[indices_[BOOK_TITLE]].str()); - } - } - if (indices_[JOURNAL_ABBREV] != -1) { - if (columns[indices_[JOURNAL_ABBREV]] != StringRef(".", 1)) { - const String journal_abbrev = columns[indices_[JOURNAL_ABBREV]].str(); - const String published_in = cit.GetPublishedIn(); - if (published_in.length() > 0 && published_in != journal_abbrev) { - LOG_WARNING(this->FormatDiagnostic(STAR_DIAG_WARNING, - "The 'published_in' field was " - "already set by citation.book_title " - "'" + published_in + "'! " - "This will be overwritten by " - "citation.journal_abbrev '" + - journal_abbrev + "'.", - this->GetCurrentLinenum())); - } - cit.SetPublishedIn(journal_abbrev); + cit.SetCitationTypeBook(); } } if (indices_[JOURNAL_VOLUME] != -1) { diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 69210a1b95e5d3e3236d3807c6827e3390fdc973..233403c619738ba220f5a0efd0cc48f265419f2b 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -598,6 +598,7 @@ BOOST_AUTO_TEST_CASE(mmcif_citation_tests) BOOST_CHECK_EQUAL(cit.GetID(), String("Foo")); BOOST_CHECK_EQUAL(cit.GetYear(), 1979); BOOST_CHECK_EQUAL(cit.GetPublishedIn(), String("The Guide")); + BOOST_CHECK_EQUAL(cit.IsCitationTypeBook(), true); // ensure that we override book_title if not properly given columns.pop_back(); @@ -609,8 +610,7 @@ BOOST_AUTO_TEST_CASE(mmcif_citation_tests) BOOST_CHECK_EQUAL(tmmcif_p.GetInfo().GetCitations().back().GetPublishedIn(), String("Hitch")); - // ensure that we override book_title if journal given - // (def. behavior on RCSB webpage) + // ensure that we override journal if book_title given columns.pop_back(); columns.pop_back(); columns.push_back(StringRef("The Guide", 9)); @@ -618,7 +618,7 @@ BOOST_AUTO_TEST_CASE(mmcif_citation_tests) BOOST_CHECK_NO_THROW(tmmcif_p.ParseCitation(columns)); BOOST_CHECK_EQUAL(tmmcif_p.GetInfo().GetCitations().back().GetPublishedIn(), - String("Hitch")); + String("The Guide")); BOOST_TEST_MESSAGE(" done."); }