Commit 5c366ad9 by Maarten L. Hekkelman

- remove three_letter_code for CCP4 dictionaries

- fix test for equality of compound ID's, they are case insensitive you know
parent 836aed6e
......@@ -313,7 +313,7 @@ class compound_factory_impl : public std::enable_shared_from_this<compound_facto
{
for (auto cmp : impl->m_compounds)
{
if (cmp->id() == id)
if (iequals(cmp->id(), id))
{
result = cmp;
break;
......@@ -582,12 +582,12 @@ CCP4_compound_factory_impl::CCP4_compound_factory_impl(const fs::path &clibd_mon
auto &chemComps = m_file["comp_list"]["chem_comp"];
for (const auto &[group, threeLetterCode] : chemComps.rows<std::string, std::string>("group", "three_letter_code"))
for (const auto &[group, comp_id] : chemComps.rows<std::string, std::string>("group", "id"))
{
if (std::regex_match(group, peptideRx))
m_known_peptides.insert(threeLetterCode);
m_known_peptides.insert(comp_id);
else if (cif::iequals(group, "DNA") or cif::iequals(group, "RNA"))
m_known_bases.insert(threeLetterCode);
m_known_bases.insert(comp_id);
}
}
......@@ -597,7 +597,7 @@ compound *CCP4_compound_factory_impl::create(const std::string &id)
auto &cat = m_file["comp_list"]["chem_comp"];
auto rs = cat.find(cif::key("three_letter_code") == id);
auto rs = cat.find(cif::key("id") == id);
if (rs.size() == 1)
{
......
This diff is collapsed. Click to expand it.
......@@ -3151,3 +3151,13 @@ _test.value
v = test.find1<std::optional<float>>("id"_key == 4, "value");
BOOST_CHECK(v.has_value() == false);
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE(compound_test_1)
{
cif::compound_factory::instance().push_dictionary(gTestDir / "REA_v2.cif");
auto compound = cif::compound_factory::instance().create("REA_v2");
BOOST_ASSERT(compound != nullptr);
BOOST_CHECK(compound->id() == "REA_v2");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment