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
20c95733
Unverified
Commit
20c95733
authored
Jan 25, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'trunk' of github.com:PDB-REDO/dssp into trunk
parents
b6ce7ae6
57494d98
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
53 deletions
+59
-53
.gitignore
+1
-0
CMakeLists.txt
+14
-7
include/dssp.hpp
+2
-2
src/dssp-io.cpp
+5
-8
src/dssp.cpp
+25
-24
test/unit-test-dssp.cpp
+12
-12
No files found.
.gitignore
View file @
20c95733
...
...
@@ -7,3 +7,4 @@ build
.gdb_history
**/*.dssp
src/revision.hpp
out/
CMakeLists.txt
View file @
20c95733
...
...
@@ -50,13 +50,20 @@ elseif(MSVC)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/W4"
)
endif
()
if
(
NOT
"$ENV{CCP4}"
STREQUAL
""
)
set
(
CCP4 $ENV{CCP4}
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CCP4
}
/Lib"
)
list
(
APPEND CMAKE_PREFIX_PATH
${
CCP4
}
)
if
(
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
)
set
(
CMAKE_INSTALL_PREFIX
${
CCP4
}
)
# Optionally build a version to be installed inside CCP4
option
(
BUILD_FOR_CCP4
"Build a version to be installed in CCP4"
OFF
)
if
(
BUILD_FOR_CCP4
)
if
(
"$ENV{CCP4}"
STREQUAL
""
OR NOT EXISTS $ENV{CCP4}
)
message
(
FATAL_ERROR
"A CCP4 built was requested but CCP4 was not sourced"
)
else
()
list
(
APPEND CMAKE_MODULE_PATH
"$ENV{CCP4}"
)
list
(
APPEND CMAKE_PREFIX_PATH
"$ENV{CCP4}"
)
set
(
CMAKE_INSTALL_PREFIX
"$ENV{CCP4}"
)
if
(
WIN32
)
set
(
BUILD_SHARED_LIBS ON
)
endif
()
endif
()
endif
()
...
...
include/dssp.hpp
View file @
20c95733
...
...
@@ -29,10 +29,10 @@
/// \file DSSP.hpp
/// Calculate DSSP-like secondary structure information.
#include <filesystem>
#include <cif++.hpp>
#include <filesystem>
class
dssp
{
public
:
...
...
src/dssp-io.cpp
View file @
20c95733
...
...
@@ -24,19 +24,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("config.hpp")
#include "config.hpp"
#endif
#include "dssp-io.hpp"
#include "revision.hpp"
#include <cif++/pdb/io.hpp>
#include <exception>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <cif++/pdb/io.hpp>
#include "dssp-io.hpp"
#include "revision.hpp"
// --------------------------------------------------------------------
...
...
@@ -315,7 +312,7 @@ void writeSheets(cif::datablock &db, const dssp &dssp)
continue
;
if
(
not
sheetMap
.
count
(
sheetID
))
sheetMap
[
sheetID
]
=
s
heetMap
.
size
(
);
sheetMap
[
sheetID
]
=
s
tatic_cast
<
int
>
(
sheetMap
.
size
()
);
strands
.
emplace_back
(
std
::
make_tuple
(
sheetMap
[
sheetID
],
res_list
{
res
}));
}
...
...
src/dssp.cpp
View file @
20c95733
...
...
@@ -26,12 +26,13 @@
// Calculate DSSP-like secondary structure information
#include "dssp.hpp"
#include <deque>
#include <iomanip>
#include <numeric>
#include <thread>
#include "dssp.hpp"
using
residue
=
dssp
::
residue
;
using
statistics
=
dssp
::
statistics
;
using
structure_type
=
dssp
::
structure_type
;
...
...
@@ -96,16 +97,16 @@ float dihedral_angle(const point &p1, const point &p2, const point &p3, const po
point
x
=
cross_product
(
z
,
v43
);
point
y
=
cross_product
(
z
,
x
);
double
u
=
dot_product
(
x
,
x
);
double
v
=
dot_product
(
y
,
y
);
float
u
=
dot_product
(
x
,
x
);
float
v
=
dot_product
(
y
,
y
);
double
result
=
360
;
float
result
=
360
;
if
(
u
>
0
and
v
>
0
)
{
u
=
dot_product
(
p
,
x
)
/
std
::
sqrt
(
u
);
v
=
dot_product
(
p
,
y
)
/
std
::
sqrt
(
v
);
if
(
u
!=
0
or
v
!=
0
)
result
=
std
::
atan2
(
v
,
u
)
*
180
/
kPI
;
result
=
std
::
atan2
(
v
,
u
)
*
180
.
f
/
static_cast
<
float
>
(
kPI
)
;
}
return
result
;
...
...
@@ -116,9 +117,9 @@ float cosinus_angle(const point &p1, const point &p2, const point &p3, const poi
point
v12
=
p1
-
p2
;
point
v34
=
p3
-
p4
;
double
result
=
0
;
float
result
=
0
;
double
x
=
dot_product
(
v12
,
v12
)
*
dot_product
(
v34
,
v34
);
float
x
=
dot_product
(
v12
,
v12
)
*
dot_product
(
v34
,
v34
);
if
(
x
>
0
)
result
=
dot_product
(
v12
,
v34
)
/
std
::
sqrt
(
x
);
...
...
@@ -450,8 +451,8 @@ struct dssp::residue
return
mSSBridgeNr
;
}
double
CalculateSurface
(
const
std
::
vector
<
residue
>
&
inResidues
);
double
CalculateSurface
(
const
point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
residue
*>
&
inNeighbours
);
float
CalculateSurface
(
const
std
::
vector
<
residue
>
&
inResidues
);
float
CalculateSurface
(
const
point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
residue
*>
&
inNeighbours
);
bool
AtomIntersectsBox
(
const
point
&
atom
,
float
inRadius
)
const
{
...
...
@@ -527,10 +528,10 @@ struct dssp::residue
float
mRadius
;
point
mCenter
;
std
::
vector
<
std
::
tuple
<
std
::
string
,
point
>>
mSideChain
;
double
mAccessibility
=
0
;
double
mChiralVolume
=
0
;
float
mAccessibility
=
0
;
float
mChiralVolume
=
0
;
double
mAlpha
=
360
,
mKappa
=
360
,
mPhi
=
360
,
mPsi
=
360
,
mTCO
=
0
,
mOmega
=
360
;
float
mAlpha
=
360
,
mKappa
=
360
,
mPhi
=
360
,
mPsi
=
360
,
mTCO
=
0
,
mOmega
=
360
;
residue_type
mType
;
uint8_t
mSSBridgeNr
=
0
;
...
...
@@ -629,7 +630,7 @@ MSurfaceDots::MSurfaceDots(int32_t N)
}
}
double
residue
::
CalculateSurface
(
const
point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
residue
*>
&
inNeighbours
)
float
residue
::
CalculateSurface
(
const
point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
residue
*>
&
inNeighbours
)
{
accumulator
accumulate
;
...
...
@@ -650,7 +651,7 @@ double residue::CalculateSurface(const point &inAtom, float inRadius, const std:
accumulate
.
sort
();
float
radius
=
inRadius
+
kRadiusWater
;
double
surface
=
0
;
float
surface
=
0
;
MSurfaceDots
&
surfaceDots
=
MSurfaceDots
::
Instance
();
...
...
@@ -663,20 +664,20 @@ double residue::CalculateSurface(const point &inAtom, float inRadius, const std:
free
=
accumulate
.
m_x
[
k
].
radius
<
distance_sq
(
xx
,
accumulate
.
m_x
[
k
].
location
);
if
(
free
)
surface
+=
s
urfaceDots
.
weight
(
);
surface
+=
s
tatic_cast
<
float
>
(
surfaceDots
.
weight
()
);
}
return
surface
*
radius
*
radius
;
}
double
residue
::
CalculateSurface
(
const
std
::
vector
<
residue
>
&
inResidues
)
float
residue
::
CalculateSurface
(
const
std
::
vector
<
residue
>
&
inResidues
)
{
std
::
vector
<
residue
*>
neighbours
;
for
(
auto
&
r
:
inResidues
)
{
point
center
=
r
.
mCenter
;
double
radius
=
r
.
mRadius
;
float
radius
=
r
.
mRadius
;
if
(
distance
(
mCenter
,
center
)
<
mRadius
+
radius
)
neighbours
.
push_back
(
const_cast
<
residue
*>
(
&
r
));
...
...
@@ -1215,8 +1216,8 @@ void CalculatePPHelices(std::vector<residue> &inResidues, statistics &stats, int
for
(
uint32_t
i
=
1
;
i
+
1
<
inResidues
.
size
();
++
i
)
{
phi
[
i
]
=
inResidues
[
i
].
mPhi
;
psi
[
i
]
=
inResidues
[
i
].
mPsi
;
phi
[
i
]
=
static_cast
<
float
>
(
inResidues
[
i
].
mPhi
)
;
psi
[
i
]
=
static_cast
<
float
>
(
inResidues
[
i
].
mPsi
)
;
}
for
(
uint32_t
i
=
1
;
i
+
3
<
inResidues
.
size
();
++
i
)
...
...
@@ -1435,13 +1436,13 @@ DSSP_impl::DSSP_impl(const cif::datablock &db, int model_nr, int min_poly_prolin
if
(
NoChainBreak
(
prevPrev
,
nextNext
)
and
prevPrev
.
mSeqID
+
4
==
nextNext
.
mSeqID
)
{
double
ckap
=
cosinus_angle
(
float
ckap
=
cosinus_angle
(
cur
.
mCAlpha
,
prevPrev
.
mCAlpha
,
nextNext
.
mCAlpha
,
cur
.
mCAlpha
);
double
skap
=
std
::
sqrt
(
1
-
ckap
*
ckap
);
cur
.
mKappa
=
std
::
atan2
(
skap
,
ckap
)
*
180
/
kPI
;
float
skap
=
std
::
sqrt
(
1
-
ckap
*
ckap
);
cur
.
mKappa
=
std
::
atan2
(
skap
,
ckap
)
*
static_cast
<
float
>
(
180
/
kPI
)
;
}
}
...
...
@@ -2086,7 +2087,7 @@ dssp::iterator &dssp::iterator::operator--()
// --------------------------------------------------------------------
dssp
::
dssp
(
const
cif
::
mm
::
structure
&
s
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
)
:
dssp
(
s
.
get_datablock
(),
s
.
get_model_nr
(
),
min_poly_proline_stretch_length
,
calculateSurfaceAccessibility
)
:
dssp
(
s
.
get_datablock
(),
s
tatic_cast
<
int
>
(
s
.
get_model_nr
()
),
min_poly_proline_stretch_length
,
calculateSurfaceAccessibility
)
{
}
...
...
test/unit-test-dssp.cpp
View file @
20c95733
...
...
@@ -166,16 +166,16 @@ BOOST_AUTO_TEST_CASE(dssp_1)
std
::
cout
<<
line
<<
std
::
endl
;
auto
f
=
cif
::
split
(
line
,
"
\t
"
);
auto
f
ld
=
cif
::
split
(
line
,
"
\t
"
);
BOOST_CHECK_EQUAL
(
f
.
size
(),
3
);
if
(
f
.
size
()
!=
3
)
BOOST_CHECK_EQUAL
(
f
ld
.
size
(),
3
);
if
(
f
ld
.
size
()
!=
3
)
continue
;
int
seqID
;
std
::
from_chars
(
f
[
0
].
begin
(),
f
[
0
].
end
(),
seqID
);
std
::
string
asymID
{
f
[
1
]
};
std
::
string
secstr
{
f
[
2
]
};
std
::
from_chars
(
f
ld
[
0
].
data
(),
fld
[
0
].
data
()
+
fld
[
0
].
length
(),
seqID
);
std
::
string
asymID
{
f
ld
[
1
]
};
std
::
string
secstr
{
f
ld
[
2
]
};
if
(
secstr
==
"_"
)
secstr
=
" "
;
...
...
@@ -200,16 +200,16 @@ BOOST_AUTO_TEST_CASE(dssp_2)
while
(
getline
(
t
,
line
))
{
auto
f
=
cif
::
split
(
line
,
"
\t
"
);
auto
f
ld
=
cif
::
split
(
line
,
"
\t
"
);
BOOST_CHECK_EQUAL
(
f
.
size
(),
3
);
if
(
f
.
size
()
!=
3
)
BOOST_CHECK_EQUAL
(
f
ld
.
size
(),
3
);
if
(
f
ld
.
size
()
!=
3
)
continue
;
int
seqID
;
std
::
from_chars
(
f
[
0
].
begin
(),
f
[
0
].
end
(),
seqID
);
std
::
string
asymID
{
f
[
1
]
};
std
::
string
secstr
{
f
[
2
]
};
std
::
from_chars
(
f
ld
[
0
].
data
(),
fld
[
0
].
data
()
+
fld
[
0
].
length
(),
seqID
);
std
::
string
asymID
{
f
ld
[
1
]
};
std
::
string
secstr
{
f
ld
[
2
]
};
if
(
secstr
==
"_"
)
secstr
=
" "
;
...
...
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