Commit 1de9681b by Maarten L. Hekkelman

revert mrc test

extended nonpoly unit-test
parent 345c4778
......@@ -115,6 +115,19 @@ if(MSVC)
set(CMAKE_INSTALL_PREFIX "$ENV{LOCALAPPDATA}/${PROJECT_NAME}" CACHE PATH "..." FORCE)
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
list(APPEND CMAKE_PREFIX_PATH "$ENV{LOCALAPPDATA}/mrc")
endif()
......@@ -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)
endif()
# Optionally use resources, created with mrc
# Optionally use mrc to create resources
if(NOT BUILD_FOR_CCP4)
find_package(mrc)
if(WIN32 AND BUILD_SHARED_LIBS)
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)
else()
message(WARNING "Not using resources since mrc was not found")
message("Using resources not possible since mrc was not found")
endif()
if(USE_RSRC STREQUAL "ON")
set(USE_RSRC 1)
message("Using resources compiled with ${MRC}")
add_compile_definitions(USE_RSRC)
endif()
endif()
......@@ -382,6 +399,13 @@ option(CIFPP_BUILD_TESTS "Build test exectuables" OFF)
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
# pdb2cif
rename-compound
......@@ -392,11 +416,7 @@ if(CIFPP_BUILD_TESTS)
set(CIFPP_TEST "${CIFPP_TEST}-test")
set(CIFPP_TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test/${CIFPP_TEST}.cpp")
add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE})
if(USE_RSRC)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic)
endif()
add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE} ${CIFPP_TEST_RESOURCE})
target_include_directories(${CIFPP_TEST} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
......@@ -405,10 +425,6 @@ if(CIFPP_BUILD_TESTS)
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})
target_link_libraries(${CIFPP_TEST} ZLIB::ZLIB)
endif()
......
......@@ -1746,6 +1746,8 @@ cif::Datablock& File::createDatablock(const std::string &name)
mImpl->mData.append(db);
mImpl->mDb = db;
return *mImpl->mDb;
}
void File::load(const std::string &p)
......@@ -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 &entity = db["entity"];
......@@ -2428,6 +2432,15 @@ std::string Structure::createEntityNonPoly(std::vector<cif::Item> data, const st
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;
}
......
......@@ -66,7 +66,12 @@ _entity.src_method
_entity.pdbx_description
_entity.formula_weight
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");
......@@ -82,11 +87,13 @@ _entity.formula_weight
{ "formula_weight", 616.487 }
}, "HEM" );
BOOST_TEST(expected.firstDatablock() == structure.getFile().data());
std::cout << expected.firstDatablock() << std::endl
<< std::endl
<< structure.getFile().data() << std::endl;
if (not (expected.firstDatablock() == structure.getFile().data()))
{
BOOST_TEST(false);
std::cout << expected.firstDatablock() << std::endl
<< std::endl
<< structure.getFile().data() << std::endl;
}
// // 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