mirror of
https://github.com/PDB-REDO/libcifpp.git
synced 2026-06-04 13:54:25 +08:00
Some cleaning up
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "cif++/exports.hpp"
|
||||
#include "cif++/point.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cif++/exports.hpp"
|
||||
#include "cif++/text.hpp"
|
||||
#include "cif++/utilities.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@@ -38,11 +36,8 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -535,12 +530,12 @@ class item_value
|
||||
m_value.destroy(m_type, m_len);
|
||||
}
|
||||
|
||||
std::string_view sv() const noexcept
|
||||
[[nodiscard]] std::string_view sv() const noexcept
|
||||
{
|
||||
return m_type == item_value_type::TEXT ? std::string_view(m_len >= sizeof(m_value.m_local_str) ? m_value.m_str : m_value.m_local_str, m_len) : std::string_view{};
|
||||
}
|
||||
|
||||
const char *c_str() const noexcept
|
||||
[[nodiscard]] const char *c_str() const noexcept
|
||||
{
|
||||
return m_type == item_value_type::TEXT ? (m_len >= sizeof(m_value.m_local_str) ? m_value.m_str : m_value.m_local_str) : nullptr;
|
||||
}
|
||||
@@ -570,11 +565,7 @@ class item
|
||||
}
|
||||
|
||||
/** @cond */
|
||||
item(const item &rhs)
|
||||
: m_name(rhs.m_name)
|
||||
, m_value(rhs.m_value)
|
||||
{
|
||||
}
|
||||
item(const item &rhs) = default;
|
||||
|
||||
item(item &&rhs)
|
||||
{
|
||||
@@ -594,21 +585,21 @@ class item
|
||||
std::swap(a.m_value, b.m_value);
|
||||
}
|
||||
|
||||
const std::string &name() const { return m_name; } ///< Return the name of the item
|
||||
const item_value &value() const & { return m_value; } ///< Return the value of the item
|
||||
[[nodiscard]] const std::string &name() const { return m_name; } ///< Return the name of the item
|
||||
[[nodiscard]] const item_value &value() const & { return m_value; } ///< Return the value of the item
|
||||
item_value &value() & { return m_value; } ///< Return the value of the item
|
||||
|
||||
/// \brief replace the content of the stored value with \a v
|
||||
void value(item_value v) { m_value = std::move(v); }
|
||||
|
||||
/// \brief empty means either null or unknown
|
||||
bool empty() const { return m_value.empty(); }
|
||||
[[nodiscard]] bool empty() const { return m_value.empty(); }
|
||||
|
||||
/// \brief returns true if the item contains '.' or '?'
|
||||
bool is_null() const { return m_value.is_null(); }
|
||||
[[nodiscard]] bool is_null() const { return m_value.is_null(); }
|
||||
|
||||
/// \brief returns true if the item contains '?'
|
||||
bool is_unknown() const { return m_value.is_missing(); }
|
||||
[[nodiscard]] bool is_unknown() const { return m_value.is_missing(); }
|
||||
|
||||
// /// \brief the length of the value string
|
||||
// std::size_t length() const { return m_value.length(); }
|
||||
@@ -666,7 +657,7 @@ struct item_handle
|
||||
[[nodiscard]] auto type() const { return value().type(); }
|
||||
|
||||
template <typename T>
|
||||
auto get() const
|
||||
[[nodiscard]] auto get() const
|
||||
{
|
||||
if (empty())
|
||||
return T{};
|
||||
@@ -675,7 +666,7 @@ struct item_handle
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
auto as() const
|
||||
[[nodiscard]] auto as() const
|
||||
{
|
||||
if (empty())
|
||||
return T{};
|
||||
@@ -801,7 +792,7 @@ struct const_item_handle
|
||||
[[nodiscard]] auto type() const { return value().type(); }
|
||||
|
||||
template <typename T>
|
||||
auto get() const
|
||||
[[nodiscard]] auto get() const
|
||||
{
|
||||
if (empty())
|
||||
return T{};
|
||||
@@ -810,7 +801,7 @@ struct const_item_handle
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
auto as() const
|
||||
[[nodiscard]] auto as() const
|
||||
{
|
||||
if (empty())
|
||||
return T{};
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "cif++/row.hpp"
|
||||
|
||||
#include "cif++/file.hpp"
|
||||
#include "cif++/utilities.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
@@ -261,7 +262,7 @@ class sac_parser
|
||||
|
||||
void error(const std::string &msg)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Error parsing mmCIF: " << msg << '\n';
|
||||
|
||||
throw parse_error(m_line_nr, msg);
|
||||
@@ -269,7 +270,7 @@ class sac_parser
|
||||
|
||||
void warning(const std::string &msg)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "parser warning at line " << m_line_nr << ": " << msg << '\n';
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <initializer_list>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
@@ -468,7 +467,7 @@ namespace detail
|
||||
static constexpr std::size_t N = sizeof...(C);
|
||||
|
||||
get_row_result(const_row_handle r, std::array<uint16_t, N> &&items)
|
||||
: m_row(r)
|
||||
: m_row(std::move(r))
|
||||
, m_items(std::move(items))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1113,7 +1113,7 @@ auto atom_type_traits::wksf(int charge) const -> const SFData&
|
||||
{
|
||||
// Oops, not found. Fall back to zero charge and see if we can use that
|
||||
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "No scattering factor found for " << name() << " with charge " << charge << " will try to fall back to zero charge...\n";
|
||||
|
||||
for (auto& sf: data::kWKSFData)
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <stack>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
// TODO: Find out what the rules are exactly for linked items, the current implementation
|
||||
@@ -966,7 +965,7 @@ void category::strip()
|
||||
|
||||
for (auto item : to_be_removed)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Dropping item " << m_name << '.' << item << '\n';
|
||||
remove_item(item);
|
||||
}
|
||||
@@ -1043,7 +1042,7 @@ condition category::get_parents_condition(const_row_handle rh, const category &p
|
||||
result = std::move(result) or std::move(cond);
|
||||
}
|
||||
}
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
std::cerr << "warning: no child to parent links were found for child " << parentCat.name() << " and parent " << name() << '\n';
|
||||
|
||||
return result;
|
||||
@@ -1090,7 +1089,7 @@ condition category::get_children_condition(const_row_handle rh, const category &
|
||||
result = std::move(result) or std::move(cond);
|
||||
}
|
||||
}
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
std::cerr << "warning: no parent to child links were found for parent " << name() << " and child " << childCat.name() << '\n';
|
||||
|
||||
return result;
|
||||
@@ -1526,7 +1525,7 @@ void category::update_value(const std::vector<row_handle> &rows, std::string_vie
|
||||
}
|
||||
|
||||
// cannot update this...
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Cannot update child " << childCat->m_name << "." << childItemName << " with value " << value << '\n';
|
||||
}
|
||||
|
||||
@@ -1613,7 +1612,7 @@ void category::update_value(row *row, uint16_t item, item_value value, bool upda
|
||||
if (rows.empty())
|
||||
continue;
|
||||
|
||||
// if (cif::VERBOSE > 2)
|
||||
// if (VERBOSE > 2)
|
||||
// {
|
||||
// std::cerr << "Parent: " << linked->mParentcategory << " Child: " << linked->m_child_category << '\n'
|
||||
// << cond << '\n';
|
||||
@@ -1644,7 +1643,7 @@ void category::update_value(row *row, uint16_t item, item_value value, bool upda
|
||||
auto rows_n = childCat->find(std::move(cond_n));
|
||||
if (not rows_n.empty())
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Will not rename in child category since there are already rows that link to the parent\n";
|
||||
|
||||
continue;
|
||||
|
||||
@@ -425,7 +425,7 @@ compound *compound_factory_impl::create(const std::string &id)
|
||||
|
||||
if (m_index.empty())
|
||||
{
|
||||
if (cif::VERBOSE > 1)
|
||||
if (VERBOSE > 1)
|
||||
{
|
||||
std::cout << "Creating component index "
|
||||
<< "...";
|
||||
@@ -435,7 +435,7 @@ compound *compound_factory_impl::create(const std::string &id)
|
||||
cif::parser parser(*ccd, file);
|
||||
m_index = parser.index_datablocks();
|
||||
|
||||
if (cif::VERBOSE > 1)
|
||||
if (VERBOSE > 1)
|
||||
std::cout << " done\n";
|
||||
|
||||
// reload the resource, perhaps this should be improved...
|
||||
@@ -449,7 +449,7 @@ compound *compound_factory_impl::create(const std::string &id)
|
||||
ccd = std::make_unique<std::ifstream>(m_file);
|
||||
}
|
||||
|
||||
if (cif::VERBOSE > 1)
|
||||
if (VERBOSE > 1)
|
||||
{
|
||||
std::cout << "Loading component " << id << "...";
|
||||
std::cout.flush();
|
||||
@@ -458,7 +458,7 @@ compound *compound_factory_impl::create(const std::string &id)
|
||||
cif::parser parser(*ccd, file);
|
||||
parser.parse_single_datablock(id, m_index);
|
||||
|
||||
if (cif::VERBOSE > 1)
|
||||
if (VERBOSE > 1)
|
||||
std::cout << " done\n";
|
||||
|
||||
if (not file.empty())
|
||||
@@ -650,7 +650,7 @@ compound_factory::compound_factory()
|
||||
auto ccd = cif::load_resource("components.cif");
|
||||
if (ccd)
|
||||
m_impl = std::make_shared<compound_factory_impl>();
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
std::cerr << "CCD components.cif resource was not found\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "cif++/datablock.hpp"
|
||||
|
||||
#include "cif++/validate.hpp"
|
||||
#include "cif++/utilities.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
@@ -127,7 +128,7 @@ bool datablock::strip()
|
||||
bool result = false;
|
||||
if (c.get_cat_validator() == nullptr)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Dropping category " << c.name() << '\n';
|
||||
result = true;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "cif++/condition.hpp"
|
||||
#include "cif++/file.hpp"
|
||||
#include "cif++/parser.hpp"
|
||||
#include "cif++/utilities.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
@@ -309,7 +310,7 @@ class dictionary_parser : public parser
|
||||
|
||||
auto vi = std::ranges::find(ivs, item_validator{ item_name });
|
||||
if (vi == ivs.end())
|
||||
ivs.push_back(item_validator{ item_name, iequals(mandatory, "yes"), tv, ess, defaultValue, cat_name, std::move(aliases) });
|
||||
ivs.push_back(item_validator{ item_name, iequals(mandatory, "yes"), tv, ess, defaultValue, cat_name, aliases });
|
||||
else
|
||||
{
|
||||
// need to update the itemValidator?
|
||||
@@ -498,7 +499,7 @@ class dictionary_parser : public parser
|
||||
{
|
||||
for (auto &iv : cv.m_item_validators)
|
||||
{
|
||||
if (iv.m_type == nullptr and cif::VERBOSE >= 0)
|
||||
if (iv.m_type == nullptr and VERBOSE >= 0)
|
||||
std::cerr << "Missing item_type for " << iv.m_item_name << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
#include "cif++/text.hpp"
|
||||
|
||||
#include <exception>
|
||||
#include <ranges>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace cif
|
||||
{
|
||||
|
||||
11
src/item.cpp
11
src/item.cpp
@@ -29,8 +29,7 @@
|
||||
#include "cif++/row.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <compare>
|
||||
#include <string_view>
|
||||
|
||||
namespace cif
|
||||
@@ -99,7 +98,13 @@ int item_value::compare(const item_value &b, bool ignore_case) const noexcept
|
||||
}
|
||||
else if (is_number() and b.is_number())
|
||||
{
|
||||
auto dp = (get<double>() <=> b.get<double>());
|
||||
std::partial_ordering dp = std::partial_ordering::equivalent;
|
||||
|
||||
if (is_number_float())
|
||||
dp = m_data.m_value.m_float <=> b.m_data.m_value.m_integer;
|
||||
else/* if (is_number_int()) */
|
||||
dp = m_data.m_value.m_integer <=> b.m_data.m_value.m_float;
|
||||
|
||||
if (dp == std::partial_ordering::less)
|
||||
d = -1;
|
||||
else if (dp == std::partial_ordering::greater)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "cif++/parser.hpp"
|
||||
|
||||
#include "cif++/condition.hpp"
|
||||
#include "cif++/file.hpp"
|
||||
#include "cif++/forward_decl.hpp"
|
||||
#include "cif++/utilities.hpp"
|
||||
@@ -382,7 +381,7 @@ sac_parser::CIFToken sac_parser::get_next_token()
|
||||
state = State::TextItemNL;
|
||||
else if (ch == kEOF)
|
||||
error("unterminated textfield");
|
||||
else if (not is_any_print(ch) and cif::VERBOSE > 2)
|
||||
else if (not is_any_print(ch) and VERBOSE > 2)
|
||||
warning("invalid character in text field '" + std::string({ static_cast<char>(ch) }) + "' (" + std::to_string(ch) + ")");
|
||||
break;
|
||||
|
||||
@@ -398,7 +397,7 @@ sac_parser::CIFToken sac_parser::get_next_token()
|
||||
}
|
||||
else if (ch == kEOF)
|
||||
error("unterminated textfield");
|
||||
else if (not is_any_print(ch) and cif::VERBOSE > 2)
|
||||
else if (not is_any_print(ch) and VERBOSE > 2)
|
||||
warning("invalid character in text field '" + std::string({ static_cast<char>(ch) }) + "' (" + std::to_string(ch) + ")");
|
||||
break;
|
||||
|
||||
@@ -437,7 +436,7 @@ sac_parser::CIFToken sac_parser::get_next_token()
|
||||
error("unterminated quoted string");
|
||||
else if (ch == quoteChar)
|
||||
state = State::QuotedStringQuote;
|
||||
else if (not is_any_print(ch) and cif::VERBOSE > 2)
|
||||
else if (not is_any_print(ch) and VERBOSE > 2)
|
||||
warning("invalid character in quoted string: '" + std::string({ static_cast<char>(ch) }) + "' (" + std::to_string(ch) + ")");
|
||||
break;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <map>
|
||||
#include <regex>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
// NOLINTBEGIN(bugprone-empty-catch)
|
||||
|
||||
@@ -640,7 +641,7 @@ class FBase
|
||||
|
||||
protected:
|
||||
FBase(const_row_handle r, const char *f)
|
||||
: mRow(r)
|
||||
: mRow(std::move(r))
|
||||
, mField(f)
|
||||
{
|
||||
}
|
||||
@@ -665,7 +666,7 @@ class Fi : public FBase
|
||||
{
|
||||
public:
|
||||
Fi(const_row_handle r, const char *f)
|
||||
: FBase(r, f)
|
||||
: FBase(std::move(r), f)
|
||||
{
|
||||
}
|
||||
Fi(const category &cat, condition &&cond, const char *f)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "cif++/model.hpp"
|
||||
#include "cif++/pdb.hpp"
|
||||
#include "cif++/symmetry.hpp"
|
||||
#include "cif++/utilities.hpp"
|
||||
#include "pdb2cif_remark_3.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -262,7 +263,7 @@ int PDBRecord::vI(int columnFirst, int columnLast)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
std::cerr << "Trying to parse '" << std::string(mValue + columnFirst - 7, mValue + columnLast - 7) << '\'' << '\n';
|
||||
throw;
|
||||
}
|
||||
@@ -332,7 +333,7 @@ std::tuple<std::string, std::string> SpecificationListParser::GetNextSpecificati
|
||||
}
|
||||
else if (not isspace(ch))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "skipping invalid character in SOURCE ID: " << ch << '\n';
|
||||
}
|
||||
break;
|
||||
@@ -349,7 +350,7 @@ std::tuple<std::string, std::string> SpecificationListParser::GetNextSpecificati
|
||||
case eColon:
|
||||
if (ch == ';')
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Empty value for SOURCE: " << id << '\n';
|
||||
state = eStart;
|
||||
}
|
||||
@@ -413,7 +414,7 @@ std::tuple<std::string, std::string> SpecificationListParser::GetNextSpecificati
|
||||
case eError:
|
||||
if (ch == ';')
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Skipping invalid header line: '" << std::string(start, mP) << '\n';
|
||||
state = eStart;
|
||||
}
|
||||
@@ -819,7 +820,7 @@ class PDBFileParser
|
||||
if (not mChainSeq2AsymSeq.count(key))
|
||||
{
|
||||
ec = error::make_error_code(error::pdbErrors::residueNotFound);
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Residue " << chainID << resSeq << iCode << " could not be mapped\n";
|
||||
}
|
||||
else
|
||||
@@ -907,7 +908,7 @@ class PDBFileParser
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << ex.what() << '\n';
|
||||
ec = error::make_error_code(error::pdbErrors::invalidDate);
|
||||
}
|
||||
@@ -919,7 +920,7 @@ class PDBFileParser
|
||||
{
|
||||
std::error_code ec;
|
||||
auto result = pdb2cifDate(s, ec);
|
||||
if (ec and cif::VERBOSE > 0)
|
||||
if (ec and VERBOSE > 0)
|
||||
std::cerr << "Invalid date(" << s << "): " << ec.message() << '\n';
|
||||
return result;
|
||||
}
|
||||
@@ -1138,7 +1139,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
|
||||
if (is.eof())
|
||||
break;
|
||||
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Line number " << lineNr << " is empty!\n";
|
||||
|
||||
getline(is, lookahead);
|
||||
@@ -1259,7 +1260,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
std::cerr << "Dropping FORMUL line (" << (lineNr - 1) << ") with invalid component number '" << value.substr(1, 3) << '\'' << '\n';
|
||||
continue;
|
||||
// throw_with_nested(std::runtime_error("Invalid component number '" + value.substr(1, 3) + '\''));
|
||||
@@ -1286,7 +1287,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
std::cerr << "Error parsing FORMUL at line " << lineNr << '\n';
|
||||
throw;
|
||||
}
|
||||
@@ -1385,7 +1386,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
|
||||
{
|
||||
auto f = cur->vF(74, 78);
|
||||
auto r = cif::from_chars(f.data(), f.data() + f.length(), link.distance);
|
||||
if (r.ec != std::errc{} and cif::VERBOSE > 0)
|
||||
if (r.ec != std::errc{} and VERBOSE > 0)
|
||||
std::cerr << "Error parsing link distance at line " << cur->mLineNr << '\n';
|
||||
}
|
||||
// 74 – 78 Real(5.2) Length Link distance
|
||||
@@ -1399,7 +1400,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
|
||||
|
||||
if (not dropped.empty())
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
std::cerr << "Dropped unsupported records: " << cif::join(dropped, ", ") << '\n';
|
||||
}
|
||||
|
||||
@@ -1428,7 +1429,7 @@ void PDBFileParser::Match(const std::string &expected, bool throwIfMissing)
|
||||
{
|
||||
if (throwIfMissing)
|
||||
throw std::runtime_error("Expected record " + expected + " but found " + mRec->mName);
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Expected record " + expected + " but found " + mRec->mName << '\n';
|
||||
}
|
||||
}
|
||||
@@ -1566,7 +1567,7 @@ void PDBFileParser::ParseTitle()
|
||||
|
||||
if (not iequals(key, "MOL_ID") and mCompounds.empty())
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Ignoring invalid COMPND record\n";
|
||||
break;
|
||||
}
|
||||
@@ -1614,7 +1615,7 @@ void PDBFileParser::ParseTitle()
|
||||
// auto colon = s.find(": ");
|
||||
// if (colon == std::string::npos)
|
||||
// {
|
||||
// if (cif::VERBOSE > 0)
|
||||
// if (VERBOSE > 0)
|
||||
// std::cerr << "invalid source field, missing colon (" << s << ')' << '\n';
|
||||
// continue;
|
||||
// }
|
||||
@@ -1708,7 +1709,7 @@ void PDBFileParser::ParseTitle()
|
||||
// NUMMDL
|
||||
if (mRec->is("NUMMDL"))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "skipping unimplemented NUMMDL record\n";
|
||||
GetNextRecord();
|
||||
}
|
||||
@@ -1825,7 +1826,7 @@ void PDBFileParser::ParseTitle()
|
||||
// SPRSDE
|
||||
if (mRec->is("SPRSDE"))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "skipping unimplemented SPRSDE record\n";
|
||||
GetNextRecord();
|
||||
}
|
||||
@@ -2278,7 +2279,7 @@ void PDBFileParser::ParseRemarks()
|
||||
state = eMCP;
|
||||
else if (subtopic == "CHIRAL CENTERS")
|
||||
state = eChC;
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
throw std::runtime_error("Unknown subtopic in REMARK 500: " + subtopic);
|
||||
|
||||
headerSeen = false;
|
||||
@@ -2359,7 +2360,7 @@ void PDBFileParser::ParseRemarks()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping REMARK 500 at line " << mRec->mLineNr << " due to invalid symmetry operation\n";
|
||||
continue;
|
||||
}
|
||||
@@ -2720,7 +2721,7 @@ void PDBFileParser::ParseRemarks()
|
||||
case sStart:
|
||||
if (s == "SITE")
|
||||
state = sID;
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
throw std::runtime_error("Invalid REMARK 800 record, expected SITE");
|
||||
break;
|
||||
|
||||
@@ -2730,7 +2731,7 @@ void PDBFileParser::ParseRemarks()
|
||||
id = m[1].str();
|
||||
state = sEvidence;
|
||||
}
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
throw std::runtime_error("Invalid REMARK 800 record, expected SITE_IDENTIFIER");
|
||||
break;
|
||||
|
||||
@@ -2740,7 +2741,7 @@ void PDBFileParser::ParseRemarks()
|
||||
evidence = m[1].str();
|
||||
state = sDesc;
|
||||
}
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
throw std::runtime_error("Invalid REMARK 800 record, expected SITE_IDENTIFIER");
|
||||
break;
|
||||
|
||||
@@ -2963,7 +2964,7 @@ void PDBFileParser::ParseRemark200()
|
||||
collectionDate = pdb2cifDate(rm200("DATE OF DATA COLLECTION", diffrnNr), ec);
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << ec.message() << " for pdbx_collection_date\n";
|
||||
|
||||
// The date field can become truncated when multiple values are available
|
||||
@@ -3103,7 +3104,7 @@ void PDBFileParser::ParseRemark200()
|
||||
else if (inRM200({ "HIGHEST RESOLUTION SHELL, RANGE LOW (A)", "COMPLETENESS FOR SHELL (%)",
|
||||
"R MERGE FOR SHELL (I)", "R SYM FOR SHELL (I)", "<I/SIGMA(I)> FOR SHELL", "DATA REDUNDANCY IN SHELL" }))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Not writing reflns_shell record since d_res_high is missing\n";
|
||||
}
|
||||
}
|
||||
@@ -3683,7 +3684,7 @@ void PDBFileParser::ConstructEntities()
|
||||
{
|
||||
auto &r = chain.mResiduesSeen[lastResidueIndex + 1];
|
||||
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
{
|
||||
std::cerr << "Detected residues that cannot be aligned to SEQRES\n"
|
||||
<< "First residue is " << chain.mDbref.chainID << ':' << r.mSeqNum << r.mIcode << '\n';
|
||||
@@ -4140,7 +4141,7 @@ void PDBFileParser::ConstructEntities()
|
||||
std::tie(asym, labelSeq, std::ignore) = MapResidue(seqadv.chainID, seqadv.seqNum, seqadv.iCode, ec);
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "dropping unmatched SEQADV record\n";
|
||||
continue;
|
||||
}
|
||||
@@ -4494,7 +4495,7 @@ void PDBFileParser::ConstructEntities()
|
||||
std::tie(asymID, seq, std::ignore) = MapResidue(chainID, seqNum, iCode, ec);
|
||||
if (ec) // no need to write a modres if it could not be found
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "dropping unmapped MODRES record\n";
|
||||
continue;
|
||||
}
|
||||
@@ -4595,7 +4596,7 @@ void PDBFileParser::ConstructEntities()
|
||||
std::tie(asymID, seqNr, isPolymer) = MapResidue(unobs.chain, unobs.seq, unobs.iCode, ec);
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "error mapping unobserved residue\n";
|
||||
continue;
|
||||
}
|
||||
@@ -4881,7 +4882,7 @@ void PDBFileParser::ParseSecondaryStructure()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Could not map residue for HELIX " << vI(8, 10) << '\n';
|
||||
}
|
||||
else
|
||||
@@ -5004,7 +5005,7 @@ void PDBFileParser::ParseSecondaryStructure()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping SHEET record " << vI(8, 10) << '\n';
|
||||
}
|
||||
else
|
||||
@@ -5042,7 +5043,7 @@ void PDBFileParser::ParseSecondaryStructure()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "skipping unmatched pdbx_struct_sheet_hbond record\n";
|
||||
}
|
||||
else
|
||||
@@ -5144,7 +5145,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping SSBOND " << vI(8, 10) << '\n';
|
||||
continue;
|
||||
}
|
||||
@@ -5165,7 +5166,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping SSBOND " << vI(8, 10) << " due to invalid symmetry operation\n";
|
||||
continue;
|
||||
}
|
||||
@@ -5212,7 +5213,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
|
||||
if (mRec->is("LINK ") or mRec->is("LINKR "))
|
||||
{
|
||||
if (cif::VERBOSE > 0 and mRec->is("LINKR "))
|
||||
if (VERBOSE > 0 and mRec->is("LINKR "))
|
||||
std::cerr << "Accepting non-standard LINKR record, but ignoring extra information\n";
|
||||
|
||||
// 1 - 6 Record name "LINK "
|
||||
@@ -5265,7 +5266,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping LINK record at line " << mRec->mLineNr << '\n';
|
||||
continue;
|
||||
}
|
||||
@@ -5280,7 +5281,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
auto r = cif::from_chars(distance.data(), distance.data() + distance.length(), d);
|
||||
if (r.ec != std::errc{})
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Distance value '" << distance << "' is not a valid float in LINK record\n";
|
||||
swap(ccp4LinkID, distance); // assume this is a ccp4_link_id... oh really?
|
||||
}
|
||||
@@ -5296,7 +5297,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping LINK record at line " << mRec->mLineNr << " due to invalid symmetry operation\n";
|
||||
continue;
|
||||
}
|
||||
@@ -5371,7 +5372,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Dropping CISPEP record at line " << mRec->mLineNr << '\n';
|
||||
continue;
|
||||
}
|
||||
@@ -5441,7 +5442,7 @@ void PDBFileParser::ParseMiscellaneousFeatures()
|
||||
|
||||
if (ec)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "skipping struct_site_gen record\n";
|
||||
}
|
||||
else
|
||||
@@ -5765,7 +5766,7 @@ void PDBFileParser::ParseCoordinate(int modelNr)
|
||||
{
|
||||
if (groupPDB == "HETATM")
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Changing atom from HETATM to ATOM at line " << mRec->mLineNr << '\n';
|
||||
groupPDB = "ATOM";
|
||||
}
|
||||
@@ -5774,7 +5775,7 @@ void PDBFileParser::ParseCoordinate(int modelNr)
|
||||
{
|
||||
if (groupPDB == "ATOM")
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Changing atom from ATOM to HETATM at line " << mRec->mLineNr << '\n';
|
||||
groupPDB = "HETATM";
|
||||
}
|
||||
@@ -5965,7 +5966,7 @@ void PDBFileParser::Parse(std::istream &is, cif::file &result)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
std::cerr << "Error parsing REMARK 3\n";
|
||||
throw;
|
||||
}
|
||||
@@ -6024,12 +6025,12 @@ void PDBFileParser::Parse(std::istream &is, cif::file &result)
|
||||
(x1 - x2) * (x1 - x2) +
|
||||
(y1 - y2) * (y1 - y2) +
|
||||
(z1 - z2) * (z1 - z2));
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
std::cerr << "Cannot calculate distance for link since one of the atoms is in another dimension\n";
|
||||
}
|
||||
catch (std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Error finding atom for LINK distance calculation: " << ex.what() << '\n';
|
||||
}
|
||||
|
||||
@@ -6040,7 +6041,7 @@ void PDBFileParser::Parse(std::istream &is, cif::file &result)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
{
|
||||
std::cerr << "Error parsing PDB";
|
||||
if (mRec != nullptr)
|
||||
@@ -6263,7 +6264,7 @@ int PDBFileParser::PDBChain::AlignResToSeqRes()
|
||||
std::cerr << '\n';
|
||||
};
|
||||
|
||||
if (cif::VERBOSE > 1)
|
||||
if (VERBOSE > 1)
|
||||
printAlignment();
|
||||
|
||||
try
|
||||
@@ -6280,7 +6281,7 @@ int PDBFileParser::PDBChain::AlignResToSeqRes()
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (cif::VERBOSE > 3)
|
||||
if (VERBOSE > 3)
|
||||
std::cerr << "Missing residue in ATOM records: " << rx[x].mMonID << " at " << rx[x].mSeqNum << '\n';
|
||||
|
||||
--x;
|
||||
@@ -6304,7 +6305,7 @@ int PDBFileParser::PDBChain::AlignResToSeqRes()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE == 1)
|
||||
if (VERBOSE == 1)
|
||||
printAlignment();
|
||||
|
||||
throw;
|
||||
@@ -6364,7 +6365,7 @@ void read_pdb_file(std::istream &pdbFile, cif::file &cifFile)
|
||||
if (cifFile.front().get_validator() == nullptr)
|
||||
cifFile.front().set_validator(validator_factory::instance().get("mmcif_pdbx.dic"));
|
||||
|
||||
if (not cifFile.is_valid() and cif::VERBOSE >= 0)
|
||||
if (not cifFile.is_valid() and VERBOSE >= 0)
|
||||
std::cerr << "Resulting mmCIF file is not valid!\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ std::string Remark3Parser::nextLine()
|
||||
break;
|
||||
}
|
||||
|
||||
if (cif::VERBOSE >= 2)
|
||||
if (VERBOSE >= 2)
|
||||
std::cerr << "RM3: " << mLine << '\n';
|
||||
|
||||
return mLine;
|
||||
@@ -1089,7 +1089,7 @@ bool Remark3Parser::match(const char *expr, uint32_t nextState)
|
||||
|
||||
if (result)
|
||||
mState = nextState;
|
||||
else if (cif::VERBOSE >= 3)
|
||||
else if (VERBOSE >= 3)
|
||||
{
|
||||
using namespace colour;
|
||||
|
||||
@@ -1153,7 +1153,7 @@ float Remark3Parser::parse()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cif::VERBOSE >= 2)
|
||||
if (VERBOSE >= 2)
|
||||
{
|
||||
using namespace colour;
|
||||
|
||||
@@ -1209,7 +1209,7 @@ void Remark3Parser::storeCapture(const char *category, std::initializer_list<con
|
||||
if (iequals(value, "NULL") or iequals(value, "NONE") or iequals(value, "Inf") or iequals(value, "+Inf") or iequals(value, std::string(value.length(), '*')))
|
||||
continue;
|
||||
|
||||
if (cif::VERBOSE >= 3)
|
||||
if (VERBOSE >= 3)
|
||||
std::cerr << "storing: '" << value << "' in _" << category << '.' << item << '\n';
|
||||
|
||||
auto &cat = mDb[category];
|
||||
@@ -1367,7 +1367,7 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
|
||||
|
||||
if (line != "REFINEMENT.")
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Unexpected data in REMARK 3\n";
|
||||
return false;
|
||||
}
|
||||
@@ -1379,7 +1379,7 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
|
||||
|
||||
if (not std::regex_match(line, m, rxp))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Expected valid PROGRAM line in REMARK 3\n";
|
||||
return false;
|
||||
}
|
||||
@@ -1418,13 +1418,13 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
if (cif::VERBOSE >= 0)
|
||||
if (VERBOSE >= 0)
|
||||
std::cerr << "Error parsing REMARK 3 with " << parser->program() << '\n'
|
||||
<< e.what() << '\n';
|
||||
score = 0;
|
||||
}
|
||||
|
||||
if (cif::VERBOSE >= 2)
|
||||
if (VERBOSE >= 2)
|
||||
std::cerr << "Score for " << parser->program() << ": " << score << '\n';
|
||||
|
||||
if (score > 0)
|
||||
@@ -1458,7 +1458,7 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
|
||||
tryParser(new TNT_Remark3Parser(program, expMethod, r, db));
|
||||
else if (cif::starts_with(program, "X-PLOR"))
|
||||
tryParser(new XPLOR_Remark3Parser(program, expMethod, r, db));
|
||||
else if (cif::VERBOSE > 0)
|
||||
else if (VERBOSE > 0)
|
||||
std::cerr << "Skipping unknown program (" << program << ") in REMARK 3\n";
|
||||
}
|
||||
|
||||
@@ -1467,7 +1467,7 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
|
||||
bool guessProgram = scores.empty() or scores.front().score < 0.9f;
|
||||
if (guessProgram)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Unknown or untrusted program in REMARK 3, trying all parsers to see if there is a match\n";
|
||||
|
||||
tryParser(new BUSTER_TNT_Remark3Parser("BUSTER-TNT", expMethod, r, db));
|
||||
@@ -1492,7 +1492,7 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
|
||||
|
||||
auto &best = scores.front();
|
||||
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::cerr << "Choosing " << best.parser->program() << " version '" << best.parser->version() << "' as refinement program. Score = " << best.score << '\n';
|
||||
|
||||
auto &software = db["software"];
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "cif++/compound.hpp"
|
||||
// #include "cif++/cql.hpp"
|
||||
#include "cif++/item.hpp"
|
||||
#include "cif++/point.hpp"
|
||||
#include "cif++/row.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -147,7 +146,7 @@ void checkEntities(datablock &db)
|
||||
auto compound = cf.create(comp_id);
|
||||
if (compound)
|
||||
formula_weight += compound->formula_weight();
|
||||
// else if (cif::VERBOSE > 0)
|
||||
// else if (VERBOSE > 0)
|
||||
// std::clog << "missing information for compound " + comp_id << '\n';
|
||||
++n;
|
||||
}
|
||||
@@ -165,7 +164,7 @@ void checkEntities(datablock &db)
|
||||
auto compound = cf.create(comp_id);
|
||||
if (compound)
|
||||
formula_weight += compound->formula_weight();
|
||||
// else if (cif::VERBOSE > 0)
|
||||
// else if (VERBOSE > 0)
|
||||
// std::clog << "missing information for compound " + comp_id << '\n';
|
||||
++n;
|
||||
}
|
||||
@@ -355,7 +354,7 @@ void fillLabelAsymID(category &atom_site)
|
||||
mapAuthAsymIDAndEntityToLabelAsymID.emplace(key, label_asym_id);
|
||||
else if (i->second != label_asym_id)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Inconsistent assignment of label_asym_id for the tuple entity_id: " << *label_entity_id << " and auth_asym_id: " << auth_asym_id << '\n';
|
||||
|
||||
mapAuthAsymIDAndEntityToLabelAsymID.clear();
|
||||
@@ -569,7 +568,7 @@ void checkAtomRecords(datablock &db)
|
||||
if (not compound)
|
||||
{
|
||||
missingCompounds.insert(comp_id);
|
||||
// if (cif::VERBOSE > 0)
|
||||
// if (VERBOSE > 0)
|
||||
// std::cerr << "Missing compound information for " << comp_id << "\n";
|
||||
continue;
|
||||
}
|
||||
@@ -671,12 +670,12 @@ void checkAtomRecords(datablock &db)
|
||||
// auto r = atom_site.find_first(key(item_name) != null);
|
||||
// if (not r)
|
||||
// {
|
||||
// if (cif::VERBOSE > 0)
|
||||
// if (VERBOSE > 0)
|
||||
// std::clog << "Dropping unknown item " << item_name << '\n';
|
||||
|
||||
// atom_site.remove_item(item_name);
|
||||
// }
|
||||
// else if (cif::VERBOSE > 0)
|
||||
// else if (VERBOSE > 0)
|
||||
// std::clog << "Keeping unknown item " << std::quoted(item_name) << " in atom_site since it is not empty\n";
|
||||
// }
|
||||
// }
|
||||
@@ -718,7 +717,7 @@ void checkAtomAnisotropRecords(datablock &db)
|
||||
row["type_symbol"] = parent["type_symbol"].value();
|
||||
else if (row["type_symbol"].value() != parent["type_symbol"].value())
|
||||
{
|
||||
if (cif::VERBOSE and std::exchange(warnReplaceTypeSymbol, false))
|
||||
if (VERBOSE and std::exchange(warnReplaceTypeSymbol, false))
|
||||
std::clog << "Replacing type_symbol in atom_site_anisotrop record(s)\n";
|
||||
row["type_symbol"] = parent["type_symbol"].value();
|
||||
}
|
||||
@@ -737,7 +736,7 @@ void checkAtomAnisotropRecords(datablock &db)
|
||||
|
||||
if (not to_be_deleted.empty())
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Dropped " << to_be_deleted.size() << " anisotrop records since they did not have exactly one parent\n";
|
||||
|
||||
for (auto row : to_be_deleted)
|
||||
@@ -1232,7 +1231,7 @@ void comparePolySeqSchemes(datablock &db)
|
||||
// If we have different Asym ID's assume the ndb is invalid.
|
||||
if (asym_ids_ndb != asym_ids_pdbx)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "The asym ID's of ndb_poly_seq_scheme and pdbx_poly_seq_scheme are not equal, dropping ndb_poly_seq_scheme\n";
|
||||
ndb_poly_seq_scheme.clear();
|
||||
}
|
||||
@@ -1250,7 +1249,7 @@ void comparePolySeqSchemes(datablock &db)
|
||||
{
|
||||
if (ndb_i == ndb_range.end() or pdbx_i == pdbx_range.end())
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "The sequences in ndb_poly_seq_scheme and pdbx_poly_seq_scheme are unequal in size for asym ID " << asym_id << '\n';
|
||||
valid = false;
|
||||
break;
|
||||
@@ -1261,7 +1260,7 @@ void comparePolySeqSchemes(datablock &db)
|
||||
|
||||
if (ndb_mon_id != pdbx_mon_id)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "The sequences in ndb_poly_seq_scheme and pdbx_poly_seq_scheme contain different mon ID's for asym ID " << asym_id << '\n';
|
||||
valid = false;
|
||||
break;
|
||||
@@ -1270,7 +1269,7 @@ void comparePolySeqSchemes(datablock &db)
|
||||
|
||||
if (not valid)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Dropping asym ID " << asym_id << " from ndb_poly_seq_scheme\n";
|
||||
ndb_poly_seq_scheme.erase(key("id") == asym_id);
|
||||
}
|
||||
@@ -1432,7 +1431,7 @@ void reconstruct_index_for_category(const validator &validator, category &cat, d
|
||||
{
|
||||
if (state == State::MissingKeys)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Repairing failed for category " << cat.name() << ", missing keys remain: " << ex.what() << '\n';
|
||||
|
||||
throw;
|
||||
@@ -1442,7 +1441,7 @@ void reconstruct_index_for_category(const validator &validator, category &cat, d
|
||||
|
||||
auto key = ex.get_key();
|
||||
|
||||
if (cif::VERBOSE > 1)
|
||||
if (VERBOSE > 1)
|
||||
std::clog << "Need to add key " << key << " to category " << cat.name() << '\n';
|
||||
|
||||
for (auto row : cat)
|
||||
@@ -1459,7 +1458,7 @@ void reconstruct_index_for_category(const validator &validator, category &cat, d
|
||||
{
|
||||
if (state == State::DuplicateKeys)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Repairing failed for category " << cat.name() << ", duplicate keys remain: " << ex.what() << '\n';
|
||||
|
||||
throw;
|
||||
@@ -1467,7 +1466,7 @@ void reconstruct_index_for_category(const validator &validator, category &cat, d
|
||||
|
||||
state = State::DuplicateKeys;
|
||||
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Attempt to fix " << cat.name() << " failed: " << ex.what() << '\n';
|
||||
|
||||
// replace items that do not define a relation to a parent
|
||||
@@ -1585,7 +1584,7 @@ bool reconstruct_pdbx(file &file, const validator &validator)
|
||||
if (not iv)
|
||||
continue;
|
||||
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Renaming " << item_name << " to " << iv->m_item_name << " in category " << cat.name() << '\n';
|
||||
cat.rename_item(item_name, iv->m_item_name);
|
||||
}
|
||||
@@ -1634,7 +1633,7 @@ bool reconstruct_pdbx(file &file, const validator &validator)
|
||||
{
|
||||
if (not cat.has_item(item))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Adding mandatory item " << item << " to category " << cat.name() << '\n';
|
||||
|
||||
cat.add_item(item);
|
||||
@@ -1662,7 +1661,7 @@ bool reconstruct_pdbx(file &file, const validator &validator)
|
||||
|
||||
if (not iv->validate_value(row[ix].value(), ec))
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << "Replacing value (" << std::quoted(row[ix].str()) << ") for item " << item_name << " in category " << cat.name() << " since it does not validate\n";
|
||||
|
||||
row[ix] = item_value{ cif::item_value_type::INAPPLICABLE };
|
||||
@@ -1674,7 +1673,7 @@ bool reconstruct_pdbx(file &file, const validator &validator)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
if (cif::VERBOSE > 0)
|
||||
if (VERBOSE > 0)
|
||||
std::clog << ex.what() << '\n';
|
||||
|
||||
std::clog << "Will drop category " << cat.name() << " since it cannot be repaired\n";
|
||||
@@ -1759,7 +1758,7 @@ void fixup_pdbx(file &file, const validator &validator)
|
||||
// Be silent about missing compound info in fixup
|
||||
auto &cf = compound_factory::instance();
|
||||
bool save_report = cf.get_report_missing();
|
||||
cf.set_report_missing(cif::VERBOSE > 1);
|
||||
cf.set_report_missing(VERBOSE > 1);
|
||||
|
||||
std::string entry_id;
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ row_initializer::row_initializer(const_row_handle rh)
|
||||
auto r = rh.get_row();
|
||||
auto &cat = *rh.m_category;
|
||||
|
||||
for (uint16_t ix = 0; ix < r->size(); ++ix)
|
||||
for (uint16_t ix = 0; std::cmp_less(ix, r->size()); ++ix)
|
||||
{
|
||||
auto &i = r->operator[](ix);
|
||||
if (not i)
|
||||
|
||||
@@ -536,9 +536,9 @@ _test.name
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 1: CHECK(*name == "aap"); break;
|
||||
case 2: CHECK(*name == "noot"); break;
|
||||
case 3: CHECK(*name == "mies"); break;
|
||||
case 1: REQUIRE(name.has_value()); CHECK(*name == "aap"); break;
|
||||
case 2: REQUIRE(name.has_value()); CHECK(*name == "noot"); break;
|
||||
case 3: REQUIRE(name.has_value()); CHECK(*name == "mies"); break;
|
||||
case 4:
|
||||
case 5: CHECK_FALSE(name.has_value()); break;
|
||||
default: CHECK(false);
|
||||
@@ -2037,7 +2037,7 @@ _test.name
|
||||
std::optional<int> v;
|
||||
|
||||
v = db["test"].find_first<std::optional<int>>(cif::key("id") == 1, "id");
|
||||
CHECK(v.has_value());
|
||||
REQUIRE(v.has_value());
|
||||
CHECK(*v == 1);
|
||||
|
||||
v = db["test"].find_first<std::optional<int>>(cif::key("id") == 6, "id");
|
||||
@@ -3462,9 +3462,9 @@ _name
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 1: CHECK(*name == "aap"); break;
|
||||
case 2: CHECK(*name == "noot"); break;
|
||||
case 3: CHECK(*name == "mies"); break;
|
||||
case 1: REQUIRE(name.has_value()); CHECK(*name == "aap"); break;
|
||||
case 2: REQUIRE(name.has_value()); CHECK(*name == "noot"); break;
|
||||
case 3: REQUIRE(name.has_value()); CHECK(*name == "mies"); break;
|
||||
default: CHECK(name.has_value() == false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user