Commit a9e9f86c by Maarten L. Hekkelman

Renaming internal use of mmcif_pdbx dictionary. It was wrong to use the name mmcif_pdbx_v50

parent a2c52713
......@@ -362,7 +362,7 @@ install(
install(FILES
${PROJECT_SOURCE_DIR}/rsrc/mmcif_ddl.dic
${PROJECT_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic
${PROJECT_SOURCE_DIR}/rsrc/mmcif_pdbx.dic
${COMPONENTS_CIF}
DESTINATION ${SHARE_INSTALL_DIR}
)
......@@ -435,7 +435,7 @@ if(CIFPP_BUILD_TESTS)
target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp::cifpp Boost::boost)
if(CIFPP_USE_RSRC)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx.dic)
endif()
if(MSVC)
......
......@@ -8,7 +8,6 @@ namespace fs = std::filesystem;
int main()
{
cif::file file;
file.load_dictionary("mmcif_pdbx_v50");
file.load("1cbs.cif.gz");
auto& db = file.front();
......
......@@ -46,7 +46,7 @@ class Compound;
struct CompoundAtom;
class CompoundFactoryImpl;
/// \brief The bond type as defined in the CCD, possible values taken from the mmcif_pdbx_v50 file
/// \brief The bond type as defined in the CCD, possible values taken from the mmcif_pdbx file
enum class BondType
{
sing, // 'single bond'
......
......@@ -1798,7 +1798,7 @@ auto Category::erase(iterator pos) -> iterator
}
// links are created based on the _pdbx_item_linked_group_list entries
// in mmcif_pdbx_v50.dic dictionary.
// in mmcif_pdbx.dic dictionary.
//
// For each link group in _pdbx_item_linked_group_list
// a std::set of keys from one category is mapped to another.
......
......@@ -61,7 +61,8 @@ bool file::is_valid()
load_dictionary();
}
bool result = true;
bool result = not empty();
for (auto &d : *this)
result = d.is_valid() and result;
......@@ -76,9 +77,10 @@ void file::load_dictionary()
if (audit_conform and not audit_conform->empty())
{
std::string name;
cif::tie(name) = audit_conform->front().get("name");
cif::tie(name) = audit_conform->front().get("dict_name");
load_dictionary(name);
if (not name.empty())
load_dictionary(name);
}
}
......@@ -158,10 +160,9 @@ void file::load(std::istream &is)
p.parse_file();
if (saved != nullptr)
{
set_validator(saved);
(void)is_valid();
}
else
load_dictionary();
}
void file::save(const std::filesystem::path &p) const
......
......@@ -6055,10 +6055,11 @@ void ReadPDBFile(std::istream &pdbFile, cif::File &cifFile)
{
PDBFileParser p;
cifFile.loadDictionary("mmcif_pdbx_v50");
p.Parse(pdbFile, cifFile);
cifFile.loadDictionary("mmcif_pdbx");
if (not cifFile.isValid() and cif::VERBOSE >= 0)
std::cerr << "Resulting mmCIF file is not valid!" << std::endl;
}
......@@ -416,7 +416,7 @@ CompoundFactoryImpl::CompoundFactoryImpl(const fs::path &file, std::shared_ptr<C
else
{
// A CCD components file, validate it first
cifFile.load_dictionary("mmcif_pdbx_v50");
cifFile.load_dictionary("mmcif_pdbx");
if (not cifFile.is_valid())
throw std::runtime_error("Invalid compound file");
......
......@@ -1297,7 +1297,7 @@ void File::load(const std::filesystem::path &path)
cif::File::load(in);
// validate, otherwise lots of functionality won't work
loadDictionary("mmcif_pdbx_v50");
loadDictionary("mmcif_pdbx");
if (not isValid() and cif::VERBOSE >= 0)
std::cerr << "Invalid mmCIF file" << (cif::VERBOSE > 0 ? "." : " use --verbose option to see errors") << std::endl;
}
......
......@@ -64,7 +64,7 @@ bool init_unit_test()
gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// do this now, avoids the need for installing
cif::add_file_resource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
cif::add_file_resource("mmcif_pdbx.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx.dic");
// initialize CCD location
cif::add_file_resource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
......@@ -76,12 +76,9 @@ bool init_unit_test()
BOOST_AUTO_TEST_CASE(dssp_1)
{
// using namespace mmcif;
cif::file f(gTestDir / "1cbs.cif");
f.load_dictionary("mmcif_pdbx_v50");
BOOST_CHECK(f.is_valid());
BOOST_ASSERT(f.is_valid());
std::ifstream t(gTestDir / "1cbs-dssp-test.tsv");
......
......@@ -19,8 +19,8 @@ int main(int argc, char* argv[])
if (std::filesystem::exists(testdir / ".." / "data" / "ccd-subset.cif"))
cif::add_file_resource("components.cif", testdir / ".." / "data" / "ccd-subset.cif");
if (std::filesystem::exists(testdir / ".." / "rsrc" / "mmcif_pdbx_v50.dic"))
cif::add_file_resource("mmcif_pdbx_v50.dic", testdir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
if (std::filesystem::exists(testdir / ".." / "rsrc" / "mmcif_pdbx.dic"))
cif::add_file_resource("mmcif_pdbx.dic", testdir / ".." / "rsrc" / "mmcif_pdbx.dic");
mmcif::CompoundFactory::instance().pushDictionary(testdir / "REA.cif");
mmcif::CompoundFactory::instance().pushDictionary(testdir / "RXA.cif");
......
......@@ -61,7 +61,7 @@ bool init_unit_test()
gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// do this now, avoids the need for installing
cif::add_file_resource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
cif::add_file_resource("mmcif_pdbx.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx.dic");
// initialize CCD location
cif::add_file_resource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
......@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(create_nonpoly_1)
cif::VERBOSE = 1;
mmcif::File file;
file.loadDictionary("mmcif_pdbx_v50.dic");
file.loadDictionary("mmcif_pdbx.dic");
file.emplace("TEST"); // create a datablock
mmcif::Structure structure(file);
......@@ -180,7 +180,7 @@ _struct_asym.details ?
#
)"_cf;
expected.loadDictionary("mmcif_pdbx_v50.dic");
expected.loadDictionary("mmcif_pdbx.dic");
if (not (expected.firstDatablock() == structure.datablock()))
{
......@@ -280,7 +280,7 @@ _struct_asym.details ?
#
)"_cf;
data.loadDictionary("mmcif_pdbx_v50.dic");
data.loadDictionary("mmcif_pdbx.dic");
mmcif::Structure s(data);
......
......@@ -61,7 +61,7 @@ bool init_unit_test()
gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// do this now, avoids the need for installing
cif::add_file_resource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
cif::add_file_resource("mmcif_pdbx.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx.dic");
// initialize CCD location
cif::add_file_resource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
......
......@@ -67,7 +67,7 @@ bool init_unit_test()
gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// do this now, avoids the need for installing
cif::add_file_resource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
cif::add_file_resource("mmcif_pdbx.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx.dic");
// initialize CCD location
cif::add_file_resource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
......@@ -295,7 +295,6 @@ save__cat_2.desc
cif::Validator validator("test", is_dict);
cif::File f;
f.setValidator(&validator);
// --------------------------------------------------------------------
......@@ -327,6 +326,7 @@ _cat_2.desc
std::istream is_data(&data_buffer);
f.load(is_data);
f.setValidator(&validator);
auto &cat1 = f.firstDatablock()["cat_1"];
auto &cat2 = f.firstDatablock()["cat_2"];
......
......@@ -69,7 +69,7 @@ bool init_unit_test()
// gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
// // do this now, avoids the need for installing
// cif::add_file_resource("mmcif_pdbx_v50.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx_v50.dic");
// cif::add_file_resource("mmcif_pdbx.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx.dic");
// // initialize CCD location
// cif::add_file_resource("components.cif", gTestDir / ".." / "data" / "ccd-subset.cif");
......
......@@ -43,7 +43,7 @@ fetch_dictionary () {
# fetch the dictionaries
fetch_dictionary "/var/cache/libcifpp/mmcif_pdbx_v50.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
fetch_dictionary "/var/cache/libcifpp/mmcif_pdbx.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
fetch_dictionary "/var/cache/libcifpp/components.cif" "ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz"
# this one is not compressed
......
......@@ -43,7 +43,7 @@ fetch_dictionary () {
# fetch the dictionaries
fetch_dictionary "@CIFPP_CACHE_DIR@/mmcif_pdbx_v50.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
fetch_dictionary "@CIFPP_CACHE_DIR@/mmcif_pdbx.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
fetch_dictionary "@CIFPP_CACHE_DIR@/components.cif" "ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz"
# notify subscribers
......
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