Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
7a1d3dbd
Unverified
Commit
7a1d3dbd
authored
Feb 03, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:PDB-REDO/libcifpp into develop
parents
4bf10df0
d84faad1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
151 additions
and
99 deletions
+151
-99
CMakeLists.txt
+8
-1
changelog
+13
-0
cmake/cifppConfig.cmake.in
+4
-0
include/cif++/category.hpp
+0
-0
include/cif++/condition.hpp
+32
-0
include/cif++/text.hpp
+2
-60
src/atom_type.cpp
+3
-0
src/model.cpp
+3
-3
src/pdb/cif2pdb.cpp
+46
-30
src/pdb/pdb2cif.cpp
+2
-2
test/unit-v2-test.cpp
+37
-2
tools/update-libcifpp-data.in
+1
-1
No files found.
CMakeLists.txt
View file @
7a1d3dbd
...
...
@@ -25,7 +25,7 @@
cmake_minimum_required
(
VERSION 3.16
)
# set the project name
project
(
cifpp VERSION 5.0.
6
LANGUAGES CXX
)
project
(
cifpp VERSION 5.0.
8
LANGUAGES CXX
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
...
...
@@ -89,6 +89,7 @@ if(BUILD_FOR_CCP4)
list
(
APPEND CMAKE_MODULE_PATH
"$ENV{CCP4}"
)
list
(
APPEND CMAKE_PREFIX_PATH
"$ENV{CCP4}"
)
set
(
CMAKE_INSTALL_PREFIX
"$ENV{CCP4}"
)
set
(
CMAKE_INSTALL_FULL_DATADIR
"
${
CMAKE_INSTALL_PREFIX
}
/share/libcifpp"
)
if
(
WIN32
)
set
(
BUILD_SHARED_LIBS ON
)
...
...
@@ -173,6 +174,12 @@ list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY})
include
(
FindAtomic
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES
${
STDCPPATOMIC_LIBRARY
}
)
if
(
MSVC
)
# this dependency can go once MSVC supports std::experimental::is_detected
find_package
(
zeep 5.1.8 REQUIRED
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES zeep::zeep
)
endif
()
# Create a revision file, containing the current git version info
include
(
VersionString
)
write_version_header
(
${
PROJECT_SOURCE_DIR
}
/src/
"LibCIFPP"
)
...
...
changelog
View file @
7a1d3dbd
Version
5.0.8
-
implemented
find_first
,
find_min
,
find_max
and
count
in
category
-
find1
now
throws
an
exception
if
condition
does
not
not
exactly
match
one
row
-
Change
in
writing
out
PDB
files
,
now
looking
up
the
original
auth_seq_num
via
the
pdbx_xxx_scheme
categories
based
on
the
atom_site
.
auth_seq_num
->
pdbx_xxx_scheme
.
pdb_seq_num
relationship
.
Version
5.0.7.1
-
Use
the
implementation
from
zeep
for
std
::
experimental
::
is_detected
Version
5.0.7
-
Reintroduce
exports
file
.
For
DLL
's
Version 5.0.6
- Fix file::contains, using iequals
- Fix is_cis
...
...
cmake/cifppConfig.cmake.in
View file @
7a1d3dbd
...
...
@@ -5,6 +5,10 @@ find_dependency(Threads)
find_dependency(ZLIB REQUIRED)
if(MSVC)
find_dependency(zeep REQUIRED)
endif()
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
set_and_check(CIFPP_SHARE_DIR "@PACKAGE_CIFPP_DATA_DIR@")
...
...
include/cif++/category.hpp
View file @
7a1d3dbd
This diff is collapsed.
Click to expand it.
include/cif++/condition.hpp
View file @
7a1d3dbd
...
...
@@ -182,6 +182,33 @@ namespace detail
uint16_t
m_item_ix
=
0
;
};
struct
key_is_not_empty_condition_impl
:
public
condition_impl
{
key_is_not_empty_condition_impl
(
const
std
::
string
&
item_tag
)
:
m_item_tag
(
item_tag
)
{
}
condition_impl
*
prepare
(
const
category
&
c
)
override
{
m_item_ix
=
get_column_ix
(
c
,
m_item_tag
);
return
this
;
}
bool
test
(
row_handle
r
)
const
override
{
return
not
r
[
m_item_ix
].
empty
();
}
void
str
(
std
::
ostream
&
os
)
const
override
{
os
<<
m_item_tag
<<
" IS NOT NULL"
;
}
std
::
string
m_item_tag
;
uint16_t
m_item_ix
=
0
;
};
struct
key_equals_condition_impl
:
public
condition_impl
{
key_equals_condition_impl
(
item
&&
i
)
...
...
@@ -824,6 +851,11 @@ inline condition operator==(const key &key, const empty_type &)
return
condition
(
new
detail
::
key_is_empty_condition_impl
(
key
.
m_item_tag
));
}
inline
condition
operator
!=
(
const
key
&
key
,
const
empty_type
&
)
{
return
condition
(
new
detail
::
key_is_not_empty_condition_impl
(
key
.
m_item_tag
));
}
inline
condition
operator
not
(
condition
&&
rhs
)
{
return
condition
(
new
detail
::
not_condition_impl
(
std
::
move
(
rhs
)));
...
...
include/cif++/text.hpp
View file @
7a1d3dbd
...
...
@@ -39,66 +39,8 @@
#if __has_include(<experimental/type_traits>)
#include <experimental/type_traits>
#else
#include <type_traits>
#endif
#if (not defined(__cpp_lib_experimental_detect) or (__cpp_lib_experimental_detect < 201505)) and (not defined(_LIBCPP_VERSION) or _LIBCPP_VERSION < 5000)
// This code is copied from:
// https://ld2015.scusa.lsu.edu/cppreference/en/cpp/experimental/is_detected.html
namespace
std
{
template
<
class
...
>
using
void_t
=
void
;
namespace
experimental
{
namespace
detail
{
template
<
class
Default
,
class
AlwaysVoid
,
template
<
class
...
>
class
Op
,
class
...
Args
>
struct
detector
{
using
value_t
=
false_type
;
using
type
=
Default
;
};
template
<
class
Default
,
template
<
class
...
>
class
Op
,
class
...
Args
>
struct
detector
<
Default
,
void_t
<
Op
<
Args
...
>>
,
Op
,
Args
...
>
{
// Note that std::void_t is a c++17 feature
using
value_t
=
true_type
;
using
type
=
Op
<
Args
...
>
;
};
}
// namespace detail
struct
nonesuch
{
nonesuch
()
=
delete
;
~
nonesuch
()
=
delete
;
nonesuch
(
nonesuch
const
&
)
=
delete
;
void
operator
=
(
nonesuch
const
&
)
=
delete
;
};
template
<
template
<
class
...
>
class
Op
,
class
...
Args
>
using
is_detected
=
typename
detail
::
detector
<
nonesuch
,
void
,
Op
,
Args
...
>::
value_t
;
template
<
template
<
class
...
>
class
Op
,
class
...
Args
>
constexpr
inline
bool
is_detected_v
=
is_detected
<
Op
,
Args
...
>::
value
;
template
<
template
<
class
...
>
class
Op
,
class
...
Args
>
using
detected_t
=
typename
detail
::
detector
<
nonesuch
,
void
,
Op
,
Args
...
>::
type
;
template
<
class
Default
,
template
<
class
...
>
class
Op
,
class
...
Args
>
using
detected_or
=
detail
::
detector
<
Default
,
void
,
Op
,
Args
...
>
;
template
<
class
Expected
,
template
<
class
...
>
class
Op
,
class
...
Args
>
using
is_detected_exact
=
std
::
is_same
<
Expected
,
detected_t
<
Op
,
Args
...
>>
;
template
<
class
Expected
,
template
<
class
...
>
class
Op
,
class
...
Args
>
constexpr
inline
bool
is_detected_exact_v
=
is_detected_exact
<
Expected
,
Op
,
Args
...
>::
value
;
}
}
// sub optimal, but replicating the same code is worse
#include <zeep/type-traits.hpp>
#endif
namespace
cif
...
...
src/atom_type.cpp
View file @
7a1d3dbd
...
...
@@ -1029,6 +1029,9 @@ atom_type_traits::atom_type_traits(const std::string& symbol)
}
}
if
(
symbol
==
"X"
)
m_info
=
&
data
::
kKnownAtoms
[
0
];
if
(
m_info
==
nullptr
)
throw
std
::
invalid_argument
(
"Not a known element: "
+
symbol
);
}
...
...
src/model.cpp
View file @
7a1d3dbd
...
...
@@ -1780,7 +1780,7 @@ std::string structure::insert_compound(const std::string &compoundID, bool is_en
{
auto
&
pdbxEntityNonpoly
=
m_db
[
"pdbx_entity_nonpoly"
];
entity_id
=
pdbxEntityNonpoly
.
find
1
<
std
::
string
>
(
"comp_id"
_key
==
compoundID
,
"entity_id"
);
entity_id
=
pdbxEntityNonpoly
.
find
_first
<
std
::
string
>
(
"comp_id"
_key
==
compoundID
,
"entity_id"
);
if
(
entity_id
.
empty
())
{
...
...
@@ -1954,7 +1954,7 @@ void structure::change_residue(residue &res, const std::string &newCompound,
// create a copy of the entity first
auto
&
entity
=
m_db
[
"entity"
];
entityID
=
entity
.
find
1
<
std
::
string
>
(
"type"
_key
==
"non-polymer"
and
"pdbx_description"
_key
==
compound
->
name
(),
"id"
);
entityID
=
entity
.
find
_first
<
std
::
string
>
(
"type"
_key
==
"non-polymer"
and
"pdbx_description"
_key
==
compound
->
name
(),
"id"
);
if
(
entityID
.
empty
())
{
...
...
@@ -2573,7 +2573,7 @@ std::string structure::create_entity_for_branch(branch &branch)
auto
&
entity
=
m_db
[
"entity"
];
std
::
string
entityID
=
entity
.
find
1
<
std
::
string
>
(
"type"
_key
==
"branched"
and
"pdbx_description"
_key
==
entityName
,
"id"
);
std
::
string
entityID
=
entity
.
find
_first
<
std
::
string
>
(
"type"
_key
==
"branched"
and
"pdbx_description"
_key
==
entityName
,
"id"
);
if
(
entityID
.
empty
())
{
...
...
src/pdb/cif2pdb.cpp
View file @
7a1d3dbd
This diff is collapsed.
Click to expand it.
src/pdb/pdb2cif.cpp
View file @
7a1d3dbd
...
...
@@ -4343,9 +4343,9 @@ void PDBFileParser::ConstructEntities()
{
"mon_id"
,
hetID
},
{
"ndb_seq_num"
,
seqNr
},
{
"pdb_seq_num"
,
het
.
seqNum
},
// { "auth_seq_num", het.seqNum }, // ????
{
"auth_seq_num"
,
het
.
seqNum
},
// Yes
{
"pdb_mon_id"
,
hetID
},
//
{ "auth_mon_id", hetID },
{
"auth_mon_id"
,
hetID
},
{
"pdb_strand_id"
,
std
::
string
{
het
.
chainID
}
},
{
"pdb_ins_code"
,
iCode
}
});
...
...
test/unit-v2-test.cpp
View file @
7a1d3dbd
...
...
@@ -1774,8 +1774,6 @@ _test.name
BOOST_AUTO_TEST_CASE
(
c3
)
{
cif
::
VERBOSE
=
1
;
auto
f
=
R"(data_TEST
#
loop_
...
...
@@ -1811,6 +1809,43 @@ _test.name
BOOST_CHECK_EQUAL
(
name
,
"aap"
);
}
BOOST_AUTO_TEST_CASE
(
c4
)
{
auto
f
=
R"(data_TEST
#
loop_
_test.id
_test.name
1 aap
2 noot
3 mies
4 .
5 ?
)"
_cf
;
auto
&
db
=
f
.
front
();
// query tests
BOOST_TEST
(
db
[
"test"
].
find_max
<
int
>
(
"id"
)
==
5
);
BOOST_TEST
(
db
[
"test"
].
find_max
<
int
>
(
"id"
,
cif
::
key
(
"name"
)
!=
cif
::
null
)
==
3
);
BOOST_TEST
(
db
[
"test"
].
find_min
<
int
>
(
"id"
)
==
1
);
BOOST_TEST
(
db
[
"test"
].
find_min
<
int
>
(
"id"
,
cif
::
key
(
"name"
)
==
cif
::
null
)
==
4
);
// count tests
BOOST_TEST
(
db
[
"test"
].
count
(
cif
::
all
())
==
5
);
BOOST_TEST
(
db
[
"test"
].
count
(
cif
::
key
(
"name"
)
!=
cif
::
null
)
==
3
);
BOOST_TEST
(
db
[
"test"
].
count
(
cif
::
key
(
"name"
)
==
cif
::
null
)
==
2
);
// find_first tests
BOOST_TEST
(
db
[
"test"
].
find_first
<
int
>
(
cif
::
key
(
"id"
)
==
1
,
"id"
)
==
1
);
BOOST_TEST
(
db
[
"test"
].
find_first
<
int
>
(
cif
::
all
(),
"id"
)
==
1
);
// find1 tests
BOOST_TEST
(
db
[
"test"
].
find1
<
int
>
(
cif
::
key
(
"id"
)
==
1
,
"id"
)
==
1
);
BOOST_CHECK_THROW
(
db
[
"test"
].
find1
<
int
>
(
cif
::
all
(),
"id"
),
cif
::
multiple_results_error
);
}
// --------------------------------------------------------------------
// rename test
...
...
tools/update-libcifpp-data.in
View file @
7a1d3dbd
...
...
@@ -6,7 +6,7 @@ set -e
euid
=
${
EUID
:-$(
id
-u
)}
if
[
"
${
euid
}
"
-ne
0
]
;
then
then
echo
"Please run as root"
echo
"Please run as root"
exit
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment