Commit 6d0ea5c6 by Maarten L. Hekkelman

Drop using CCP4 monomers library

version bump
parent dbe40e3a
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
# set the project name # set the project name
project(libcifpp VERSION 5.2.5 LANGUAGES CXX) project(libcifpp VERSION 6.0.0 LANGUAGES CXX)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......
Version 6.0.0
- Drop the use of CCP4's monomer library for compound information
Version 5.2.5 Version 5.2.5
- Correctly import the Eigen3 library - Correctly import the Eigen3 library
......
...@@ -44,11 +44,7 @@ ...@@ -44,11 +44,7 @@
/// The data is loaded by default from a file called `components.cif`. This file /// The data is loaded by default from a file called `components.cif`. This file
/// is located using load_resource. (See documentation on cif::load_resource for more information) /// is located using load_resource. (See documentation on cif::load_resource for more information)
/// ///
/// But if the CCP4 environment is available at runtime, the compound information /// Note that since version 6 the CCP4 monomer library is no longer used.
/// may also be generated from the CCP4 monomer library.
///
/// Note that the information in CCP4 and CCD is not equal.
///
/// See also :doc:`/compound` for more information. /// See also :doc:`/compound` for more information.
...@@ -157,10 +153,6 @@ class compound ...@@ -157,10 +153,6 @@ class compound
float formula_weight() const { return m_formula_weight; } ///< Return the formula mass of the chemical component in Daltons. float formula_weight() const { return m_formula_weight; } ///< Return the formula mass of the chemical component in Daltons.
int formal_charge() const { return m_formal_charge; } ///< Return the formal charge on the chemical component. int formal_charge() const { return m_formal_charge; } ///< Return the formal charge on the chemical component.
/// The group record is only available in CCP4 monomer library files.
/// For CCD entries this value will always contain 'non-polymer'
std::string group() const { return m_group; }
const std::vector<compound_atom> &atoms() const { return m_atoms; } ///< Return the list of atoms for this compound const std::vector<compound_atom> &atoms() const { return m_atoms; } ///< Return the list of atoms for this compound
const std::vector<compound_bond> &bonds() const { return m_bonds; } ///< Return the list of bonds for this compound const std::vector<compound_bond> &bonds() const { return m_bonds; } ///< Return the list of bonds for this compound
...@@ -176,8 +168,6 @@ class compound ...@@ -176,8 +168,6 @@ class compound
private: private:
friend class compound_factory_impl; friend class compound_factory_impl;
friend class CCD_compound_factory_impl;
friend class CCP4_compound_factory_impl;
compound(cif::datablock &db); compound(cif::datablock &db);
compound(cif::datablock &db, const std::string &id, const std::string &name, const std::string &type, const std::string &group); compound(cif::datablock &db, const std::string &id, const std::string &name, const std::string &type, const std::string &group);
...@@ -246,6 +236,8 @@ class compound_factory ...@@ -246,6 +236,8 @@ class compound_factory
CIFPP_EXPORT static const std::map<std::string, char> kAAMap, ///< Globally accessible static list of the default amino acids CIFPP_EXPORT static const std::map<std::string, char> kAAMap, ///< Globally accessible static list of the default amino acids
kBaseMap; ///< Globally accessible static list of the default bases kBaseMap; ///< Globally accessible static list of the default bases
void report_missing_compound(const std::string &compound_id);
private: private:
compound_factory(); compound_factory();
......
...@@ -366,6 +366,14 @@ std::unique_ptr<std::istream> load_resource(std::filesystem::path name); ...@@ -366,6 +366,14 @@ std::unique_ptr<std::istream> load_resource(std::filesystem::path name);
void add_file_resource(const std::string &name, std::filesystem::path dataFile); void add_file_resource(const std::string &name, std::filesystem::path dataFile);
/** /**
* @brief List all the file resources added with cif::add_file_resource.
*
* @param os The std::ostream to write the directories to
*/
void list_file_resources(std::ostream &os);
/**
* @brief Add a directory to the list of search directories. This list is * @brief Add a directory to the list of search directories. This list is
* searched in a last-in-first-out order. * searched in a last-in-first-out order.
* *
...@@ -379,4 +387,12 @@ void add_file_resource(const std::string &name, std::filesystem::path dataFile); ...@@ -379,4 +387,12 @@ void add_file_resource(const std::string &name, std::filesystem::path dataFile);
void add_data_directory(std::filesystem::path dataDir); void add_data_directory(std::filesystem::path dataDir);
/**
* @brief List all the data directories, for error reporting on missing resources.
*
* @param os The std::ostream to write the directories to
*/
void list_data_directories(std::ostream &os);
} // namespace cif } // namespace cif
...@@ -608,6 +608,9 @@ sac_parser::datablock_index sac_parser::index_datablocks() ...@@ -608,6 +608,9 @@ sac_parser::datablock_index sac_parser::index_datablocks()
std::string::size_type si = 0; std::string::size_type si = 0;
std::string datablock; std::string datablock;
// Seek to beginning of file
m_source.pubseekpos(0);
for (auto ch = m_source.sbumpc(); ch != std::streambuf::traits_type::eof(); ch = m_source.sbumpc()) for (auto ch = m_source.sbumpc(); ch != std::streambuf::traits_type::eof(); ch = m_source.sbumpc())
{ {
switch (state) switch (state)
...@@ -667,7 +670,7 @@ sac_parser::datablock_index sac_parser::index_datablocks() ...@@ -667,7 +670,7 @@ sac_parser::datablock_index sac_parser::index_datablocks()
case data_name: case data_name:
if (is_non_blank(ch)) if (is_non_blank(ch))
datablock.insert(datablock.end(), char(ch)); datablock.insert(datablock.end(), (char)std::toupper(ch));
else if (is_space(ch)) else if (is_space(ch))
{ {
if (not datablock.empty()) if (not datablock.empty())
......
...@@ -5146,7 +5146,7 @@ void PDBFileParser::ParseConnectivtyAnnotation() ...@@ -5146,7 +5146,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
getCategory("struct_conn")->emplace({ getCategory("struct_conn")->emplace({
{ "id", type + std::to_string(linkNr) }, { "id", type + std::to_string(linkNr) },
{ "conn_type_id", type }, { "conn_type_id", type },
// { "ccp4_link_id", ccp4LinkID }, // { "ccp4_link_id", ccp4LinkID },
......
...@@ -845,6 +845,9 @@ class resource_pool ...@@ -845,6 +845,9 @@ class resource_pool
std::unique_ptr<std::istream> load(fs::path name); std::unique_ptr<std::istream> load(fs::path name);
const auto data_directories() { return mDirs; }
const auto file_resources() { return mLocalResources; }
private: private:
resource_pool(); resource_pool();
...@@ -937,4 +940,22 @@ std::unique_ptr<std::istream> load_resource(std::filesystem::path name) ...@@ -937,4 +940,22 @@ std::unique_ptr<std::istream> load_resource(std::filesystem::path name)
return resource_pool::instance().load(name); return resource_pool::instance().load(name);
} }
void list_file_resources(std::ostream &os)
{
auto &file_resources = resource_pool::instance().file_resources();
if (not file_resources.empty())
{
os << "\nThe following named resources were loaded:\n";
for (const auto &[name, path] : file_resources)
os << name << " -> " << std::quoted(path.string()) << '\n';
}
}
void list_data_directories(std::ostream &os)
{
for (auto &p : resource_pool::instance().data_directories())
os << p << '\n';
}
} // namespace cif } // namespace cif
...@@ -3483,3 +3483,11 @@ ATOM 7 CD PRO A 1 15.762 13.216 43.724 1.00 30.71 C)" ...@@ -3483,3 +3483,11 @@ ATOM 7 CD PRO A 1 15.762 13.216 43.724 1.00 30.71 C)"
auto f = cif::pdb::read(is); auto f = cif::pdb::read(is);
} }
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE(compound_not_found_test_1)
{
auto cmp = cif::compound_factory::instance().create("&&&");
BOOST_CHECK(cmp == nullptr);
}
\ No newline at end of file
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