Commit 8ec1983b by Maarten L. Hekkelman

Updated for new libcifpp v5

parent 122d7b02
...@@ -132,7 +132,7 @@ target_include_directories(mkdssp PRIVATE cifpp::cifpp ${CMAKE_SOURCE_DIR}/inclu ...@@ -132,7 +132,7 @@ target_include_directories(mkdssp PRIVATE cifpp::cifpp ${CMAKE_SOURCE_DIR}/inclu
target_link_libraries(mkdssp PRIVATE cifpp::cifpp Boost::date_time Boost::program_options) target_link_libraries(mkdssp PRIVATE cifpp::cifpp Boost::date_time Boost::program_options)
if(USE_RSRC) if(USE_RSRC)
mrc_target_resources(mkdssp ${CIFPP_SHARE_DIR}/mmcif_pdbx_v50.dic) mrc_target_resources(mkdssp ${CIFPP_SHARE_DIR}/mmcif_pdbx.dic)
endif() endif()
install(TARGETS ${PROJECT_NAME} install(TARGETS ${PROJECT_NAME}
...@@ -156,7 +156,7 @@ endif() ...@@ -156,7 +156,7 @@ endif()
add_executable(unit-test ${PROJECT_SOURCE_DIR}/test/unit-test.cpp ${PROJECT_SOURCE_DIR}/src/dssp.cpp) add_executable(unit-test ${PROJECT_SOURCE_DIR}/test/unit-test.cpp ${PROJECT_SOURCE_DIR}/src/dssp.cpp)
if(USE_RSRC) if(USE_RSRC)
mrc_target_resources(unit-test ${CIFPP_SHARE_DIR}/mmcif_pdbx_v50.dic) mrc_target_resources(unit-test ${CIFPP_SHARE_DIR}/mmcif_pdbx.dic)
endif() endif()
target_include_directories(unit-test PRIVATE target_include_directories(unit-test PRIVATE
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#pragma once #pragma once
#include <cif++/structure/DSSP.hpp> #include <cif++/dssp/DSSP.hpp>
void writeDSSP(const cif::datablock &db, const mmcif::DSSP& dssp, std::ostream& os); void writeDSSP(const dssp::DSSP& dssp, std::ostream& os);
void annotateDSSP(cif::datablock &db, const mmcif::DSSP& dssp, bool writeOther, std::ostream& os); void annotateDSSP(cif::datablock &db, const dssp::DSSP& dssp, bool writeOther, std::ostream& os);
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/date_time/gregorian/formatters.hpp> #include <boost/date_time/gregorian/formatters.hpp>
#include <cif++/structure/DSSP.hpp> #include <cif++/dssp/DSSP.hpp>
#include <cif++/structure/Compound.hpp> // #include <cif++/structure/Compound.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
...@@ -80,8 +80,8 @@ int d_main(int argc, const char* argv[]) ...@@ -80,8 +80,8 @@ int d_main(int argc, const char* argv[])
("min-pp-stretch", po::value<short>(), "Minimal number of residues having PSI/PHI in range for a PP helix, default is 3") ("min-pp-stretch", po::value<short>(), "Minimal number of residues having PSI/PHI in range for a PP helix, default is 3")
("write-other", "If set, write the type OTHER for loops, default is to leave this out") ("write-other", "If set, write the type OTHER for loops, default is to leave this out")
("components", po::value<std::string>(), "Location of the components.cif file from CCD") // ("components", po::value<std::string>(), "Location of the components.cif file from CCD")
("extra-compounds", po::value<std::string>(), "File containing residue information for extra compounds in this specific target, should be either in CCD format or a CCP4 restraints file") // ("extra-compounds", po::value<std::string>(), "File containing residue information for extra compounds in this specific target, should be either in CCD format or a CCP4 restraints file")
("mmcif-dictionary", po::value<std::string>(), "Path to the mmcif_pdbx.dic file to use instead of default") ("mmcif-dictionary", po::value<std::string>(), "Path to the mmcif_pdbx.dic file to use instead of default")
("help,h", "Display help message") ("help,h", "Display help message")
...@@ -95,7 +95,7 @@ int d_main(int argc, const char* argv[]) ...@@ -95,7 +95,7 @@ int d_main(int argc, const char* argv[])
("output,o", po::value<std::string>(), "Output to this file") ("output,o", po::value<std::string>(), "Output to this file")
("debug,d", po::value<int>(), "Debug level (for even more verbose output)") ("debug,d", po::value<int>(), "Debug level (for even more verbose output)")
("compounds", po::value<std::string>(), "Location of the components.cif file from CCD, alias") // ("compounds", po::value<std::string>(), "Location of the components.cif file from CCD, alias")
; ;
po::options_description cmdline_options; po::options_description cmdline_options;
...@@ -144,37 +144,32 @@ int d_main(int argc, const char* argv[]) ...@@ -144,37 +144,32 @@ int d_main(int argc, const char* argv[])
// Load extra CCD definitions, if any // Load extra CCD definitions, if any
if (vm.count("compounds")) // if (vm.count("compounds"))
cif::add_file_resource("components.cif", vm["compounds"].as<std::string>()); // cif::add_file_resource("components.cif", vm["compounds"].as<std::string>());
else if (vm.count("components")) // else if (vm.count("components"))
cif::add_file_resource("components.cif", vm["components"].as<std::string>()); // cif::add_file_resource("components.cif", vm["components"].as<std::string>());
if (vm.count("extra-compounds")) // if (vm.count("extra-compounds"))
mmcif::CompoundFactory::instance().pushDictionary(vm["extra-compounds"].as<std::string>()); // mmcif::CompoundFactory::instance().pushDictionary(vm["extra-compounds"].as<std::string>());
// And perhaps a private mmcif_pdbx dictionary // And perhaps a private mmcif_pdbx dictionary
if (vm.count("mmcif-dictionary")) if (vm.count("mmcif-dictionary"))
cif::add_file_resource("mmcif_pdbx_v50.dic", vm["mmcif-dictionary"].as<std::string>()); cif::add_file_resource("mmcif_pdbx.dic", vm["mmcif-dictionary"].as<std::string>());
if (vm.count("dict")) // if (vm.count("dict"))
{ // {
for (auto dict: vm["dict"].as<std::vector<std::string>>()) // for (auto dict: vm["dict"].as<std::vector<std::string>>())
mmcif::CompoundFactory::instance().pushDictionary(dict); // mmcif::CompoundFactory::instance().pushDictionary(dict);
} // }
cif::file f(vm["xyzin"].as<std::string>()); cif::file f(vm["xyzin"].as<std::string>());
f.load_dictionary("mmcif_pdbx_v50");
if (not f.is_valid()) if (not f.is_valid())
{ {
std::cerr << "File not valid" << std::endl; std::cerr << "Could not validate file" << std::endl;
exit(1); exit(1);
} }
// mmcif::Structure structure(f, 1, mmcif::StructureOpenOptions::SkipHydrogen);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
short pp_stretch = 3; short pp_stretch = 3;
...@@ -200,8 +195,7 @@ int d_main(int argc, const char* argv[]) ...@@ -200,8 +195,7 @@ int d_main(int argc, const char* argv[])
fmt = "cif"; fmt = "cif";
} }
dssp::DSSP dssp(f.front(), 1, pp_stretch, fmt == "dssp");
mmcif::DSSP dssp(f.front(), 1, pp_stretch, fmt == "dssp");
if (vm.count("output")) if (vm.count("output"))
{ {
...@@ -215,14 +209,14 @@ int d_main(int argc, const char* argv[]) ...@@ -215,14 +209,14 @@ int d_main(int argc, const char* argv[])
} }
if (fmt == "dssp") if (fmt == "dssp")
writeDSSP(f.front(), dssp, out); writeDSSP(dssp, out);
else else
annotateDSSP(f.front(), dssp, writeOther, out); annotateDSSP(f.front(), dssp, writeOther, out);
} }
else else
{ {
if (fmt == "dssp") if (fmt == "dssp")
writeDSSP(f.front(), dssp, std::cout); writeDSSP(dssp, std::cout);
else else
annotateDSSP(f.front(), dssp, writeOther, std::cout); annotateDSSP(f.front(), dssp, writeOther, std::cout);
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <stdexcept> #include <stdexcept>
#include <cif++/structure/DSSP.hpp> #include <cif++/dssp/DSSP.hpp>
#include "dssp.hpp" #include "dssp.hpp"
...@@ -43,15 +43,13 @@ BOOST_AUTO_TEST_CASE(ut_dssp) ...@@ -43,15 +43,13 @@ BOOST_AUTO_TEST_CASE(ut_dssp)
using namespace std::literals; using namespace std::literals;
cif::file f("1cbs.cif.gz"); cif::file f("1cbs.cif.gz");
f.load_dictionary("mmcif_pdbx_v50"); BOOST_ASSERT(f.is_valid());
BOOST_CHECK(f.is_valid());
// mmcif::Structure structure(f, 1, mmcif::StructureOpenOptions::SkipHydrogen);
mmcif::DSSP dssp(f.front(), 1, 3, true); dssp::DSSP dssp(f.front(), 1, 3, true);
std::stringstream test; std::stringstream test;
writeDSSP(f.front(), dssp, test); writeDSSP(dssp, test);
std::ifstream reference("1cbs.dssp"); std::ifstream reference("1cbs.dssp");
...@@ -91,19 +89,15 @@ BOOST_AUTO_TEST_CASE(ut_mmcif_2) ...@@ -91,19 +89,15 @@ BOOST_AUTO_TEST_CASE(ut_mmcif_2)
using namespace cif::literals; using namespace cif::literals;
cif::file f("1cbs.cif.gz"); cif::file f("1cbs.cif.gz");
f.load_dictionary("mmcif_pdbx_v50"); BOOST_ASSERT(f.is_valid());
BOOST_CHECK(f.is_valid());
// mmcif::Structure structure(f, 1, mmcif::StructureOpenOptions::SkipHydrogen); dssp::DSSP dssp(f.front(), 1, 3, true);
mmcif::DSSP dssp(f.front(), 1, 3, true);
std::stringstream test; std::stringstream test;
annotateDSSP(f.front(), dssp, true, test); annotateDSSP(f.front(), dssp, true, test);
cif::file rf("1cbs-dssp.cif"); cif::file rf("1cbs-dssp.cif");
// mmcif::Structure rs(rf, 1, mmcif::StructureOpenOptions::SkipHydrogen);
// structure.datablock()["software"].erase("name"_key == "dssp"); // structure.datablock()["software"].erase("name"_key == "dssp");
// rs.datablock()["software"].erase("name"_key == "dssp"); // rs.datablock()["software"].erase("name"_key == "dssp");
......
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