Commit 1de9681b by Maarten L. Hekkelman

revert mrc test

extended nonpoly unit-test
parent 345c4778
...@@ -115,6 +115,19 @@ if(MSVC) ...@@ -115,6 +115,19 @@ if(MSVC)
set(CMAKE_INSTALL_PREFIX "$ENV{LOCALAPPDATA}/${PROJECT_NAME}" CACHE PATH "..." FORCE) set(CMAKE_INSTALL_PREFIX "$ENV{LOCALAPPDATA}/${PROJECT_NAME}" CACHE PATH "..." FORCE)
endif() endif()
# Find out the processor type for the target
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
set(COFF_TYPE "x64")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
set(COFF_TYPE "x86")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64")
set(COFF_TYPE "arm64")
else()
message(FATAL_ERROR "Unsupported or unknown processor type ${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(COFF_SPEC "--coff=${COFF_TYPE}")
# for mrc, just in case # for mrc, just in case
list(APPEND CMAKE_PREFIX_PATH "$ENV{LOCALAPPDATA}/mrc") list(APPEND CMAKE_PREFIX_PATH "$ENV{LOCALAPPDATA}/mrc")
endif() endif()
...@@ -125,19 +138,23 @@ if(UNIX AND NOT APPLE AND NOT BUILD_FOR_CCP4 AND CMAKE_INSTALL_PREFIX_INITIALIZE ...@@ -125,19 +138,23 @@ if(UNIX AND NOT APPLE AND NOT BUILD_FOR_CCP4 AND CMAKE_INSTALL_PREFIX_INITIALIZE
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "..." FORCE) set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "..." FORCE)
endif() endif()
# Optionally use resources, created with mrc # Optionally use mrc to create resources
if(NOT BUILD_FOR_CCP4) if(WIN32 AND BUILD_SHARED_LIBS)
find_package(mrc) message("Not using resources when building shared libraries for Windows")
else()
find_program(MRC mrc)
if(MRC_FOUND) if(MRC)
option(USE_RSRC "Use mrc to create resources" ON) option(USE_RSRC "Use mrc to create resources" ON)
else() else()
message(WARNING "Not using resources since mrc was not found") message("Using resources not possible since mrc was not found")
endif() endif()
if(USE_RSRC STREQUAL "ON") if(USE_RSRC STREQUAL "ON")
set(USE_RSRC 1) set(USE_RSRC 1)
message("Using resources compiled with ${MRC}")
add_compile_definitions(USE_RSRC) add_compile_definitions(USE_RSRC)
endif() endif()
endif() endif()
...@@ -382,6 +399,13 @@ option(CIFPP_BUILD_TESTS "Build test exectuables" OFF) ...@@ -382,6 +399,13 @@ option(CIFPP_BUILD_TESTS "Build test exectuables" OFF)
if(CIFPP_BUILD_TESTS) if(CIFPP_BUILD_TESTS)
if(USE_RSRC)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cifpp_test_rsrc.obj
COMMAND ${MRC} -o ${CMAKE_CURRENT_BINARY_DIR}/cifpp_test_rsrc.obj ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic ${COFF_SPEC}
)
set(CIFPP_TEST_RESOURCE ${CMAKE_CURRENT_BINARY_DIR}/cifpp_test_rsrc.obj)
endif()
list(APPEND CIFPP_tests list(APPEND CIFPP_tests
# pdb2cif # pdb2cif
rename-compound rename-compound
...@@ -392,11 +416,7 @@ if(CIFPP_BUILD_TESTS) ...@@ -392,11 +416,7 @@ if(CIFPP_BUILD_TESTS)
set(CIFPP_TEST "${CIFPP_TEST}-test") set(CIFPP_TEST "${CIFPP_TEST}-test")
set(CIFPP_TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test/${CIFPP_TEST}.cpp") set(CIFPP_TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test/${CIFPP_TEST}.cpp")
add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE}) add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE} ${CIFPP_TEST_RESOURCE})
if(USE_RSRC)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic)
endif()
target_include_directories(${CIFPP_TEST} PRIVATE target_include_directories(${CIFPP_TEST} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
...@@ -405,10 +425,6 @@ if(CIFPP_BUILD_TESTS) ...@@ -405,10 +425,6 @@ if(CIFPP_BUILD_TESTS)
target_link_libraries(${CIFPP_TEST} Threads::Threads ${Boost_LIBRARIES} cifpp) target_link_libraries(${CIFPP_TEST} Threads::Threads ${Boost_LIBRARIES} cifpp)
if(USE_RSRC)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic)
endif()
if(${ZLIB_FOUND}) if(${ZLIB_FOUND})
target_link_libraries(${CIFPP_TEST} ZLIB::ZLIB) target_link_libraries(${CIFPP_TEST} ZLIB::ZLIB)
endif() endif()
......
...@@ -1746,6 +1746,8 @@ cif::Datablock& File::createDatablock(const std::string &name) ...@@ -1746,6 +1746,8 @@ cif::Datablock& File::createDatablock(const std::string &name)
mImpl->mData.append(db); mImpl->mData.append(db);
mImpl->mDb = db; mImpl->mDb = db;
return *mImpl->mDb;
} }
void File::load(const std::string &p) void File::load(const std::string &p)
...@@ -2411,8 +2413,10 @@ void Structure::changeResidue(const Residue &res, const std::string &newCompound ...@@ -2411,8 +2413,10 @@ void Structure::changeResidue(const Residue &res, const std::string &newCompound
} }
} }
std::string Structure::createEntityNonPoly(std::vector<cif::Item> data, const std::string &mon_id) std::string Structure::createEntityNonPoly(std::vector<cif::Item> data, const std::string &comp_id)
{ {
using namespace cif::literals;
auto &db = mFile.data(); auto &db = mFile.data();
auto &entity = db["entity"]; auto &entity = db["entity"];
...@@ -2428,6 +2432,15 @@ std::string Structure::createEntityNonPoly(std::vector<cif::Item> data, const st ...@@ -2428,6 +2432,15 @@ std::string Structure::createEntityNonPoly(std::vector<cif::Item> data, const st
entity.emplace(data.begin(), data.end()); entity.emplace(data.begin(), data.end());
const auto &[ name ] = entity.find1<std::string>("id"_key == entity_id, { "pdbx_description" });
auto &pdbx_entity_nonpoly = db["pdbx_entity_nonpoly"];
pdbx_entity_nonpoly.emplace({
{ "entity_id", entity_id },
{ "name", name },
{ "comp_id", comp_id }
});
return entity_id; return entity_id;
} }
......
...@@ -66,7 +66,12 @@ _entity.src_method ...@@ -66,7 +66,12 @@ _entity.src_method
_entity.pdbx_description _entity.pdbx_description
_entity.formula_weight _entity.formula_weight
1 non-polymer syn 'PROTOPORPHYRIN IX CONTAINING FE' 616.487 1 non-polymer syn 'PROTOPORPHYRIN IX CONTAINING FE' 616.487
)"_cf; loop_
_pdbx_entity_nonpoly.entity_id
_pdbx_entity_nonpoly.name
_pdbx_entity_nonpoly.comp_id
1 'PROTOPORPHYRIN IX CONTAINING FE' HEM
)"_cf;
expected.loadDictionary("mmcif_pdbx_v50.dic"); expected.loadDictionary("mmcif_pdbx_v50.dic");
...@@ -82,11 +87,13 @@ _entity.formula_weight ...@@ -82,11 +87,13 @@ _entity.formula_weight
{ "formula_weight", 616.487 } { "formula_weight", 616.487 }
}, "HEM" ); }, "HEM" );
BOOST_TEST(expected.firstDatablock() == structure.getFile().data()); if (not (expected.firstDatablock() == structure.getFile().data()))
{
std::cout << expected.firstDatablock() << std::endl BOOST_TEST(false);
<< std::endl std::cout << expected.firstDatablock() << std::endl
<< structure.getFile().data() << std::endl; << std::endl
<< structure.getFile().data() << std::endl;
}
// // using namespace mmcif; // // using namespace mmcif;
......
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