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
e802a8e1
Unverified
Commit
e802a8e1
authored
Jun 06, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multi-threaded
parent
9cc2e4b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
27 deletions
+49
-27
include/dssp.hpp
+2
-2
src/dssp.cpp
+44
-24
src/mkdssp.cpp
+3
-1
No files found.
include/dssp.hpp
View file @
e802a8e1
...
@@ -97,8 +97,8 @@ class dssp
...
@@ -97,8 +97,8 @@ class dssp
Gap
Gap
};
};
dssp
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
);
dssp
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
,
int
max_thread_count
);
dssp
(
const
cif
::
mm
::
structure
&
s
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
);
dssp
(
const
cif
::
mm
::
structure
&
s
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
,
int
max_thread_count
);
~
dssp
();
~
dssp
();
...
...
src/dssp.cpp
View file @
e802a8e1
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "dssp.hpp"
#include "dssp.hpp"
#include <atomic>
#include <deque>
#include <deque>
#include <iomanip>
#include <iomanip>
#include <numeric>
#include <numeric>
...
@@ -765,36 +766,48 @@ double CalculateHBondEnergy(residue &inDonor, residue &inAcceptor)
...
@@ -765,36 +766,48 @@ double CalculateHBondEnergy(residue &inDonor, residue &inAcceptor)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
CalculateHBondEnergies
(
std
::
vector
<
residue
>
&
inResidues
)
void
CalculateHBondEnergies
(
std
::
vector
<
residue
>
&
inResidues
,
int
max_thread_count
)
{
{
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
std
::
cerr
<<
"calculating hbond energies"
<<
std
::
endl
;
std
::
cerr
<<
"calculating hbond energies"
<<
std
::
endl
;
// Calculate the HBond energies
// Calculate the HBond energies
std
::
vector
<
std
::
thread
>
tg
;
std
::
atomic
<
size_t
>
next
(
0
);
std
::
unique_ptr
<
cif
::
progress_bar
>
progress
;
std
::
unique_ptr
<
cif
::
progress_bar
>
progress
;
if
(
cif
::
VERBOSE
==
0
)
if
(
cif
::
VERBOSE
==
0
or
cif
::
VERBOSE
==
1
)
progress
.
reset
(
new
cif
::
progress_bar
(
inResidues
.
size
()
*
(
inResidues
.
size
()
-
1
),
"calculate hbond energies"
));
progress
.
reset
(
new
cif
::
progress_bar
(
(
inResidues
.
size
()
*
(
inResidues
.
size
()
-
1
)
/
2
),
"calculate hbond energies"
));
for
(
uint32_t
i
=
0
;
i
+
1
<
inResidues
.
size
();
++
i
)
for
(
int
t
=
0
;
t
<
max_thread_count
;
++
t
)
{
{
auto
&
ri
=
inResidues
[
i
];
tg
.
emplace_back
([
&
next
,
&
inResidues
,
progress
=
progress
.
get
()]()
for
(
uint32_t
j
=
i
+
1
;
j
<
inResidues
.
size
();
++
j
)
{
{
auto
&
rj
=
inResidues
[
j
];
for
(
uint32_t
i
=
next
++
;
i
<
inResidues
.
size
();
i
=
next
++
)
if
(
distance_sq
(
ri
.
mCAlpha
,
rj
.
mCAlpha
)
<
kMinimalCADistance
*
kMinimalCADistance
)
{
{
CalculateHBondEnergy
(
ri
,
rj
);
auto
&
ri
=
inResidues
[
i
];
if
(
j
!=
i
+
1
)
CalculateHBondEnergy
(
rj
,
ri
);
}
if
(
progress
)
for
(
uint32_t
j
=
i
+
1
;
j
<
inResidues
.
size
();
++
j
)
progress
->
consumed
(
1
);
{
}
auto
&
rj
=
inResidues
[
j
];
if
(
distance_sq
(
ri
.
mCAlpha
,
rj
.
mCAlpha
)
<
kMinimalCADistance
*
kMinimalCADistance
)
{
CalculateHBondEnergy
(
ri
,
rj
);
if
(
j
!=
i
+
1
)
CalculateHBondEnergy
(
rj
,
ri
);
}
if
(
progress
)
progress
->
consumed
(
1
);
}
}
});
}
}
for
(
auto
&
t
:
tg
)
t
.
join
();
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -1365,7 +1378,8 @@ void CalculatePPHelices(std::vector<residue> &inResidues, statistics &stats, int
...
@@ -1365,7 +1378,8 @@ void CalculatePPHelices(std::vector<residue> &inResidues, statistics &stats, int
struct
DSSP_impl
struct
DSSP_impl
{
{
DSSP_impl
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch_length
);
DSSP_impl
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch_length
,
int
max_thread_count
);
auto
findRes
(
const
std
::
string
&
asymID
,
int
seqID
)
auto
findRes
(
const
std
::
string
&
asymID
,
int
seqID
)
{
{
...
@@ -1386,16 +1400,22 @@ struct DSSP_impl
...
@@ -1386,16 +1400,22 @@ struct DSSP_impl
std
::
vector
<
std
::
pair
<
residue
*
,
residue
*>>
mSSBonds
;
std
::
vector
<
std
::
pair
<
residue
*
,
residue
*>>
mSSBonds
;
int
m_min_poly_proline_stretch_length
;
int
m_min_poly_proline_stretch_length
;
statistics
mStats
=
{};
statistics
mStats
=
{};
int
m_max_thread_count
;
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
DSSP_impl
::
DSSP_impl
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch_length
)
DSSP_impl
::
DSSP_impl
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch_length
,
int
max_thread_count
)
:
mDB
(
db
)
:
mDB
(
db
)
,
m_min_poly_proline_stretch_length
(
min_poly_proline_stretch_length
)
,
m_min_poly_proline_stretch_length
(
min_poly_proline_stretch_length
)
,
m_max_thread_count
(
max_thread_count
)
{
{
using
namespace
cif
::
literals
;
using
namespace
cif
::
literals
;
if
(
m_max_thread_count
<=
0
)
m_max_thread_count
=
std
::
thread
::
hardware_concurrency
();
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
std
::
cerr
<<
"loading residues"
<<
std
::
endl
;
std
::
cerr
<<
"loading residues"
<<
std
::
endl
;
...
@@ -1557,7 +1577,7 @@ void DSSP_impl::calculateSecondaryStructure()
...
@@ -1557,7 +1577,7 @@ void DSSP_impl::calculateSecondaryStructure()
mSSBonds
.
emplace_back
(
&*
r1
,
&*
r2
);
mSSBonds
.
emplace_back
(
&*
r1
,
&*
r2
);
}
}
CalculateHBondEnergies
(
mResidues
);
CalculateHBondEnergies
(
mResidues
,
m_max_thread_count
);
CalculateBetaSheets
(
mResidues
,
mStats
);
CalculateBetaSheets
(
mResidues
,
mStats
);
CalculateAlphaHelices
(
mResidues
,
mStats
);
CalculateAlphaHelices
(
mResidues
,
mStats
);
CalculatePPHelices
(
mResidues
,
mStats
,
m_min_poly_proline_stretch_length
);
CalculatePPHelices
(
mResidues
,
mStats
,
m_min_poly_proline_stretch_length
);
...
@@ -2136,13 +2156,13 @@ dssp::iterator &dssp::iterator::operator--()
...
@@ -2136,13 +2156,13 @@ dssp::iterator &dssp::iterator::operator--()
// --------------------------------------------------------------------
// --------------------------------------------------------------------
dssp
::
dssp
(
const
cif
::
mm
::
structure
&
s
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
)
dssp
::
dssp
(
const
cif
::
mm
::
structure
&
s
,
int
min_poly_proline_stretch_length
,
bool
calculateSurfaceAccessibility
,
int
max_thread_count
)
:
dssp
(
s
.
get_datablock
(),
static_cast
<
int
>
(
s
.
get_model_nr
()),
min_poly_proline_stretch_length
,
calculateSurfaceAccessibility
)
:
dssp
(
s
.
get_datablock
(),
static_cast
<
int
>
(
s
.
get_model_nr
()),
min_poly_proline_stretch_length
,
calculateSurfaceAccessibility
,
max_thread_count
)
{
{
}
}
dssp
::
dssp
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch
,
bool
calculateSurfaceAccessibility
)
dssp
::
dssp
(
const
cif
::
datablock
&
db
,
int
model_nr
,
int
min_poly_proline_stretch
,
bool
calculateSurfaceAccessibility
,
int
max_thread_count
)
:
m_impl
(
new
DSSP_impl
(
db
,
model_nr
,
min_poly_proline_stretch
))
:
m_impl
(
new
DSSP_impl
(
db
,
model_nr
,
min_poly_proline_stretch
,
max_thread_count
))
{
{
if
(
calculateSurfaceAccessibility
)
if
(
calculateSurfaceAccessibility
)
{
{
...
...
src/mkdssp.cpp
View file @
e802a8e1
...
@@ -81,6 +81,8 @@ int d_main(int argc, const char *argv[])
...
@@ -81,6 +81,8 @@ int d_main(int argc, const char *argv[])
mcfp
::
make_option
(
"verbose,v"
,
"verbose output"
),
mcfp
::
make_option
(
"verbose,v"
,
"verbose output"
),
mcfp
::
make_option
(
"quiet"
,
"Reduce verbose output to a minimum"
),
mcfp
::
make_option
(
"quiet"
,
"Reduce verbose output to a minimum"
),
mcfp
::
make_option
<
unsigned
>
(
"max-threads"
,
0
,
"Maximum number of threads to use, if zero the nummber of CPU's is the max"
),
mcfp
::
make_hidden_option
<
int
>
(
"debug,d"
,
"Debug level (for even more verbose output)"
));
mcfp
::
make_hidden_option
<
int
>
(
"debug,d"
,
"Debug level (for even more verbose output)"
));
config
.
parse
(
argc
,
argv
);
config
.
parse
(
argc
,
argv
);
...
@@ -162,7 +164,7 @@ int d_main(int argc, const char *argv[])
...
@@ -162,7 +164,7 @@ int d_main(int argc, const char *argv[])
fmt
=
"cif"
;
fmt
=
"cif"
;
}
}
dssp
dssp
(
f
.
front
(),
1
,
pp_stretch
,
true
);
dssp
dssp
(
f
.
front
(),
1
,
pp_stretch
,
true
,
config
.
get
<
unsigned
>
(
"max-threads"
)
);
if
(
not
output
.
empty
())
if
(
not
output
.
empty
())
{
{
...
...
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