mirror of
https://github.com/PDB-REDO/libcifpp.git
synced 2026-06-04 22:14:24 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15a49f1bb4 | ||
|
|
db1dff16fe | ||
|
|
8d7d9d3a31 | ||
|
|
078bf8a559 | ||
|
|
1f314a5e9b | ||
|
|
0adb50ac01 | ||
|
|
d91707cd06 | ||
|
|
c0e7ee4eeb | ||
|
|
c143a7223e | ||
|
|
2c951ba146 | ||
|
|
660aadcd9c | ||
|
|
91d6adb980 | ||
|
|
b79ddd55c5 | ||
|
|
0ca645c634 | ||
|
|
676c0c8dc8 | ||
|
|
5c366ad9b1 |
@@ -25,7 +25,7 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# set the project name
|
||||
project(cifpp VERSION 5.1.0.1 LANGUAGES CXX)
|
||||
project(cifpp VERSION 5.1.1 LANGUAGES CXX)
|
||||
|
||||
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
@@ -98,33 +98,33 @@ if(BUILD_FOR_CCP4)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(${CMAKE_SYSTEM_VERSION} GREATER_EQUAL 10) # Windows 10
|
||||
add_definitions(-D _WIN32_WINNT=0x0A00)
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.3) # Windows 8.1
|
||||
add_definitions(-D _WIN32_WINNT=0x0603)
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.2) # Windows 8
|
||||
add_definitions(-D _WIN32_WINNT=0x0602)
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.1) # Windows 7
|
||||
add_definitions(-D _WIN32_WINNT=0x0601)
|
||||
elseif(${CMAKE_SYSTEM_VERSION} EQUAL 6.0) # Windows Vista
|
||||
add_definitions(-D _WIN32_WINNT=0x0600)
|
||||
else() # Windows XP (5.1)
|
||||
add_definitions(-D _WIN32_WINNT=0x0501)
|
||||
endif()
|
||||
|
||||
add_definitions(-DNOMINMAX)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# make msvc standards compliant...
|
||||
add_compile_options(/permissive-)
|
||||
# make msvc standards compliant...
|
||||
add_compile_options(/permissive-)
|
||||
|
||||
macro(get_WIN32_WINNT version)
|
||||
if(CMAKE_SYSTEM_VERSION)
|
||||
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
|
||||
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
|
||||
|
||||
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
|
||||
if("${verMajor}" MATCHES "10")
|
||||
set(verMajor "A")
|
||||
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
|
||||
endif()
|
||||
|
||||
# Remove all remaining '.' characters.
|
||||
string(REPLACE "." "" ver ${ver})
|
||||
|
||||
# Prepend each digit with a zero.
|
||||
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
|
||||
set(${version} "0x${ver}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
get_WIN32_WINNT(ver)
|
||||
add_definitions(-D_WIN32_WINNT=${ver})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
else()
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Libraries
|
||||
@@ -292,7 +292,7 @@ target_include_directories(cifpp
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
|
||||
target_link_libraries(cifpp PUBLIC Threads::Threads ZLIB::ZLIB ${CIFPP_REQUIRED_LIBRARIES})
|
||||
target_link_libraries(cifpp PUBLIC Threads::Threads ZLIB::ZLIB Eigen3::Eigen ${CIFPP_REQUIRED_LIBRARIES})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
target_link_options(cifpp PRIVATE -undefined dynamic_lookup)
|
||||
@@ -307,18 +307,7 @@ if(CIFPP_DOWNLOAD_CCD)
|
||||
file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/data/)
|
||||
endif()
|
||||
|
||||
find_program(GUNZIP gunzip)
|
||||
|
||||
if(GUNZIP)
|
||||
file(DOWNLOAD ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz ${COMPONENTS_CIF}.gz
|
||||
SHOW_PROGRESS)
|
||||
add_custom_command(OUTPUT ${COMPONENTS_CIF}
|
||||
COMMAND ${GUNZIP} ${COMPONENTS_CIF}.gz
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/data/)
|
||||
else()
|
||||
file(DOWNLOAD ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif ${COMPONENTS_CIF}
|
||||
SHOW_PROGRESS)
|
||||
endif()
|
||||
file(DOWNLOAD https://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif ${COMPONENTS_CIF} SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
add_custom_target(COMPONENTS ALL DEPENDS ${COMPONENTS_CIF})
|
||||
@@ -469,7 +458,7 @@ endif()
|
||||
|
||||
# Optionally install the update scripts for CCD and dictionary files
|
||||
if(CIFPP_INSTALL_UPDATE_SCRIPT)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "GNU")
|
||||
set(CIFPP_CRON_DIR "${CIFPP_ETC_DIR}/cron.weekly")
|
||||
elseif(UNIX) # assume all others are like FreeBSD...
|
||||
set(CIFPP_CRON_DIR "${CIFPP_ETC_DIR}/periodic/weekly")
|
||||
|
||||
@@ -30,14 +30,21 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Take the first datablock in the file
|
||||
auto &db = file.front();
|
||||
|
||||
// Use the atom_site category
|
||||
auto &atom_site = db["atom_site"];
|
||||
auto n = atom_site.find(cif::key("label_atom_id") == "OXT").size();
|
||||
|
||||
// Count the atoms with atom-id "OXT"
|
||||
auto n = atom_site.count(cif::key("label_atom_id") == "OXT");
|
||||
|
||||
std::cout << "File contains " << atom_site.size() << " atoms of which "
|
||||
<< n << (n == 1 ? " is" : " are") << " OXT" << std::endl
|
||||
<< "residues with an OXT are:" << std::endl;
|
||||
|
||||
// Loop over all atoms with atom-id "OXT" and print out some info.
|
||||
// That info is extracted using structured binding in C++
|
||||
for (const auto &[asym, comp, seqnr] :
|
||||
atom_site.find<std::string, std::string, int>(
|
||||
cif::key("label_atom_id") == "OXT",
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
Version 5.1.1
|
||||
- Added missing include <compare> in symmetry.hpp
|
||||
- Added empty() to matrix
|
||||
- Fix for parsing PDB files with a last line that does not end with
|
||||
a new line character.
|
||||
|
||||
Version 5.1
|
||||
- New parser, optimised for speed
|
||||
- Fix in unique ID generator
|
||||
|
||||
@@ -4,6 +4,7 @@ include(CMakeFindDependencyMacro)
|
||||
find_dependency(Threads)
|
||||
|
||||
find_dependency(ZLIB REQUIRED)
|
||||
find_dependency(Eigen3 REQUIRED)
|
||||
|
||||
if(MSVC)
|
||||
find_dependency(zeep REQUIRED)
|
||||
|
||||
@@ -246,10 +246,13 @@ class basic_igzip_streambuf : public basic_streambuf<CharT, Traits>
|
||||
zstream.avail_in = static_cast<uInt>(this->m_upstream->sgetn(m_in_buffer.data(), m_in_buffer.size()));
|
||||
}
|
||||
|
||||
if (zstream.avail_in == 0)
|
||||
break;
|
||||
|
||||
int err = ::inflate(&zstream, Z_SYNC_FLUSH);
|
||||
std::streamsize n = kBufferByteSize - zstream.avail_out;
|
||||
|
||||
if (err == Z_STREAM_END or (err == Z_OK and n > 0))
|
||||
if (n > 0)
|
||||
{
|
||||
this->setg(
|
||||
m_out_buffer.data(),
|
||||
@@ -258,6 +261,9 @@ class basic_igzip_streambuf : public basic_streambuf<CharT, Traits>
|
||||
break;
|
||||
}
|
||||
|
||||
if (err == Z_STREAM_END and zstream.avail_in > 0)
|
||||
err = ::inflateReset2(&zstream, 47);
|
||||
|
||||
if (err < Z_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,22 +44,24 @@ template <typename M>
|
||||
class matrix_expression
|
||||
{
|
||||
public:
|
||||
constexpr uint32_t dim_m() const { return static_cast<const M &>(*this).dim_m(); }
|
||||
constexpr uint32_t dim_n() const { return static_cast<const M &>(*this).dim_n(); }
|
||||
constexpr size_t dim_m() const { return static_cast<const M &>(*this).dim_m(); }
|
||||
constexpr size_t dim_n() const { return static_cast<const M &>(*this).dim_n(); }
|
||||
|
||||
constexpr auto &operator()(uint32_t i, uint32_t j)
|
||||
constexpr bool empty() const { return dim_m() == 0 or dim_n() == 0; }
|
||||
|
||||
constexpr auto &operator()(size_t i, size_t j)
|
||||
{
|
||||
return static_cast<M &>(*this).operator()(i, j);
|
||||
}
|
||||
|
||||
constexpr auto operator()(uint32_t i, uint32_t j) const
|
||||
constexpr auto operator()(size_t i, size_t j) const
|
||||
{
|
||||
return static_cast<const M &>(*this).operator()(i, j);
|
||||
}
|
||||
|
||||
void swap_row(uint32_t r1, uint32_t r2)
|
||||
void swap_row(size_t r1, size_t r2)
|
||||
{
|
||||
for (uint32_t c = 0; c < dim_m(); ++c)
|
||||
for (size_t c = 0; c < dim_m(); ++c)
|
||||
{
|
||||
auto v = operator()(r1, c);
|
||||
operator()(r1, c) = operator()(r2, c);
|
||||
@@ -67,9 +69,9 @@ class matrix_expression
|
||||
}
|
||||
}
|
||||
|
||||
void swap_col(uint32_t c1, uint32_t c2)
|
||||
void swap_col(size_t c1, size_t c2)
|
||||
{
|
||||
for (uint32_t r = 0; r < dim_n(); ++r)
|
||||
for (size_t r = 0; r < dim_n(); ++r)
|
||||
{
|
||||
auto &a = operator()(r, c1);
|
||||
auto &b = operator()(r, c2);
|
||||
@@ -120,9 +122,9 @@ class matrix : public matrix_expression<matrix<F>>
|
||||
, m_n(m.dim_n())
|
||||
, m_data(m_m * m_n)
|
||||
{
|
||||
for (uint32_t i = 0; i < m_m; ++i)
|
||||
for (size_t i = 0; i < m_m; ++i)
|
||||
{
|
||||
for (uint32_t j = 0; j < m_n; ++j)
|
||||
for (size_t j = 0; j < m_n; ++j)
|
||||
operator()(i, j) = m(i, j);
|
||||
}
|
||||
}
|
||||
@@ -178,9 +180,9 @@ class matrix_fixed : public matrix_expression<matrix_fixed<F, M, N>>
|
||||
matrix_fixed(const M2 &m)
|
||||
{
|
||||
assert(M == m.dim_m() and N == m.dim_n());
|
||||
for (uint32_t i = 0; i < M; ++i)
|
||||
for (size_t i = 0; i < M; ++i)
|
||||
{
|
||||
for (uint32_t j = 0; j < N; ++j)
|
||||
for (size_t j = 0; j < N; ++j)
|
||||
operator()(i, j) = m(i, j);
|
||||
}
|
||||
}
|
||||
@@ -242,7 +244,7 @@ class symmetric_matrix : public matrix_expression<symmetric_matrix<F>>
|
||||
public:
|
||||
using value_type = F;
|
||||
|
||||
symmetric_matrix(uint32_t n, value_type v = 0)
|
||||
symmetric_matrix(size_t n, value_type v = 0)
|
||||
: m_n(n)
|
||||
, m_data((m_n * (m_n + 1)) / 2)
|
||||
{
|
||||
@@ -255,17 +257,17 @@ class symmetric_matrix : public matrix_expression<symmetric_matrix<F>>
|
||||
symmetric_matrix &operator=(symmetric_matrix &&m) = default;
|
||||
symmetric_matrix &operator=(const symmetric_matrix &m) = default;
|
||||
|
||||
constexpr uint32_t dim_m() const { return m_n; }
|
||||
constexpr uint32_t dim_n() const { return m_n; }
|
||||
constexpr size_t dim_m() const { return m_n; }
|
||||
constexpr size_t dim_n() const { return m_n; }
|
||||
|
||||
constexpr value_type operator()(uint32_t i, uint32_t j) const
|
||||
constexpr value_type operator()(size_t i, size_t j) const
|
||||
{
|
||||
return i < j
|
||||
? m_data[(j * (j + 1)) / 2 + i]
|
||||
: m_data[(i * (i + 1)) / 2 + j];
|
||||
}
|
||||
|
||||
constexpr value_type &operator()(uint32_t i, uint32_t j)
|
||||
constexpr value_type &operator()(size_t i, size_t j)
|
||||
{
|
||||
if (i > j)
|
||||
std::swap(i, j);
|
||||
@@ -274,7 +276,7 @@ class symmetric_matrix : public matrix_expression<symmetric_matrix<F>>
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t m_n;
|
||||
size_t m_n;
|
||||
std::vector<value_type> m_data;
|
||||
};
|
||||
|
||||
@@ -296,17 +298,17 @@ class symmetric_matrix_fixed : public matrix_expression<symmetric_matrix_fixed<F
|
||||
symmetric_matrix_fixed &operator=(symmetric_matrix_fixed &&m) = default;
|
||||
symmetric_matrix_fixed &operator=(const symmetric_matrix_fixed &m) = default;
|
||||
|
||||
constexpr uint32_t dim_m() const { return M; }
|
||||
constexpr uint32_t dim_n() const { return M; }
|
||||
constexpr size_t dim_m() const { return M; }
|
||||
constexpr size_t dim_n() const { return M; }
|
||||
|
||||
constexpr value_type operator()(uint32_t i, uint32_t j) const
|
||||
constexpr value_type operator()(size_t i, size_t j) const
|
||||
{
|
||||
return i < j
|
||||
? m_data[(j * (j + 1)) / 2 + i]
|
||||
: m_data[(i * (i + 1)) / 2 + j];
|
||||
}
|
||||
|
||||
constexpr value_type &operator()(uint32_t i, uint32_t j)
|
||||
constexpr value_type &operator()(size_t i, size_t j)
|
||||
{
|
||||
if (i > j)
|
||||
std::swap(i, j);
|
||||
@@ -332,21 +334,21 @@ class identity_matrix : public matrix_expression<identity_matrix<F>>
|
||||
public:
|
||||
using value_type = F;
|
||||
|
||||
identity_matrix(uint32_t n)
|
||||
identity_matrix(size_t n)
|
||||
: m_n(n)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr uint32_t dim_m() const { return m_n; }
|
||||
constexpr uint32_t dim_n() const { return m_n; }
|
||||
constexpr size_t dim_m() const { return m_n; }
|
||||
constexpr size_t dim_n() const { return m_n; }
|
||||
|
||||
constexpr value_type operator()(uint32_t i, uint32_t j) const
|
||||
constexpr value_type operator()(size_t i, size_t j) const
|
||||
{
|
||||
return i == j ? 1 : 0;
|
||||
return static_cast<value_type>(i == j ? 1 : 0);
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t m_n;
|
||||
size_t m_n;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -364,10 +366,10 @@ class matrix_subtraction : public matrix_expression<matrix_subtraction<M1, M2>>
|
||||
assert(m_m1.dim_n() == m_m2.dim_n());
|
||||
}
|
||||
|
||||
constexpr uint32_t dim_m() const { return m_m1.dim_m(); }
|
||||
constexpr uint32_t dim_n() const { return m_m1.dim_n(); }
|
||||
constexpr size_t dim_m() const { return m_m1.dim_m(); }
|
||||
constexpr size_t dim_n() const { return m_m1.dim_n(); }
|
||||
|
||||
constexpr auto operator()(uint32_t i, uint32_t j) const
|
||||
constexpr auto operator()(size_t i, size_t j) const
|
||||
{
|
||||
return m_m1(i, j) - m_m2(i, j);
|
||||
}
|
||||
@@ -394,16 +396,16 @@ class matrix_matrix_multiplication : public matrix_expression<matrix_matrix_mult
|
||||
assert(m1.dim_m() == m2.dim_n());
|
||||
}
|
||||
|
||||
constexpr uint32_t dim_m() const { return m_m1.dim_m(); }
|
||||
constexpr uint32_t dim_n() const { return m_m1.dim_n(); }
|
||||
constexpr size_t dim_m() const { return m_m1.dim_m(); }
|
||||
constexpr size_t dim_n() const { return m_m1.dim_n(); }
|
||||
|
||||
constexpr auto operator()(uint32_t i, uint32_t j) const
|
||||
constexpr auto operator()(size_t i, size_t j) const
|
||||
{
|
||||
using value_type = decltype(m_m1(0, 0));
|
||||
|
||||
value_type result = {};
|
||||
|
||||
for (uint32_t k = 0; k < m_m1.dim_m(); ++k)
|
||||
for (size_t k = 0; k < m_m1.dim_m(); ++k)
|
||||
result += m_m1(i, k) * m_m2(k, j);
|
||||
|
||||
return result;
|
||||
@@ -426,10 +428,10 @@ class matrix_scalar_multiplication : public matrix_expression<matrix_scalar_mult
|
||||
{
|
||||
}
|
||||
|
||||
constexpr uint32_t dim_m() const { return m_m.dim_m(); }
|
||||
constexpr uint32_t dim_n() const { return m_m.dim_n(); }
|
||||
constexpr size_t dim_m() const { return m_m.dim_m(); }
|
||||
constexpr size_t dim_n() const { return m_m.dim_n(); }
|
||||
|
||||
constexpr auto operator()(uint32_t i, uint32_t j) const
|
||||
constexpr auto operator()(size_t i, size_t j) const
|
||||
{
|
||||
return m_m(i, j) * m_v;
|
||||
}
|
||||
@@ -498,10 +500,10 @@ class matrix_cofactors : public matrix_expression<matrix_cofactors<M>>
|
||||
{
|
||||
}
|
||||
|
||||
constexpr uint32_t dim_m() const { return m_m.dim_m(); }
|
||||
constexpr uint32_t dim_n() const { return m_m.dim_n(); }
|
||||
constexpr size_t dim_m() const { return m_m.dim_m(); }
|
||||
constexpr size_t dim_n() const { return m_m.dim_n(); }
|
||||
|
||||
constexpr auto operator()(uint32_t i, uint32_t j) const
|
||||
constexpr auto operator()(size_t i, size_t j) const
|
||||
{
|
||||
const size_t ixs[4][3] = {
|
||||
{ 1, 2, 3 },
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#if defined(__cpp_impl_three_way_comparison)
|
||||
#include <compare>
|
||||
#endif
|
||||
|
||||
/// \file cif++/symmetry.hpp
|
||||
/// This file contains code to do symmetry operations based on the
|
||||
/// operations as specified in the International Tables.
|
||||
@@ -180,7 +184,7 @@ class datablock;
|
||||
class cell;
|
||||
class spacegroup;
|
||||
class rtop;
|
||||
class sym_op;
|
||||
struct sym_op;
|
||||
|
||||
|
||||
/// @brief A class that encapsulates the symmetry operations as used in PDB files, i.e. a rotational number and a translation vector
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define STDOUT_FILENO 1
|
||||
#endif
|
||||
|
||||
#if _MSC_VER
|
||||
#if _WIN32
|
||||
#include <io.h>
|
||||
#define isatty _isatty
|
||||
#else
|
||||
|
||||
@@ -670,9 +670,13 @@ void category::set_validator(const validator *v, datablock &db)
|
||||
|
||||
if (missing.empty())
|
||||
m_index = new category_index(this);
|
||||
else if (VERBOSE > 0)
|
||||
std::cerr << "Cannot construct index since the key field" << (missing.size() > 1 ? "s" : "") << " "
|
||||
<< cif::join(missing, ", ") + " in " + m_name + " " + (missing.size() == 1 ? "is" : "are") << " missing" << std::endl;
|
||||
else
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "Cannot construct index since the key field" << (missing.size() > 1 ? "s" : "") << " "
|
||||
<< cif::join(missing, ", ") << " in " << m_name << " " << (missing.size() == 1 ? "is" : "are") << " missing" << std::endl;
|
||||
throw std::runtime_error(msg.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1708,8 +1712,7 @@ void category::reorder_by_index()
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
size_t write_value(std::ostream &os, std::string_view value, size_t offset, size_t width)
|
||||
size_t write_value(std::ostream &os, std::string_view value, size_t offset, size_t width, bool right_aligned)
|
||||
{
|
||||
if (value.find('\n') != std::string::npos or width == 0 or value.length() > 132) // write as text field
|
||||
{
|
||||
@@ -1733,17 +1736,33 @@ namespace detail
|
||||
}
|
||||
else if (sac_parser::is_unquoted_string(value))
|
||||
{
|
||||
if (right_aligned)
|
||||
{
|
||||
if (value.length() < width)
|
||||
{
|
||||
os << std::string(width - value.length() - 1, ' ');
|
||||
offset += width;
|
||||
}
|
||||
else
|
||||
offset += value.length() + 1;
|
||||
}
|
||||
|
||||
os << value;
|
||||
|
||||
if (value.length() < width)
|
||||
{
|
||||
os << std::string(width - value.length(), ' ');
|
||||
offset += width;
|
||||
}
|
||||
if (right_aligned)
|
||||
os << ' ';
|
||||
else
|
||||
{
|
||||
os << ' ';
|
||||
offset += value.length() + 1;
|
||||
if (value.length() < width)
|
||||
{
|
||||
os << std::string(width - value.length(), ' ');
|
||||
offset += width;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << ' ';
|
||||
offset += value.length() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1837,6 +1856,19 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
|
||||
// If the first Row has a next, we need a loop_
|
||||
bool needLoop = (m_head->m_next != nullptr);
|
||||
|
||||
std::vector<bool> right_aligned(m_columns.size(), false);
|
||||
|
||||
if (m_cat_validator != nullptr)
|
||||
{
|
||||
for (auto cix : order)
|
||||
{
|
||||
auto &col = m_columns[cix];
|
||||
right_aligned[cix] = col.m_validator != nullptr and
|
||||
col.m_validator->m_type != nullptr and
|
||||
col.m_validator->m_type->m_primitive_type == cif::DDL_PrimitiveType::Numb;
|
||||
}
|
||||
}
|
||||
|
||||
if (needLoop)
|
||||
{
|
||||
os << "loop_" << '\n';
|
||||
@@ -1905,7 +1937,7 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
offset = detail::write_value(os, s, offset, w);
|
||||
offset = detail::write_value(os, s, offset, w, right_aligned[cix]);
|
||||
|
||||
if (offset > 132)
|
||||
{
|
||||
@@ -1933,6 +1965,30 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
|
||||
|
||||
l += 3;
|
||||
|
||||
size_t width = 1;
|
||||
|
||||
for (auto cix : order)
|
||||
{
|
||||
if (not right_aligned[cix])
|
||||
continue;
|
||||
|
||||
std::string_view s;
|
||||
auto iv = m_head->get(cix);
|
||||
if (iv != nullptr)
|
||||
s = iv->text();
|
||||
|
||||
if (s.empty())
|
||||
s = "?";
|
||||
|
||||
size_t l2 = s.length();
|
||||
|
||||
if (not sac_parser::is_unquoted_string(s))
|
||||
l2 += 2;
|
||||
|
||||
if (width < l2)
|
||||
width = l2;
|
||||
}
|
||||
|
||||
for (uint16_t cix : order)
|
||||
{
|
||||
auto &col = m_columns[cix];
|
||||
@@ -1957,7 +2013,7 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
if (detail::write_value(os, s, offset, 1) != 0)
|
||||
if (detail::write_value(os, s, offset, width, s.empty() or right_aligned[cix]) != 0)
|
||||
os << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ class compound_factory_impl : public std::enable_shared_from_this<compound_facto
|
||||
{
|
||||
for (auto cmp : impl->m_compounds)
|
||||
{
|
||||
if (cmp->id() == id)
|
||||
if (iequals(cmp->id(), id))
|
||||
{
|
||||
result = cmp;
|
||||
break;
|
||||
@@ -582,12 +582,12 @@ CCP4_compound_factory_impl::CCP4_compound_factory_impl(const fs::path &clibd_mon
|
||||
|
||||
auto &chemComps = m_file["comp_list"]["chem_comp"];
|
||||
|
||||
for (const auto &[group, threeLetterCode] : chemComps.rows<std::string, std::string>("group", "three_letter_code"))
|
||||
for (const auto &[group, comp_id] : chemComps.rows<std::string, std::string>("group", "id"))
|
||||
{
|
||||
if (std::regex_match(group, peptideRx))
|
||||
m_known_peptides.insert(threeLetterCode);
|
||||
m_known_peptides.insert(comp_id);
|
||||
else if (cif::iequals(group, "DNA") or cif::iequals(group, "RNA"))
|
||||
m_known_bases.insert(threeLetterCode);
|
||||
m_known_bases.insert(comp_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ compound *CCP4_compound_factory_impl::create(const std::string &id)
|
||||
|
||||
auto &cat = m_file["comp_list"]["chem_comp"];
|
||||
|
||||
auto rs = cat.find(cif::key("three_letter_code") == id);
|
||||
auto rs = cat.find(cif::key("id") == id);
|
||||
|
||||
if (rs.size() == 1)
|
||||
{
|
||||
|
||||
@@ -1170,6 +1170,8 @@ void PDBFileParser::PreParseInput(std::istream &is)
|
||||
std::string value;
|
||||
if (lookahead.length() > 6)
|
||||
value = cif::trim_right_copy(lookahead.substr(6));
|
||||
|
||||
lookahead.clear();
|
||||
|
||||
uint32_t curLineNr = lineNr;
|
||||
getline(is, lookahead);
|
||||
|
||||
@@ -61,7 +61,7 @@ quaternion_type<T> normalize(quaternion_type<T> q)
|
||||
|
||||
quaternion construct_from_angle_axis(float angle, point axis)
|
||||
{
|
||||
angle = (angle * kPI / 180) / 2;
|
||||
angle = static_cast<float>((angle * kPI / 180) / 2);
|
||||
auto s = std::sin(angle);
|
||||
auto c = std::cos(angle);
|
||||
|
||||
@@ -119,7 +119,7 @@ point center_points(std::vector<point> &Points)
|
||||
}
|
||||
|
||||
quaternion construct_for_dihedral_angle(point p1, point p2, point p3, point p4,
|
||||
float angle, float esd)
|
||||
float angle, float /*esd*/)
|
||||
{
|
||||
p1 -= p3;
|
||||
p2 -= p3;
|
||||
|
||||
@@ -70,12 +70,12 @@ void cell::init()
|
||||
|
||||
m_orthogonal = identity_matrix(3);
|
||||
|
||||
m_orthogonal(0, 0) = m_a;
|
||||
m_orthogonal(0, 1) = m_b * std::cos(gamma);
|
||||
m_orthogonal(0, 2) = m_c * std::cos(beta);
|
||||
m_orthogonal(1, 1) = m_b * std::sin(gamma);
|
||||
m_orthogonal(1, 2) = -m_c * std::sin(beta) * std::cos(alpha_star);
|
||||
m_orthogonal(2, 2) = m_c * std::sin(beta) * std::sin(alpha_star);
|
||||
m_orthogonal(0, 0) = static_cast<float>(m_a);
|
||||
m_orthogonal(0, 1) = static_cast<float>(m_b * std::cos(gamma));
|
||||
m_orthogonal(0, 2) = static_cast<float>(m_c * std::cos(beta));
|
||||
m_orthogonal(1, 1) = static_cast<float>(m_b * std::sin(gamma));
|
||||
m_orthogonal(1, 2) = static_cast<float>(-m_c * std::sin(beta) * std::cos(alpha_star));
|
||||
m_orthogonal(2, 2) = static_cast<float>(m_c * std::sin(beta) * std::sin(alpha_star));
|
||||
|
||||
m_fractional = inverse(m_orthogonal);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ sym_op::sym_op(std::string_view s)
|
||||
int rnri = 256; // default to unexisting number
|
||||
auto r = std::from_chars(b, e, rnri);
|
||||
|
||||
m_nr = rnri;
|
||||
m_nr = static_cast<uint8_t>(rnri);
|
||||
m_ta = r.ptr[1] - '0';
|
||||
m_tb = r.ptr[2] - '0';
|
||||
m_tc = r.ptr[3] - '0';
|
||||
@@ -121,21 +121,21 @@ transformation::transformation(const symop_data &data)
|
||||
{
|
||||
const auto &d = data.data();
|
||||
|
||||
m_rotation(0, 0) = d[0];
|
||||
m_rotation(0, 1) = d[1];
|
||||
m_rotation(0, 2) = d[2];
|
||||
m_rotation(1, 0) = d[3];
|
||||
m_rotation(1, 1) = d[4];
|
||||
m_rotation(1, 2) = d[5];
|
||||
m_rotation(2, 0) = d[6];
|
||||
m_rotation(2, 1) = d[7];
|
||||
m_rotation(2, 2) = d[8];
|
||||
m_rotation(0, 0) = static_cast<float>(d[0]);
|
||||
m_rotation(0, 1) = static_cast<float>(d[1]);
|
||||
m_rotation(0, 2) = static_cast<float>(d[2]);
|
||||
m_rotation(1, 0) = static_cast<float>(d[3]);
|
||||
m_rotation(1, 1) = static_cast<float>(d[4]);
|
||||
m_rotation(1, 2) = static_cast<float>(d[5]);
|
||||
m_rotation(2, 0) = static_cast<float>(d[6]);
|
||||
m_rotation(2, 1) = static_cast<float>(d[7]);
|
||||
m_rotation(2, 2) = static_cast<float>(d[8]);
|
||||
|
||||
try_create_quaternion();
|
||||
|
||||
m_translation.m_x = d[9] == 0 ? 0 : 1.0 * d[9] / d[10];
|
||||
m_translation.m_y = d[11] == 0 ? 0 : 1.0 * d[11] / d[12];
|
||||
m_translation.m_z = d[13] == 0 ? 0 : 1.0 * d[13] / d[14];
|
||||
m_translation.m_x = static_cast<float>(d[9] == 0 ? 0 : 1.0 * d[9] / d[10]);
|
||||
m_translation.m_y = static_cast<float>(d[11] == 0 ? 0 : 1.0 * d[11] / d[12]);
|
||||
m_translation.m_z = static_cast<float>(d[13] == 0 ? 0 : 1.0 * d[13] / d[14]);
|
||||
}
|
||||
|
||||
transformation::transformation(const matrix3x3<float> &r, const cif::point &t)
|
||||
@@ -461,7 +461,7 @@ std::tuple<float,point,sym_op> crystal::closest_symmetry_copy(point a, point b)
|
||||
|
||||
for (size_t i = 0; i < m_spacegroup.size(); ++i)
|
||||
{
|
||||
sym_op s(i + 1);
|
||||
sym_op s(static_cast<uint8_t>(i + 1));
|
||||
auto &t = m_spacegroup[i];
|
||||
|
||||
auto fsb = t(fb);
|
||||
|
||||
@@ -239,7 +239,7 @@ std::string cif_id_for_number(int number)
|
||||
do
|
||||
{
|
||||
int r = number % 26;
|
||||
result += 'A' + r;
|
||||
result += static_cast<char>('A' + r);
|
||||
|
||||
number = (number - r) / 26 - 1;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
#if not defined(_MSC_VER)
|
||||
#if not defined(_WIN32)
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#endif
|
||||
@@ -68,7 +68,7 @@ std::string get_version_nr()
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
}
|
||||
#include <Windows.h>
|
||||
#include <libloaderapi.h>
|
||||
@@ -204,7 +204,7 @@ void progress_bar_impl::run()
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
if (not printedAny and isatty(STDOUT_FILENO))
|
||||
std::cout << "\e[?25l";
|
||||
std::cout << "\x1b[?25l";
|
||||
|
||||
print_progress();
|
||||
|
||||
@@ -220,7 +220,7 @@ void progress_bar_impl::run()
|
||||
{
|
||||
print_done();
|
||||
if (isatty(STDOUT_FILENO))
|
||||
std::cout << "\e[?25h";
|
||||
std::cout << "\x1b[?25h";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,11 +411,19 @@ struct rsrc_imp
|
||||
};
|
||||
} // namespace mrsrc
|
||||
|
||||
#if _MSC_VER
|
||||
#if _WIN32
|
||||
|
||||
extern "C" CIFPP_EXPORT const mrsrc::rsrc_imp *gResourceIndexDefault[1] = {};
|
||||
extern "C" CIFPP_EXPORT const char *gResourceDataDefault[1] = {};
|
||||
extern "C" CIFPP_EXPORT const char *gResourceNameDefault[1] = {};
|
||||
#if __MINGW32__
|
||||
|
||||
extern "C" __attribute__((weak, alias("gResourceIndexDefault"))) const mrsrc::rsrc_imp gResourceIndex[];
|
||||
extern "C" __attribute__((weak, alias("gResourceDataDefault"))) const char gResourceData[];
|
||||
extern "C" __attribute__((weak, alias("gResourceNameDefault"))) const char gResourceName[];
|
||||
|
||||
#else
|
||||
|
||||
extern "C" const mrsrc::rsrc_imp *gResourceIndexDefault[1] = {};
|
||||
extern "C" const char *gResourceDataDefault[1] = {};
|
||||
extern "C" const char *gResourceNameDefault[1] = {};
|
||||
|
||||
extern "C" const mrsrc::rsrc_imp gResourceIndex[];
|
||||
extern "C" const char gResourceData[];
|
||||
@@ -425,6 +433,8 @@ extern "C" const char gResourceName[];
|
||||
#pragma comment(linker, "/alternatename:gResourceData=gResourceDataDefault")
|
||||
#pragma comment(linker, "/alternatename:gResourceName=gResourceNameDefault")
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
extern const __attribute__((weak)) mrsrc::rsrc_imp gResourceIndex[];
|
||||
extern const __attribute__((weak)) char gResourceData[];
|
||||
|
||||
187
test/REA_v2.cif
Normal file
187
test/REA_v2.cif
Normal file
@@ -0,0 +1,187 @@
|
||||
data_REA_v2
|
||||
#
|
||||
_chem_comp.id REA_v2
|
||||
_chem_comp.name "RETINOIC ACID"
|
||||
_chem_comp.type NON-POLYMER
|
||||
_chem_comp.pdbx_type HETAIN
|
||||
_chem_comp.formula "C20 H28 O2"
|
||||
_chem_comp.mon_nstd_parent_comp_id ?
|
||||
_chem_comp.pdbx_synonyms ?
|
||||
_chem_comp.pdbx_formal_charge 0
|
||||
_chem_comp.pdbx_initial_date 1999-07-08
|
||||
_chem_comp.pdbx_modified_date 2016-10-18
|
||||
_chem_comp.pdbx_ambiguous_flag N
|
||||
_chem_comp.pdbx_release_status REL
|
||||
_chem_comp.pdbx_replaced_by ?
|
||||
_chem_comp.pdbx_replaces 3KV
|
||||
_chem_comp.formula_weight 300.435
|
||||
_chem_comp.one_letter_code ?
|
||||
_chem_comp.pdbx_model_coordinates_details ?
|
||||
_chem_comp.pdbx_model_coordinates_missing_flag N
|
||||
_chem_comp.pdbx_ideal_coordinates_details Corina
|
||||
_chem_comp.pdbx_ideal_coordinates_missing_flag N
|
||||
_chem_comp.pdbx_model_coordinates_db_code 1CBS
|
||||
_chem_comp.pdbx_subcomponent_list ?
|
||||
_chem_comp.pdbx_processing_site RCSB
|
||||
#
|
||||
loop_
|
||||
_chem_comp_atom.comp_id
|
||||
_chem_comp_atom.atom_id
|
||||
_chem_comp_atom.alt_atom_id
|
||||
_chem_comp_atom.type_symbol
|
||||
_chem_comp_atom.charge
|
||||
_chem_comp_atom.pdbx_align
|
||||
_chem_comp_atom.pdbx_aromatic_flag
|
||||
_chem_comp_atom.pdbx_leaving_atom_flag
|
||||
_chem_comp_atom.pdbx_stereo_config
|
||||
_chem_comp_atom.model_Cartn_x
|
||||
_chem_comp_atom.model_Cartn_y
|
||||
_chem_comp_atom.model_Cartn_z
|
||||
_chem_comp_atom.pdbx_model_Cartn_x_ideal
|
||||
_chem_comp_atom.pdbx_model_Cartn_y_ideal
|
||||
_chem_comp_atom.pdbx_model_Cartn_z_ideal
|
||||
_chem_comp_atom.pdbx_component_atom_id
|
||||
_chem_comp_atom.pdbx_component_comp_id
|
||||
_chem_comp_atom.pdbx_ordinal
|
||||
REA_v2 C1 C1 C 0 1 N N N 21.972 29.831 16.739 -4.684 0.932 -0.497 C1 REA_v2 1
|
||||
REA_v2 C2 C2 C 0 1 N N N 20.921 30.524 15.841 -5.837 0.190 -1.176 C2 REA_v2 2
|
||||
REA_v2 C3 C3 C 0 1 N N N 20.245 29.635 14.848 -6.441 -0.798 -0.171 C3 REA_v2 3
|
||||
REA_v2 C4 C4 C 0 1 N N N 19.555 28.479 15.488 -5.418 -1.903 0.100 C4 REA_v2 4
|
||||
REA_v2 C5 C5 C 0 1 N N N 20.389 27.812 16.587 -4.082 -1.301 0.429 C5 REA_v2 5
|
||||
REA_v2 C6 C6 C 0 1 N N N 21.425 28.446 17.218 -3.756 -0.048 0.161 C6 REA_v2 6
|
||||
REA_v2 C7 C7 C 0 1 N N N 22.242 27.851 18.297 -2.457 0.396 0.516 C7 REA_v2 7
|
||||
REA_v2 C8 C8 C 0 1 N N N 21.868 26.977 19.240 -1.363 -0.229 0.007 C8 REA_v2 8
|
||||
REA_v2 C9 C9 C 0 1 N N N 22.705 26.434 20.286 -0.076 0.257 0.298 C9 REA_v2 9
|
||||
REA_v2 C10 C10 C 0 1 N N N 22.159 25.536 21.131 1.022 -0.370 -0.213 C10 REA_v2 10
|
||||
REA_v2 C11 C11 C 0 1 N N N 22.875 24.924 22.234 2.306 0.115 0.077 C11 REA_v2 11
|
||||
REA_v2 C12 C12 C 0 1 N N N 22.237 24.026 22.990 3.405 -0.513 -0.435 C12 REA_v2 12
|
||||
REA_v2 C13 C13 C 0 1 N N N 22.856 23.377 24.125 4.689 -0.028 -0.144 C13 REA_v2 13
|
||||
REA_v2 C14 C14 C 0 1 N N N 22.135 22.473 24.834 5.787 -0.655 -0.656 C14 REA_v2 14
|
||||
REA_v2 C15 C15 C 0 1 N N N 22.563 21.710 26.016 7.077 -0.265 -0.244 C15 REA_v2 15
|
||||
REA_v2 C16 C16 C 0 1 N N N 22.238 30.737 17.948 -5.246 1.886 0.559 C16 REA_v2 16
|
||||
REA_v2 C17 C17 C 0 1 N N N 23.292 29.620 15.948 -3.911 1.737 -1.544 C17 REA_v2 17
|
||||
REA_v2 C18 C18 C 0 1 N N N 19.791 26.449 16.947 -3.056 -2.175 1.103 C18 REA_v2 18
|
||||
REA_v2 C19 C19 C 0 1 N N N 24.181 26.841 20.385 0.090 1.471 1.175 C19 REA_v2 19
|
||||
REA_v2 C20 C20 C 0 1 N N N 24.303 23.747 24.489 4.855 1.186 0.733 C20 REA_v2 20
|
||||
REA_v2 O1 O1 O 0 1 N N N 23.640 21.075 25.978 7.210 0.553 0.648 O1 REA_v2 21
|
||||
REA_v2 O2 O2 O 0 1 N N N 21.840 21.712 27.037 8.166 -0.798 -0.840 O2 REA_v2 22
|
||||
REA_v2 H21 H21 H 0 1 N N N 20.147 30.955 16.494 -6.598 0.905 -1.490 H21 REA_v2 23
|
||||
REA_v2 H22 H22 H 0 1 N N N 21.425 31.330 15.288 -5.462 -0.353 -2.044 H22 REA_v2 24
|
||||
REA_v2 H31 H31 H 0 1 N N N 19.501 30.227 14.295 -6.673 -0.278 0.759 H31 REA_v2 25
|
||||
REA_v2 H32 H32 H 0 1 N N N 21.001 29.250 14.148 -7.349 -1.234 -0.586 H32 REA_v2 26
|
||||
REA_v2 H41 H41 H 0 1 N N N 18.613 28.835 15.931 -5.756 -2.511 0.938 H41 REA_v2 27
|
||||
REA_v2 H42 H42 H 0 1 N N N 19.335 27.730 14.713 -5.322 -2.531 -0.786 H42 REA_v2 28
|
||||
REA_v2 H7 H7 H 0 1 N N N 23.276 28.162 18.329 -2.337 1.230 1.191 H7 REA_v2 29
|
||||
REA_v2 H8 H8 H 0 1 N N N 20.840 26.645 19.217 -1.482 -1.100 -0.622 H8 REA_v2 30
|
||||
REA_v2 H10 H10 H 0 1 N N N 21.127 25.256 20.977 0.903 -1.241 -0.842 H10 REA_v2 31
|
||||
REA_v2 H11 H11 H 0 1 N N N 23.902 25.189 22.440 2.425 0.985 0.706 H11 REA_v2 32
|
||||
REA_v2 H12 H12 H 0 1 N N N 21.216 23.774 22.743 3.286 -1.383 -1.063 H12 REA_v2 33
|
||||
REA_v2 H14 H14 H 0 1 N N N 21.127 22.292 24.490 5.667 -1.451 -1.376 H14 REA_v2 34
|
||||
REA_v2 H161 H161 H 0 0 N N N 22.984 30.265 18.604 -5.802 1.316 1.303 H161 REA_v2 35
|
||||
REA_v2 H162 H162 H 0 0 N N N 22.618 31.709 17.601 -4.426 2.415 1.044 H162 REA_v2 36
|
||||
REA_v2 H163 H163 H 0 0 N N N 21.302 30.887 18.506 -5.911 2.605 0.081 H163 REA_v2 37
|
||||
REA_v2 H171 H171 H 0 0 N N N 24.033 29.127 16.595 -4.598 2.394 -2.077 H171 REA_v2 38
|
||||
REA_v2 H172 H172 H 0 0 N N N 23.095 28.989 15.069 -3.146 2.335 -1.050 H172 REA_v2 39
|
||||
REA_v2 H173 H173 H 0 0 N N N 23.683 30.595 15.620 -3.439 1.054 -2.251 H173 REA_v2 40
|
||||
REA_v2 H181 H181 H 0 0 N N N 20.397 25.979 17.736 -3.448 -3.187 1.201 H181 REA_v2 41
|
||||
REA_v2 H182 H182 H 0 0 N N N 18.761 26.584 17.308 -2.145 -2.194 0.503 H182 REA_v2 42
|
||||
REA_v2 H183 H183 H 0 0 N N N 19.786 25.804 16.056 -2.831 -1.775 2.092 H183 REA_v2 43
|
||||
REA_v2 H191 H191 H 0 0 N N N 24.647 26.327 21.238 0.171 1.159 2.216 H191 REA_v2 44
|
||||
REA_v2 H192 H192 H 0 0 N N N 24.702 26.559 19.458 0.993 2.008 0.885 H192 REA_v2 45
|
||||
REA_v2 H193 H193 H 0 0 N N N 24.252 27.929 20.529 -0.774 2.125 1.058 H193 REA_v2 46
|
||||
REA_v2 H201 H201 H 0 0 N N N 24.620 23.168 25.369 5.026 0.871 1.762 H201 REA_v2 47
|
||||
REA_v2 H202 H202 H 0 0 N N N 24.965 23.516 23.641 5.707 1.771 0.386 H202 REA_v2 48
|
||||
REA_v2 H203 H203 H 0 0 N N N 24.360 24.822 24.717 3.952 1.795 0.685 H203 REA_v2 49
|
||||
REA_v2 HO2 HO2 H 0 1 N N N 22.244 21.180 27.713 9.006 -0.469 -0.490 HO2 REA_v2 50
|
||||
#
|
||||
loop_
|
||||
_chem_comp_bond.comp_id
|
||||
_chem_comp_bond.atom_id_1
|
||||
_chem_comp_bond.atom_id_2
|
||||
_chem_comp_bond.value_order
|
||||
_chem_comp_bond.pdbx_aromatic_flag
|
||||
_chem_comp_bond.pdbx_stereo_config
|
||||
_chem_comp_bond.pdbx_ordinal
|
||||
REA_v2 C1 C2 SING N N 1
|
||||
REA_v2 C1 C6 SING N N 2
|
||||
REA_v2 C1 C16 SING N N 3
|
||||
REA_v2 C1 C17 SING N N 4
|
||||
REA_v2 C2 C3 SING N N 5
|
||||
REA_v2 C2 H21 SING N N 6
|
||||
REA_v2 C2 H22 SING N N 7
|
||||
REA_v2 C3 C4 SING N N 8
|
||||
REA_v2 C3 H31 SING N N 9
|
||||
REA_v2 C3 H32 SING N N 10
|
||||
REA_v2 C4 C5 SING N N 11
|
||||
REA_v2 C4 H41 SING N N 12
|
||||
REA_v2 C4 H42 SING N N 13
|
||||
REA_v2 C5 C6 DOUB N N 14
|
||||
REA_v2 C5 C18 SING N N 15
|
||||
REA_v2 C6 C7 SING N N 16
|
||||
REA_v2 C7 C8 DOUB N E 17
|
||||
REA_v2 C7 H7 SING N N 18
|
||||
REA_v2 C8 C9 SING N N 19
|
||||
REA_v2 C8 H8 SING N N 20
|
||||
REA_v2 C9 C10 DOUB N E 21
|
||||
REA_v2 C9 C19 SING N N 22
|
||||
REA_v2 C10 C11 SING N N 23
|
||||
REA_v2 C10 H10 SING N N 24
|
||||
REA_v2 C11 C12 DOUB N E 25
|
||||
REA_v2 C11 H11 SING N N 26
|
||||
REA_v2 C12 C13 SING N N 27
|
||||
REA_v2 C12 H12 SING N N 28
|
||||
REA_v2 C13 C14 DOUB N E 29
|
||||
REA_v2 C13 C20 SING N N 30
|
||||
REA_v2 C14 C15 SING N N 31
|
||||
REA_v2 C14 H14 SING N N 32
|
||||
REA_v2 C15 O1 DOUB N N 33
|
||||
REA_v2 C15 O2 SING N N 34
|
||||
REA_v2 C16 H161 SING N N 35
|
||||
REA_v2 C16 H162 SING N N 36
|
||||
REA_v2 C16 H163 SING N N 37
|
||||
REA_v2 C17 H171 SING N N 38
|
||||
REA_v2 C17 H172 SING N N 39
|
||||
REA_v2 C17 H173 SING N N 40
|
||||
REA_v2 C18 H181 SING N N 41
|
||||
REA_v2 C18 H182 SING N N 42
|
||||
REA_v2 C18 H183 SING N N 43
|
||||
REA_v2 C19 H191 SING N N 44
|
||||
REA_v2 C19 H192 SING N N 45
|
||||
REA_v2 C19 H193 SING N N 46
|
||||
REA_v2 C20 H201 SING N N 47
|
||||
REA_v2 C20 H202 SING N N 48
|
||||
REA_v2 C20 H203 SING N N 49
|
||||
REA_v2 O2 HO2 SING N N 50
|
||||
#
|
||||
loop_
|
||||
_pdbx_chem_comp_descriptor.comp_id
|
||||
_pdbx_chem_comp_descriptor.type
|
||||
_pdbx_chem_comp_descriptor.program
|
||||
_pdbx_chem_comp_descriptor.program_version
|
||||
_pdbx_chem_comp_descriptor.descriptor
|
||||
REA_v2 SMILES ACDLabs 12.01 "C1(CCCC(=C1\C=C\C(=C\C=C\C(=C\C(=O)O)C)C)C)(C)C"
|
||||
REA_v2 InChI InChI 1.03 "InChI=1S/C20H28O2/c1-15(8-6-9-16(2)14-19(21)22)11-12-18-17(3)10-7-13-20(18,4)5/h6,8-9,11-12,14H,7,10,13H2,1-5H3,(H,21,22)/b9-6+,12-11+,15-8+,16-14+"
|
||||
REA_v2 InChIKey InChI 1.03 SHGAZHPCJJPHSC-YCNIQYBTSA-N
|
||||
REA_v2 SMILES_CANONICAL CACTVS 3.385 "CC1=C(\C=C\C(C)=C\C=C\C(C)=C\C(O)=O)C(C)(C)CCC1"
|
||||
REA_v2 SMILES CACTVS 3.385 "CC1=C(C=CC(C)=CC=CC(C)=CC(O)=O)C(C)(C)CCC1"
|
||||
REA_v2 SMILES_CANONICAL "OpenEye OEToolkits" 1.7.6 "CC1=C(C(CCC1)(C)C)/C=C/C(=C/C=C/C(=C/C(=O)O)/C)/C"
|
||||
REA_v2 SMILES "OpenEye OEToolkits" 1.7.6 "CC1=C(C(CCC1)(C)C)C=CC(=CC=CC(=CC(=O)O)C)C"
|
||||
#
|
||||
loop_
|
||||
_pdbx_chem_comp_identifier.comp_id
|
||||
_pdbx_chem_comp_identifier.type
|
||||
_pdbx_chem_comp_identifier.program
|
||||
_pdbx_chem_comp_identifier.program_version
|
||||
_pdbx_chem_comp_identifier.identifier
|
||||
REA_v2 "SYSTEMATIC NAME" ACDLabs 12.01 "retinoic acid"
|
||||
REA_v2 "SYSTEMATIC NAME" "OpenEye OEToolkits" 1.7.6 "(2E,4E,6E,8E)-3,7-dimethyl-9-(2,6,6-trimethylcyclohexen-1-yl)nona-2,4,6,8-tetraenoic acid"
|
||||
#
|
||||
loop_
|
||||
_pdbx_chem_comp_audit.comp_id
|
||||
_pdbx_chem_comp_audit.action_type
|
||||
_pdbx_chem_comp_audit.date
|
||||
_pdbx_chem_comp_audit.processing_site
|
||||
REA_v2 "CREA_v2te component" 1999-07-08 RCSB
|
||||
REA_v2 "Modify descriptor" 2011-06-04 RCSB
|
||||
REA_v2 "Other modification" 2016-10-18 RCSB
|
||||
#
|
||||
@@ -3150,4 +3150,60 @@ _test.value
|
||||
|
||||
v = test.find1<std::optional<float>>("id"_key == 4, "value");
|
||||
BOOST_CHECK(v.has_value() == false);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
BOOST_AUTO_TEST_CASE(compound_test_1)
|
||||
{
|
||||
cif::compound_factory::instance().push_dictionary(gTestDir / "REA_v2.cif");
|
||||
auto compound = cif::compound_factory::instance().create("REA_v2");
|
||||
BOOST_ASSERT(compound != nullptr);
|
||||
BOOST_CHECK(compound->id() == "REA_v2");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
BOOST_AUTO_TEST_CASE(pdb_parser_test_1)
|
||||
{
|
||||
char k1CBS[] = R"(HEADER RETINOIC-ACID TRANSPORT 28-SEP-94 1CBS
|
||||
TITLE CRYSTAL STRUCTURE OF CELLULAR RETINOIC-ACID-BINDING
|
||||
TITLE 2 PROTEINS I AND II IN COMPLEX WITH ALL-TRANS-RETINOIC ACID
|
||||
TITLE 3 AND A SYNTHETIC RETINOID
|
||||
COMPND MOL_ID: 1;
|
||||
COMPND 2 MOLECULE: CELLULAR RETINOIC ACID BINDING PROTEIN TYPE II;
|
||||
COMPND 3 CHAIN: A;
|
||||
COMPND 4 ENGINEERED: YES
|
||||
SOURCE MOL_ID: 1;
|
||||
SOURCE 2 ORGANISM_SCIENTIFIC: HOMO SAPIENS;
|
||||
SOURCE 3 ORGANISM_COMMON: HUMAN;
|
||||
SOURCE 4 ORGANISM_TAXID: 9606;
|
||||
SOURCE 5 CELL_LINE: BL21;
|
||||
SOURCE 6 GENE: HUMAN CRABP-II;
|
||||
SOURCE 7 EXPRESSION_SYSTEM: ESCHERICHIA COLI BL21(DE3);
|
||||
SOURCE 8 EXPRESSION_SYSTEM_TAXID: 469008;
|
||||
SOURCE 9 EXPRESSION_SYSTEM_STRAIN: BL21 (DE3);
|
||||
SOURCE 10 EXPRESSION_SYSTEM_PLASMID: PET-3A
|
||||
KEYWDS RETINOIC-ACID TRANSPORT
|
||||
EXPDTA X-RAY DIFFRACTION
|
||||
AUTHOR G.J.KLEYWEGT,T.BERGFORS,T.A.JONES
|
||||
ATOM 1 N PRO A 1 16.979 13.301 44.555 1.00 30.05 N
|
||||
ATOM 2 CA PRO A 1 18.150 13.525 43.680 1.00 28.82 C
|
||||
ATOM 3 C PRO A 1 18.656 14.966 43.784 1.00 26.59 C
|
||||
ATOM 4 O PRO A 1 17.890 15.889 44.078 1.00 26.84 O
|
||||
ATOM 5 CB PRO A 1 17.678 13.270 42.255 1.00 29.24 C
|
||||
ATOM 6 CG PRO A 1 16.248 13.734 42.347 1.00 29.29 C
|
||||
ATOM 7 CD PRO A 1 15.762 13.216 43.724 1.00 30.71 C)";
|
||||
|
||||
struct membuf : public std::streambuf
|
||||
{
|
||||
membuf(char *text, size_t length)
|
||||
{
|
||||
this->setg(text, text, text + length);
|
||||
}
|
||||
} buffer(k1CBS, sizeof(k1CBS) - 1);
|
||||
|
||||
std::istream is(&buffer);
|
||||
|
||||
auto f = cif::pdb::read(is);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user