Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dssp
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
dssp
Commits
122d7b02
Unverified
Commit
122d7b02
authored
Aug 15, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
towards v5 of libcifpp
parent
fa880e3d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
53 deletions
+49
-53
CMakeLists.txt
+1
-1
src/dssp.cpp
+0
-0
src/dssp.hpp
+3
-4
src/mkdssp.cpp
+27
-30
test/unit-test.cpp
+18
-18
No files found.
CMakeLists.txt
View file @
122d7b02
...
@@ -120,7 +120,7 @@ find_package(Threads)
...
@@ -120,7 +120,7 @@ find_package(Threads)
# Note: use -DBoost_USE_STATIC_LIBS=ON to use boost static libraries
# Note: use -DBoost_USE_STATIC_LIBS=ON to use boost static libraries
find_package
(
cifpp
4.0.1
REQUIRED
)
find_package
(
cifpp
5.0.0
REQUIRED
)
find_package
(
Boost COMPONENTS date_time program_options
)
find_package
(
Boost COMPONENTS date_time program_options
)
add_executable
(
mkdssp
add_executable
(
mkdssp
...
...
src/dssp.cpp
View file @
122d7b02
This diff is collapsed.
Click to expand it.
src/dssp.hpp
View file @
122d7b02
...
@@ -26,9 +26,8 @@
...
@@ -26,9 +26,8 @@
#pragma once
#pragma once
#include <cif++/Structure.hpp>
#include <cif++/structure/DSSP.hpp>
#include <cif++/Secondary.hpp>
void
writeDSSP
(
const
mmcif
::
Structure
&
structure
,
const
mmcif
::
DSSP
&
dssp
,
std
::
ostream
&
os
);
void
writeDSSP
(
const
cif
::
datablock
&
db
,
const
mmcif
::
DSSP
&
dssp
,
std
::
ostream
&
os
);
void
annotateDSSP
(
mmcif
::
Structure
&
structure
,
const
mmcif
::
DSSP
&
dssp
,
bool
writeOther
,
std
::
ostream
&
os
);
void
annotateDSSP
(
cif
::
datablock
&
db
,
const
mmcif
::
DSSP
&
dssp
,
bool
writeOther
,
std
::
ostream
&
os
);
src/mkdssp.cpp
View file @
122d7b02
...
@@ -33,23 +33,20 @@
...
@@ -33,23 +33,20 @@
#include <filesystem>
#include <filesystem>
#include <fstream>
#include <fstream>
#include <gxrio.hpp>
#include <boost/format.hpp>
#include <boost/format.hpp>
#include <boost/date_time/gregorian/formatters.hpp>
#include <boost/date_time/gregorian/formatters.hpp>
#include <cif++/Structure.hpp>
#include <cif++/structure/DSSP.hpp>
#include <cif++/Secondary.hpp>
#include <cif++/structure/Compound.hpp>
#include <cif++/CifUtils.hpp>
#include <cif++/Cif2PDB.hpp>
#include <boost/program_options.hpp>
#include <boost/program_options.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include "dssp.hpp"
#include "dssp.hpp"
#include "revision.hpp"
#include "revision.hpp"
namespace
fs
=
std
::
filesystem
;
namespace
fs
=
std
::
filesystem
;
namespace
io
=
boost
::
iostreams
;
namespace
po
=
boost
::
program_options
;
namespace
po
=
boost
::
program_options
;
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -148,9 +145,9 @@ int d_main(int argc, const char* argv[])
...
@@ -148,9 +145,9 @@ int d_main(int argc, const char* argv[])
// Load extra CCD definitions, if any
// Load extra CCD definitions, if any
if
(
vm
.
count
(
"compounds"
))
if
(
vm
.
count
(
"compounds"
))
cif
::
add
FileR
esource
(
"components.cif"
,
vm
[
"compounds"
].
as
<
std
::
string
>
());
cif
::
add
_file_r
esource
(
"components.cif"
,
vm
[
"compounds"
].
as
<
std
::
string
>
());
else
if
(
vm
.
count
(
"components"
))
else
if
(
vm
.
count
(
"components"
))
cif
::
add
FileR
esource
(
"components.cif"
,
vm
[
"components"
].
as
<
std
::
string
>
());
cif
::
add
_file_r
esource
(
"components.cif"
,
vm
[
"components"
].
as
<
std
::
string
>
());
if
(
vm
.
count
(
"extra-compounds"
))
if
(
vm
.
count
(
"extra-compounds"
))
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
vm
[
"extra-compounds"
].
as
<
std
::
string
>
());
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
vm
[
"extra-compounds"
].
as
<
std
::
string
>
());
...
@@ -158,7 +155,7 @@ int d_main(int argc, const char* argv[])
...
@@ -158,7 +155,7 @@ int d_main(int argc, const char* argv[])
// And perhaps a private mmcif_pdbx dictionary
// And perhaps a private mmcif_pdbx dictionary
if
(
vm
.
count
(
"mmcif-dictionary"
))
if
(
vm
.
count
(
"mmcif-dictionary"
))
cif
::
add
FileR
esource
(
"mmcif_pdbx_v50.dic"
,
vm
[
"mmcif-dictionary"
].
as
<
std
::
string
>
());
cif
::
add
_file_r
esource
(
"mmcif_pdbx_v50.dic"
,
vm
[
"mmcif-dictionary"
].
as
<
std
::
string
>
());
if
(
vm
.
count
(
"dict"
))
if
(
vm
.
count
(
"dict"
))
{
{
...
@@ -166,8 +163,17 @@ int d_main(int argc, const char* argv[])
...
@@ -166,8 +163,17 @@ int d_main(int argc, const char* argv[])
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
dict
);
mmcif
::
CompoundFactory
::
instance
().
pushDictionary
(
dict
);
}
}
mmcif
::
File
f
(
vm
[
"xyzin"
].
as
<
std
::
string
>
());
cif
::
file
f
(
vm
[
"xyzin"
].
as
<
std
::
string
>
());
mmcif
::
Structure
structure
(
f
,
1
,
mmcif
::
StructureOpenOptions
::
SkipHydrogen
);
f
.
load_dictionary
(
"mmcif_pdbx_v50"
);
if
(
not
f
.
is_valid
())
{
std
::
cerr
<<
"File not valid"
<<
std
::
endl
;
exit
(
1
);
}
// mmcif::Structure structure(f, 1, mmcif::StructureOpenOptions::SkipHydrogen);
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -185,9 +191,7 @@ int d_main(int argc, const char* argv[])
...
@@ -185,9 +191,7 @@ int d_main(int argc, const char* argv[])
{
{
fs
::
path
output
=
vm
[
"output"
].
as
<
std
::
string
>
();
fs
::
path
output
=
vm
[
"output"
].
as
<
std
::
string
>
();
if
(
output
.
extension
()
==
".gz"
)
if
(
output
.
extension
()
==
".gz"
or
output
.
extension
()
==
".xz"
)
output
=
output
.
stem
();
else
if
(
output
.
extension
()
==
".bz2"
)
output
=
output
.
stem
();
output
=
output
.
stem
();
if
(
output
.
extension
()
==
".dssp"
)
if
(
output
.
extension
()
==
".dssp"
)
...
@@ -197,37 +201,30 @@ int d_main(int argc, const char* argv[])
...
@@ -197,37 +201,30 @@ int d_main(int argc, const char* argv[])
}
}
mmcif
::
DSSP
dssp
(
structure
,
pp_stretch
,
fmt
==
"dssp"
);
mmcif
::
DSSP
dssp
(
f
.
front
(),
1
,
pp_stretch
,
fmt
==
"dssp"
);
if
(
vm
.
count
(
"output"
))
if
(
vm
.
count
(
"output"
))
{
{
fs
::
path
output
=
vm
[
"output"
].
as
<
std
::
string
>
();
fs
::
path
output
=
vm
[
"output"
].
as
<
std
::
string
>
();
std
::
ofstream
of
(
output
,
std
::
ios_base
::
out
|
std
::
ios_base
::
binary
);
gxrio
::
ofstream
out
(
output
);
if
(
not
o
f
.
is_open
())
if
(
not
o
ut
.
is_open
())
{
{
std
::
cerr
<<
"Could not open output file"
<<
std
::
endl
;
std
::
cerr
<<
"Could not open output file"
<<
std
::
endl
;
exit
(
1
);
exit
(
1
);
}
}
io
::
filtering_stream
<
io
::
output
>
out
;
if
(
output
.
extension
()
==
".gz"
)
out
.
push
(
io
::
gzip_compressor
());
out
.
push
(
of
);
if
(
fmt
==
"dssp"
)
if
(
fmt
==
"dssp"
)
writeDSSP
(
structure
,
dssp
,
out
);
writeDSSP
(
f
.
front
()
,
dssp
,
out
);
else
else
annotateDSSP
(
structure
,
dssp
,
writeOther
,
out
);
annotateDSSP
(
f
.
front
()
,
dssp
,
writeOther
,
out
);
}
}
else
else
{
{
if
(
fmt
==
"dssp"
)
if
(
fmt
==
"dssp"
)
writeDSSP
(
structure
,
dssp
,
std
::
cout
);
writeDSSP
(
f
.
front
()
,
dssp
,
std
::
cout
);
else
else
annotateDSSP
(
structure
,
dssp
,
writeOther
,
std
::
cout
);
annotateDSSP
(
f
.
front
()
,
dssp
,
writeOther
,
std
::
cout
);
}
}
return
0
;
return
0
;
...
@@ -242,7 +239,7 @@ int main(int argc, const char* argv[])
...
@@ -242,7 +239,7 @@ int main(int argc, const char* argv[])
try
try
{
{
#if defined(DATA_DIR)
#if defined(DATA_DIR)
cif
::
add
DataD
irectory
(
DATA_DIR
);
cif
::
add
_data_d
irectory
(
DATA_DIR
);
#endif
#endif
result
=
d_main
(
argc
,
argv
);
result
=
d_main
(
argc
,
argv
);
}
}
...
...
test/unit-test.cpp
View file @
122d7b02
...
@@ -30,10 +30,7 @@
...
@@ -30,10 +30,7 @@
#include <stdexcept>
#include <stdexcept>
#include <cif++/Structure.hpp>
#include <cif++/structure/DSSP.hpp>
#include <cif++/Secondary.hpp>
#include <cif++/CifUtils.hpp>
#include <cif++/Cif2PDB.hpp>
#include "dssp.hpp"
#include "dssp.hpp"
...
@@ -45,14 +42,16 @@ BOOST_AUTO_TEST_CASE(ut_dssp)
...
@@ -45,14 +42,16 @@ BOOST_AUTO_TEST_CASE(ut_dssp)
{
{
using
namespace
std
::
literals
;
using
namespace
std
::
literals
;
mmcif
::
File
f
(
"1cbs.cif.gz"
);
cif
::
file
f
(
"1cbs.cif.gz"
);
mmcif
::
Structure
structure
(
f
,
1
,
mmcif
::
StructureOpenOptions
::
SkipHydrogen
);
f
.
load_dictionary
(
"mmcif_pdbx_v50"
);
BOOST_CHECK
(
f
.
is_valid
());
// mmcif::Structure structure(f, 1, mmcif::StructureOpenOptions::SkipHydrogen);
mmcif
::
DSSP
dssp
(
structure
,
3
,
true
);
mmcif
::
DSSP
dssp
(
f
.
front
(),
1
,
3
,
true
);
std
::
stringstream
test
;
std
::
stringstream
test
;
writeDSSP
(
structure
,
dssp
,
test
);
writeDSSP
(
f
.
front
()
,
dssp
,
test
);
std
::
ifstream
reference
(
"1cbs.dssp"
);
std
::
ifstream
reference
(
"1cbs.dssp"
);
...
@@ -91,25 +90,26 @@ BOOST_AUTO_TEST_CASE(ut_mmcif_2)
...
@@ -91,25 +90,26 @@ BOOST_AUTO_TEST_CASE(ut_mmcif_2)
using
namespace
std
::
literals
;
using
namespace
std
::
literals
;
using
namespace
cif
::
literals
;
using
namespace
cif
::
literals
;
mmcif
::
File
f
(
"1cbs.cif.gz"
);
cif
::
file
f
(
"1cbs.cif.gz"
);
f
.
loadDictionary
(
"mmcif_pdbx_v50"
);
f
.
load_dictionary
(
"mmcif_pdbx_v50"
);
BOOST_CHECK
(
f
.
is_valid
());
mmcif
::
Structure
structure
(
f
,
1
,
mmcif
::
StructureOpenOptions
::
SkipHydrogen
);
//
mmcif::Structure structure(f, 1, mmcif::StructureOpenOptions::SkipHydrogen);
mmcif
::
DSSP
dssp
(
structure
,
3
,
true
);
mmcif
::
DSSP
dssp
(
f
.
front
(),
1
,
3
,
true
);
std
::
stringstream
test
;
std
::
stringstream
test
;
annotateDSSP
(
structure
,
dssp
,
true
,
test
);
annotateDSSP
(
f
.
front
()
,
dssp
,
true
,
test
);
mmcif
::
F
ile
rf
(
"1cbs-dssp.cif"
);
cif
::
f
ile
rf
(
"1cbs-dssp.cif"
);
mmcif
::
Structure
rs
(
rf
,
1
,
mmcif
::
StructureOpenOptions
::
SkipHydrogen
);
//
mmcif::Structure rs(rf, 1, mmcif::StructureOpenOptions::SkipHydrogen);
structure
.
datablock
()[
"software"
].
erase
(
"name"
_key
==
"dssp"
);
//
structure.datablock()["software"].erase("name"_key == "dssp");
rs
.
datablock
()[
"software"
].
erase
(
"name"
_key
==
"dssp"
);
//
rs.datablock()["software"].erase("name"_key == "dssp");
// generate some output on different files:
// generate some output on different files:
cif
::
VERBOSE
=
2
;
cif
::
VERBOSE
=
2
;
BOOST_CHECK
(
structure
.
datablock
()
==
rs
.
datablock
());
// BOOST_CHECK(f.front() == rf.front
());
}
}
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