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
66f742d6
Unverified
Commit
66f742d6
authored
Dec 14, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code to facilitate DSSP
parent
7ba9f688
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
119 deletions
+135
-119
include/cif++/Secondary.hpp
+9
-0
src/Secondary.cpp
+126
-119
No files found.
include/cif++/Secondary.hpp
View file @
66f742d6
...
@@ -184,6 +184,15 @@ class DSSP
...
@@ -184,6 +184,15 @@ class DSSP
std
::
tuple
<
ResidueInfo
,
double
>
acceptor
(
int
i
)
const
;
std
::
tuple
<
ResidueInfo
,
double
>
acceptor
(
int
i
)
const
;
std
::
tuple
<
ResidueInfo
,
double
>
donor
(
int
i
)
const
;
std
::
tuple
<
ResidueInfo
,
double
>
donor
(
int
i
)
const
;
/// \brief Simple compare equals
bool
operator
==
(
const
ResidueInfo
&
rhs
)
const
{
return
mImpl
==
rhs
.
mImpl
;
}
/// \brief Returns \result true if there is a bond between two residues
friend
bool
TestBond
(
ResidueInfo
const
&
a
,
ResidueInfo
const
&
b
);
private
:
private
:
ResidueInfo
(
Res
*
res
)
:
mImpl
(
res
)
{}
ResidueInfo
(
Res
*
res
)
:
mImpl
(
res
)
{}
...
...
src/Secondary.cpp
View file @
66f742d6
...
@@ -26,14 +26,14 @@
...
@@ -26,14 +26,14 @@
// Calculate DSSP-like secondary structure information
// Calculate DSSP-like secondary structure information
#include <numeric>
#include <iomanip>
#include <iomanip>
#include <numeric>
#include <thread>
#include <thread>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include "cif++/Structure.hpp"
#include "cif++/Secondary.hpp"
#include "cif++/Secondary.hpp"
#include "cif++/Structure.hpp"
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
...
@@ -110,7 +110,7 @@ ResidueType MapResidue(std::string inName)
...
@@ -110,7 +110,7 @@ ResidueType MapResidue(std::string inName)
ResidueType
result
=
kUnknownResidue
;
ResidueType
result
=
kUnknownResidue
;
for
(
auto
&
ri
:
kResidueInfo
)
for
(
auto
&
ri
:
kResidueInfo
)
{
{
if
(
inName
==
ri
.
name
)
if
(
inName
==
ri
.
name
)
{
{
...
@@ -124,29 +124,31 @@ ResidueType MapResidue(std::string inName)
...
@@ -124,29 +124,31 @@ ResidueType MapResidue(std::string inName)
struct
HBond
struct
HBond
{
{
Res
*
residue
;
Res
*
residue
;
double
energy
;
double
energy
;
};
};
enum
BridgeType
enum
BridgeType
{
{
btNoBridge
,
btParallel
,
btAntiParallel
btNoBridge
,
btParallel
,
btAntiParallel
};
};
struct
Bridge
struct
Bridge
{
{
BridgeType
type
;
BridgeType
type
;
uint32_t
sheet
,
ladder
;
uint32_t
sheet
,
ladder
;
std
::
set
<
Bridge
*>
link
;
std
::
set
<
Bridge
*>
link
;
std
::
deque
<
uint32_t
>
i
,
j
;
std
::
deque
<
uint32_t
>
i
,
j
;
std
::
string
chainI
,
chainJ
;
std
::
string
chainI
,
chainJ
;
bool
operator
<
(
const
Bridge
&
b
)
const
{
return
chainI
<
b
.
chainI
or
(
chainI
==
b
.
chainI
and
i
.
front
()
<
b
.
i
.
front
());
}
bool
operator
<
(
const
Bridge
&
b
)
const
{
return
chainI
<
b
.
chainI
or
(
chainI
==
b
.
chainI
and
i
.
front
()
<
b
.
i
.
front
());
}
};
};
struct
BridgeParner
struct
BridgeParner
{
{
Res
*
residue
;
Res
*
residue
;
uint32_t
ladder
;
uint32_t
ladder
;
bool
parallel
;
bool
parallel
;
};
};
...
@@ -172,8 +174,9 @@ const float
...
@@ -172,8 +174,9 @@ const float
struct
Res
struct
Res
{
{
Res
(
const
Monomer
&
m
,
int
nr
,
ChainBreak
brk
)
Res
(
const
Monomer
&
m
,
int
nr
,
ChainBreak
brk
)
:
mM
(
m
),
mNumber
(
nr
)
:
mM
(
m
)
,
mNumber
(
nr
)
,
mType
(
MapResidue
(
m
.
compoundID
()))
,
mType
(
MapResidue
(
m
.
compoundID
()))
,
mChainBreak
(
brk
)
,
mChainBreak
(
brk
)
{
{
...
@@ -181,9 +184,9 @@ struct Res
...
@@ -181,9 +184,9 @@ struct Res
mBox
[
0
].
mX
=
mBox
[
0
].
mY
=
mBox
[
0
].
mZ
=
std
::
numeric_limits
<
float
>::
max
();
mBox
[
0
].
mX
=
mBox
[
0
].
mY
=
mBox
[
0
].
mZ
=
std
::
numeric_limits
<
float
>::
max
();
mBox
[
1
].
mX
=
mBox
[
1
].
mY
=
mBox
[
1
].
mZ
=
-
std
::
numeric_limits
<
float
>::
max
();
mBox
[
1
].
mX
=
mBox
[
1
].
mY
=
mBox
[
1
].
mZ
=
-
std
::
numeric_limits
<
float
>::
max
();
mH
=
mmcif
::
Point
{
std
::
numeric_limits
<
float
>::
max
(),
std
::
numeric_limits
<
float
>::
max
(),
std
::
numeric_limits
<
float
>::
max
()
};
mH
=
mmcif
::
Point
{
std
::
numeric_limits
<
float
>::
max
(),
std
::
numeric_limits
<
float
>::
max
(),
std
::
numeric_limits
<
float
>::
max
()
};
for
(
auto
&
a
:
mM
.
unique_atoms
())
for
(
auto
&
a
:
mM
.
unique_atoms
())
{
{
if
(
a
.
labelAtomID
()
==
"CA"
)
if
(
a
.
labelAtomID
()
==
"CA"
)
{
{
...
@@ -244,7 +247,7 @@ struct Res
...
@@ -244,7 +247,7 @@ struct Res
void
SetSecondaryStructure
(
SecondaryStructureType
inSS
)
{
mSecondaryStructure
=
inSS
;
}
void
SetSecondaryStructure
(
SecondaryStructureType
inSS
)
{
mSecondaryStructure
=
inSS
;
}
SecondaryStructureType
GetSecondaryStructure
()
const
{
return
mSecondaryStructure
;
}
SecondaryStructureType
GetSecondaryStructure
()
const
{
return
mSecondaryStructure
;
}
void
SetBetaPartner
(
uint32_t
n
,
Res
&
inResidue
,
uint32_t
inLadder
,
bool
inParallel
)
void
SetBetaPartner
(
uint32_t
n
,
Res
&
inResidue
,
uint32_t
inLadder
,
bool
inParallel
)
{
{
assert
(
n
==
0
or
n
==
1
);
assert
(
n
==
0
or
n
==
1
);
...
@@ -300,13 +303,12 @@ struct Res
...
@@ -300,13 +303,12 @@ struct Res
return
mSSBridgeNr
;
return
mSSBridgeNr
;
}
}
double
CalculateSurface
(
const
std
::
vector
<
Res
>
&
inResidues
);
double
CalculateSurface
(
const
std
::
vector
<
Res
>
&
inResidues
);
double
CalculateSurface
(
const
Point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
Res
*>&
inNeighbours
);
double
CalculateSurface
(
const
Point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
Res
*>
&
inNeighbours
);
bool
AtomIntersectsBox
(
const
Point
&
atom
,
float
inRadius
)
const
bool
AtomIntersectsBox
(
const
Point
&
atom
,
float
inRadius
)
const
{
{
return
return
atom
.
mX
+
inRadius
>=
mBox
[
0
].
mX
and
atom
.
mX
+
inRadius
>=
mBox
[
0
].
mX
and
atom
.
mX
-
inRadius
<=
mBox
[
1
].
mX
and
atom
.
mX
-
inRadius
<=
mBox
[
1
].
mX
and
atom
.
mY
+
inRadius
>=
mBox
[
0
].
mY
and
atom
.
mY
+
inRadius
>=
mBox
[
0
].
mY
and
atom
.
mY
-
inRadius
<=
mBox
[
1
].
mY
and
atom
.
mY
-
inRadius
<=
mBox
[
1
].
mY
and
...
@@ -314,7 +316,7 @@ struct Res
...
@@ -314,7 +316,7 @@ struct Res
atom
.
mZ
-
inRadius
<=
mBox
[
1
].
mZ
;
atom
.
mZ
-
inRadius
<=
mBox
[
1
].
mZ
;
}
}
void
ExtendBox
(
const
Point
&
atom
,
float
inRadius
)
void
ExtendBox
(
const
Point
&
atom
,
float
inRadius
)
{
{
if
(
mBox
[
0
].
mX
>
atom
.
mX
-
inRadius
)
if
(
mBox
[
0
].
mX
>
atom
.
mX
-
inRadius
)
mBox
[
0
].
mX
=
atom
.
mX
-
inRadius
;
mBox
[
0
].
mX
=
atom
.
mX
-
inRadius
;
...
@@ -330,10 +332,10 @@ struct Res
...
@@ -330,10 +332,10 @@ struct Res
mBox
[
1
].
mZ
=
atom
.
mZ
+
inRadius
;
mBox
[
1
].
mZ
=
atom
.
mZ
+
inRadius
;
}
}
Res
*
mNext
=
nullptr
;
Res
*
mNext
=
nullptr
;
Res
*
mPrev
=
nullptr
;
Res
*
mPrev
=
nullptr
;
const
Monomer
&
mM
;
const
Monomer
&
mM
;
std
::
string
mAltID
;
std
::
string
mAltID
;
int
mNumber
;
int
mNumber
;
...
@@ -351,7 +353,7 @@ struct Res
...
@@ -351,7 +353,7 @@ struct Res
HBond
mHBondDonor
[
2
]
=
{},
mHBondAcceptor
[
2
]
=
{};
HBond
mHBondDonor
[
2
]
=
{},
mHBondAcceptor
[
2
]
=
{};
BridgeParner
mBetaPartner
[
2
]
=
{};
BridgeParner
mBetaPartner
[
2
]
=
{};
uint32_t
mSheet
=
0
;
uint32_t
mSheet
=
0
;
Helix
mHelixFlags
[
4
]
=
{
Helix
::
None
,
Helix
::
None
,
Helix
::
None
,
Helix
::
None
};
//
Helix
mHelixFlags
[
4
]
=
{
Helix
::
None
,
Helix
::
None
,
Helix
::
None
,
Helix
::
None
};
//
bool
mBend
=
false
;
bool
mBend
=
false
;
ChainBreak
mChainBreak
=
ChainBreak
::
None
;
ChainBreak
mChainBreak
=
ChainBreak
::
None
;
};
};
...
@@ -361,18 +363,19 @@ struct Res
...
@@ -361,18 +363,19 @@ struct Res
class
Accumulator
class
Accumulator
{
{
public
:
public
:
struct
candidate
struct
candidate
{
{
Point
location
;
Point
location
;
double
radius
;
double
radius
;
double
distance
;
double
distance
;
bool
operator
<
(
const
candidate
&
rhs
)
const
bool
operator
<
(
const
candidate
&
rhs
)
const
{
return
distance
<
rhs
.
distance
;
}
{
return
distance
<
rhs
.
distance
;
}
};
};
void
operator
()(
const
Point
&
a
,
const
Point
&
b
,
double
d
,
double
r
)
void
operator
()(
const
Point
&
a
,
const
Point
&
b
,
double
d
,
double
r
)
{
{
double
distance
=
DistanceSquared
(
a
,
b
);
double
distance
=
DistanceSquared
(
a
,
b
);
...
@@ -384,7 +387,7 @@ class Accumulator
...
@@ -384,7 +387,7 @@ class Accumulator
if
(
distance
<
test
and
distance
>
0.0001
)
if
(
distance
<
test
and
distance
>
0.0001
)
{
{
candidate
c
=
{
b
-
a
,
r
*
r
,
distance
};
candidate
c
=
{
b
-
a
,
r
*
r
,
distance
};
m_x
.
push_back
(
c
);
m_x
.
push_back
(
c
);
push_heap
(
m_x
.
begin
(),
m_x
.
end
());
push_heap
(
m_x
.
begin
(),
m_x
.
end
());
...
@@ -403,11 +406,10 @@ class Accumulator
...
@@ -403,11 +406,10 @@ class Accumulator
class
MSurfaceDots
class
MSurfaceDots
{
{
public
:
public
:
static
MSurfaceDots
&
Instance
();
static
MSurfaceDots
&
Instance
();
size_t
size
()
const
{
return
mPoints
.
size
();
}
size_t
size
()
const
{
return
mPoints
.
size
();
}
const
Point
&
operator
[](
size_t
inIx
)
const
{
return
mPoints
[
inIx
];
}
const
Point
&
operator
[](
size_t
inIx
)
const
{
return
mPoints
[
inIx
];
}
double
weight
()
const
{
return
mWeight
;
}
double
weight
()
const
{
return
mWeight
;
}
private
:
private
:
...
@@ -417,7 +419,7 @@ class MSurfaceDots
...
@@ -417,7 +419,7 @@ class MSurfaceDots
double
mWeight
;
double
mWeight
;
};
};
MSurfaceDots
&
MSurfaceDots
::
Instance
()
MSurfaceDots
&
MSurfaceDots
::
Instance
()
{
{
const
int32_t
kN
=
200
;
const
int32_t
kN
=
200
;
...
@@ -442,11 +444,11 @@ MSurfaceDots::MSurfaceDots(int32_t N)
...
@@ -442,11 +444,11 @@ MSurfaceDots::MSurfaceDots(int32_t N)
}
}
}
}
double
Res
::
CalculateSurface
(
const
Point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
Res
*>&
inNeighbours
)
double
Res
::
CalculateSurface
(
const
Point
&
inAtom
,
float
inRadius
,
const
std
::
vector
<
Res
*>
&
inNeighbours
)
{
{
Accumulator
accumulate
;
Accumulator
accumulate
;
for
(
auto
r
:
inNeighbours
)
for
(
auto
r
:
inNeighbours
)
{
{
if
(
r
->
AtomIntersectsBox
(
inAtom
,
inRadius
))
if
(
r
->
AtomIntersectsBox
(
inAtom
,
inRadius
))
{
{
...
@@ -455,7 +457,7 @@ double Res::CalculateSurface(const Point& inAtom, float inRadius, const std::vec
...
@@ -455,7 +457,7 @@ double Res::CalculateSurface(const Point& inAtom, float inRadius, const std::vec
accumulate
(
inAtom
,
r
->
mC
,
inRadius
,
kRadiusC
);
accumulate
(
inAtom
,
r
->
mC
,
inRadius
,
kRadiusC
);
accumulate
(
inAtom
,
r
->
mO
,
inRadius
,
kRadiusO
);
accumulate
(
inAtom
,
r
->
mO
,
inRadius
,
kRadiusO
);
for
(
auto
&
atom
:
r
->
mSideChain
)
for
(
auto
&
atom
:
r
->
mSideChain
)
accumulate
(
inAtom
,
atom
,
inRadius
,
kRadiusSideAtom
);
accumulate
(
inAtom
,
atom
,
inRadius
,
kRadiusSideAtom
);
}
}
}
}
...
@@ -465,7 +467,7 @@ double Res::CalculateSurface(const Point& inAtom, float inRadius, const std::vec
...
@@ -465,7 +467,7 @@ double Res::CalculateSurface(const Point& inAtom, float inRadius, const std::vec
float
radius
=
inRadius
+
kRadiusWater
;
float
radius
=
inRadius
+
kRadiusWater
;
double
surface
=
0
;
double
surface
=
0
;
MSurfaceDots
&
surfaceDots
=
MSurfaceDots
::
Instance
();
MSurfaceDots
&
surfaceDots
=
MSurfaceDots
::
Instance
();
for
(
size_t
i
=
0
;
i
<
surfaceDots
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
surfaceDots
.
size
();
++
i
)
{
{
...
@@ -482,17 +484,17 @@ double Res::CalculateSurface(const Point& inAtom, float inRadius, const std::vec
...
@@ -482,17 +484,17 @@ double Res::CalculateSurface(const Point& inAtom, float inRadius, const std::vec
return
surface
*
radius
*
radius
;
return
surface
*
radius
*
radius
;
}
}
double
Res
::
CalculateSurface
(
const
std
::
vector
<
Res
>
&
inResidues
)
double
Res
::
CalculateSurface
(
const
std
::
vector
<
Res
>
&
inResidues
)
{
{
std
::
vector
<
Res
*>
neighbours
;
std
::
vector
<
Res
*>
neighbours
;
for
(
auto
&
r
:
inResidues
)
for
(
auto
&
r
:
inResidues
)
{
{
Point
center
=
r
.
mCenter
;
Point
center
=
r
.
mCenter
;
double
radius
=
r
.
mRadius
;
double
radius
=
r
.
mRadius
;
if
(
Distance
(
mCenter
,
center
)
<
mRadius
+
radius
)
if
(
Distance
(
mCenter
,
center
)
<
mRadius
+
radius
)
neighbours
.
push_back
(
const_cast
<
Res
*>
(
&
r
));
neighbours
.
push_back
(
const_cast
<
Res
*>
(
&
r
));
}
}
mAccessibility
=
CalculateSurface
(
mN
,
kRadiusN
,
neighbours
)
+
mAccessibility
=
CalculateSurface
(
mN
,
kRadiusN
,
neighbours
)
+
...
@@ -500,23 +502,23 @@ double Res::CalculateSurface(const std::vector<Res>& inResidues)
...
@@ -500,23 +502,23 @@ double Res::CalculateSurface(const std::vector<Res>& inResidues)
CalculateSurface
(
mC
,
kRadiusC
,
neighbours
)
+
CalculateSurface
(
mC
,
kRadiusC
,
neighbours
)
+
CalculateSurface
(
mO
,
kRadiusO
,
neighbours
);
CalculateSurface
(
mO
,
kRadiusO
,
neighbours
);
for
(
auto
&
atom
:
mSideChain
)
for
(
auto
&
atom
:
mSideChain
)
mAccessibility
+=
CalculateSurface
(
atom
,
kRadiusSideAtom
,
neighbours
);
mAccessibility
+=
CalculateSurface
(
atom
,
kRadiusSideAtom
,
neighbours
);
return
mAccessibility
;
return
mAccessibility
;
}
}
void
CalculateAccessibilities
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
)
void
CalculateAccessibilities
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
)
{
{
stats
.
accessibleSurface
=
0
;
stats
.
accessibleSurface
=
0
;
for
(
auto
&
residue
:
inResidues
)
for
(
auto
&
residue
:
inResidues
)
stats
.
accessibleSurface
+=
residue
.
CalculateSurface
(
inResidues
);
stats
.
accessibleSurface
+=
residue
.
CalculateSurface
(
inResidues
);
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// TODO: use the angle to improve bond energy calculation.
// TODO: use the angle to improve bond energy calculation.
double
CalculateHBondEnergy
(
Res
&
inDonor
,
Res
&
inAcceptor
)
double
CalculateHBondEnergy
(
Res
&
inDonor
,
Res
&
inAcceptor
)
{
{
double
result
=
0
;
double
result
=
0
;
...
@@ -568,19 +570,18 @@ double CalculateHBondEnergy(Res& inDonor, Res& inAcceptor)
...
@@ -568,19 +570,18 @@ double CalculateHBondEnergy(Res& inDonor, Res& inAcceptor)
return
result
;
return
result
;
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
CalculateHBondEnergies
(
std
::
vector
<
Res
>
&
inResidues
)
void
CalculateHBondEnergies
(
std
::
vector
<
Res
>
&
inResidues
)
{
{
// Calculate the HBond energies
// Calculate the HBond energies
for
(
uint32_t
i
=
0
;
i
+
1
<
inResidues
.
size
();
++
i
)
for
(
uint32_t
i
=
0
;
i
+
1
<
inResidues
.
size
();
++
i
)
{
{
auto
&
ri
=
inResidues
[
i
];
auto
&
ri
=
inResidues
[
i
];
for
(
uint32_t
j
=
i
+
1
;
j
<
inResidues
.
size
();
++
j
)
for
(
uint32_t
j
=
i
+
1
;
j
<
inResidues
.
size
();
++
j
)
{
{
auto
&
rj
=
inResidues
[
j
];
auto
&
rj
=
inResidues
[
j
];
if
(
Distance
(
ri
.
mCAlpha
,
rj
.
mCAlpha
)
<
kMinimalCADistance
)
if
(
Distance
(
ri
.
mCAlpha
,
rj
.
mCAlpha
)
<
kMinimalCADistance
)
{
{
...
@@ -594,7 +595,7 @@ void CalculateHBondEnergies(std::vector<Res>& inResidues)
...
@@ -594,7 +595,7 @@ void CalculateHBondEnergies(std::vector<Res>& inResidues)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
bool
NoChainBreak
(
const
Res
*
a
,
const
Res
*
b
)
bool
NoChainBreak
(
const
Res
*
a
,
const
Res
*
b
)
{
{
bool
result
=
a
->
mM
.
asymID
()
==
b
->
mM
.
asymID
();
bool
result
=
a
->
mM
.
asymID
()
==
b
->
mM
.
asymID
();
for
(
auto
r
=
a
;
result
and
r
!=
b
;
r
=
r
->
mNext
)
for
(
auto
r
=
a
;
result
and
r
!=
b
;
r
=
r
->
mNext
)
...
@@ -608,23 +609,27 @@ bool NoChainBreak(const Res* a, const Res* b)
...
@@ -608,23 +609,27 @@ bool NoChainBreak(const Res* a, const Res* b)
return
result
;
return
result
;
}
}
bool
NoChainBreak
(
const
Res
&
a
,
const
Res
&
b
)
bool
NoChainBreak
(
const
Res
&
a
,
const
Res
&
b
)
{
{
return
NoChainBreak
(
&
a
,
&
b
);
return
NoChainBreak
(
&
a
,
&
b
);
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
bool
TestBond
(
const
Res
*
a
,
const
Res
*
b
)
bool
TestBond
(
const
Res
*
a
,
const
Res
*
b
)
{
{
return
return
(
a
->
mHBondAcceptor
[
0
].
residue
==
b
and
a
->
mHBondAcceptor
[
0
].
energy
<
kMaxHBondEnergy
)
or
(
a
->
mHBondAcceptor
[
0
].
residue
==
b
and
a
->
mHBondAcceptor
[
0
].
energy
<
kMaxHBondEnergy
)
or
(
a
->
mHBondAcceptor
[
1
].
residue
==
b
and
a
->
mHBondAcceptor
[
1
].
energy
<
kMaxHBondEnergy
);
(
a
->
mHBondAcceptor
[
1
].
residue
==
b
and
a
->
mHBondAcceptor
[
1
].
energy
<
kMaxHBondEnergy
);
}
}
bool
TestBond
(
DSSP
::
ResidueInfo
const
&
a
,
DSSP
::
ResidueInfo
const
&
b
)
{
return
a
and
b
and
TestBond
(
a
.
mImpl
,
b
.
mImpl
);
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
BridgeType
TestBridge
(
const
Res
&
r1
,
const
Res
&
r2
)
BridgeType
TestBridge
(
const
Res
&
r1
,
const
Res
&
r2
)
{
// I. a d II. a d parallel
{
// I. a d II. a d parallel
auto
a
=
r1
.
mPrev
;
// \ /
auto
a
=
r1
.
mPrev
;
// \ /
auto
b
=
&
r1
;
// b e b e
auto
b
=
&
r1
;
// b e b e
...
@@ -650,10 +655,9 @@ BridgeType TestBridge(const Res& r1, const Res& r2)
...
@@ -650,10 +655,9 @@ BridgeType TestBridge(const Res& r1, const Res& r2)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// return true if any of the residues in bridge a is identical to any of the residues in bridge b
// return true if any of the residues in bridge a is identical to any of the residues in bridge b
bool
Linked
(
const
Bridge
&
a
,
const
Bridge
&
b
)
bool
Linked
(
const
Bridge
&
a
,
const
Bridge
&
b
)
{
{
return
return
find_first_of
(
a
.
i
.
begin
(),
a
.
i
.
end
(),
b
.
i
.
begin
(),
b
.
i
.
end
())
!=
a
.
i
.
end
()
or
find_first_of
(
a
.
i
.
begin
(),
a
.
i
.
end
(),
b
.
i
.
begin
(),
b
.
i
.
end
())
!=
a
.
i
.
end
()
or
find_first_of
(
a
.
i
.
begin
(),
a
.
i
.
end
(),
b
.
j
.
begin
(),
b
.
j
.
end
())
!=
a
.
i
.
end
()
or
find_first_of
(
a
.
i
.
begin
(),
a
.
i
.
end
(),
b
.
j
.
begin
(),
b
.
j
.
end
())
!=
a
.
i
.
end
()
or
find_first_of
(
a
.
j
.
begin
(),
a
.
j
.
end
(),
b
.
i
.
begin
(),
b
.
i
.
end
())
!=
a
.
j
.
end
()
or
find_first_of
(
a
.
j
.
begin
(),
a
.
j
.
end
(),
b
.
i
.
begin
(),
b
.
i
.
end
())
!=
a
.
j
.
end
()
or
find_first_of
(
a
.
j
.
begin
(),
a
.
j
.
end
(),
b
.
j
.
begin
(),
b
.
j
.
end
())
!=
a
.
j
.
end
();
find_first_of
(
a
.
j
.
begin
(),
a
.
j
.
end
(),
b
.
j
.
begin
(),
b
.
j
.
end
())
!=
a
.
j
.
end
();
...
@@ -661,26 +665,25 @@ bool Linked(const Bridge& a, const Bridge& b)
...
@@ -661,26 +665,25 @@ bool Linked(const Bridge& a, const Bridge& b)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
CalculateBetaSheets
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
)
void
CalculateBetaSheets
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
)
{
{
// Calculate Bridges
// Calculate Bridges
std
::
vector
<
Bridge
>
bridges
;
std
::
vector
<
Bridge
>
bridges
;
if
(
inResidues
.
size
()
>
4
)
{
for
(
uint32_t
i
=
1
;
i
+
4
<
inResidues
.
size
();
++
i
)
for
(
uint32_t
i
=
1
;
i
+
4
<
inResidues
.
size
();
++
i
)
{
{
auto
&
ri
=
inResidues
[
i
];
auto
&
ri
=
inResidues
[
i
];
for
(
uint32_t
j
=
i
+
3
;
j
+
1
<
inResidues
.
size
();
++
j
)
for
(
uint32_t
j
=
i
+
3
;
j
+
1
<
inResidues
.
size
();
++
j
)
{
{
auto
&
rj
=
inResidues
[
j
];
auto
&
rj
=
inResidues
[
j
];
BridgeType
type
=
TestBridge
(
ri
,
rj
);
BridgeType
type
=
TestBridge
(
ri
,
rj
);
if
(
type
==
btNoBridge
)
if
(
type
==
btNoBridge
)
continue
;
continue
;
bool
found
=
false
;
bool
found
=
false
;
for
(
Bridge
&
bridge
:
bridges
)
for
(
Bridge
&
bridge
:
bridges
)
{
{
if
(
type
!=
bridge
.
type
or
i
!=
bridge
.
i
.
back
()
+
1
)
if
(
type
!=
bridge
.
type
or
i
!=
bridge
.
i
.
back
()
+
1
)
continue
;
continue
;
...
@@ -716,7 +719,6 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -716,7 +719,6 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
}
}
}
}
}
}
}
// extend ladders
// extend ladders
std
::
sort
(
bridges
.
begin
(),
bridges
.
end
());
std
::
sort
(
bridges
.
begin
(),
bridges
.
end
());
...
@@ -763,8 +765,8 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -763,8 +765,8 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
}
}
// Sheet
// Sheet
std
::
set
<
Bridge
*>
ladderset
;
std
::
set
<
Bridge
*>
ladderset
;
for
(
Bridge
&
bridge
:
bridges
)
for
(
Bridge
&
bridge
:
bridges
)
{
{
ladderset
.
insert
(
&
bridge
);
ladderset
.
insert
(
&
bridge
);
...
@@ -781,7 +783,7 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -781,7 +783,7 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
uint32_t
sheet
=
1
,
ladder
=
0
;
uint32_t
sheet
=
1
,
ladder
=
0
;
while
(
not
ladderset
.
empty
())
while
(
not
ladderset
.
empty
())
{
{
std
::
set
<
Bridge
*>
sheetset
;
std
::
set
<
Bridge
*>
sheetset
;
sheetset
.
insert
(
*
ladderset
.
begin
());
sheetset
.
insert
(
*
ladderset
.
begin
());
ladderset
.
erase
(
ladderset
.
begin
());
ladderset
.
erase
(
ladderset
.
begin
());
...
@@ -789,9 +791,9 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -789,9 +791,9 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
while
(
not
done
)
while
(
not
done
)
{
{
done
=
true
;
done
=
true
;
for
(
Bridge
*
a
:
sheetset
)
for
(
Bridge
*
a
:
sheetset
)
{
{
for
(
Bridge
*
b
:
ladderset
)
for
(
Bridge
*
b
:
ladderset
)
{
{
if
(
Linked
(
*
a
,
*
b
))
if
(
Linked
(
*
a
,
*
b
))
{
{
...
@@ -806,7 +808,7 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -806,7 +808,7 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
}
}
}
}
for
(
Bridge
*
bridge
:
sheetset
)
for
(
Bridge
*
bridge
:
sheetset
)
{
{
bridge
->
ladder
=
ladder
;
bridge
->
ladder
=
ladder
;
bridge
->
sheet
=
sheet
;
bridge
->
sheet
=
sheet
;
...
@@ -826,7 +828,7 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -826,7 +828,7 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
++
sheet
;
++
sheet
;
}
}
for
(
Bridge
&
bridge
:
bridges
)
for
(
Bridge
&
bridge
:
bridges
)
{
{
// find out if any of the i and j set members already have
// find out if any of the i and j set members already have
// a bridge assigned, if so, we're assigning bridge 2
// a bridge assigned, if so, we're assigning bridge 2
...
@@ -898,10 +900,10 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
...
@@ -898,10 +900,10 @@ void CalculateBetaSheets(std::vector<Res>& inResidues, DSSP_Statistics& stats)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
CalculateAlphaHelices
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
,
bool
inPreferPiHelices
=
true
)
void
CalculateAlphaHelices
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
,
bool
inPreferPiHelices
=
true
)
{
{
// Helix and Turn
// Helix and Turn
for
(
HelixType
helixType
:
{
HelixType
::
rh_3_10
,
HelixType
::
rh_alpha
,
HelixType
::
rh_pi
})
for
(
HelixType
helixType
:
{
HelixType
::
rh_3_10
,
HelixType
::
rh_alpha
,
HelixType
::
rh_pi
})
{
{
uint32_t
stride
=
static_cast
<
uint32_t
>
(
helixType
)
+
3
;
uint32_t
stride
=
static_cast
<
uint32_t
>
(
helixType
)
+
3
;
...
@@ -924,7 +926,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
...
@@ -924,7 +926,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
}
}
}
}
for
(
auto
&
r
:
inResidues
)
for
(
auto
&
r
:
inResidues
)
{
{
double
kappa
=
r
.
mM
.
kappa
();
double
kappa
=
r
.
mM
.
kappa
();
r
.
SetBend
(
kappa
!=
360
and
kappa
>
70
);
r
.
SetBend
(
kappa
!=
360
and
kappa
>
70
);
...
@@ -975,7 +977,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
...
@@ -975,7 +977,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
if
(
inResidues
[
i
].
GetSecondaryStructure
()
==
ssLoop
)
if
(
inResidues
[
i
].
GetSecondaryStructure
()
==
ssLoop
)
{
{
bool
isTurn
=
false
;
bool
isTurn
=
false
;
for
(
HelixType
helixType
:
{
HelixType
::
rh_3_10
,
HelixType
::
rh_alpha
,
HelixType
::
rh_pi
})
for
(
HelixType
helixType
:
{
HelixType
::
rh_3_10
,
HelixType
::
rh_alpha
,
HelixType
::
rh_pi
})
{
{
uint32_t
stride
=
3
+
static_cast
<
uint32_t
>
(
helixType
);
uint32_t
stride
=
3
+
static_cast
<
uint32_t
>
(
helixType
);
for
(
uint32_t
k
=
1
;
k
<
stride
and
not
isTurn
;
++
k
)
for
(
uint32_t
k
=
1
;
k
<
stride
and
not
isTurn
;
++
k
)
...
@@ -991,7 +993,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
...
@@ -991,7 +993,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
std
::
string
asym
;
std
::
string
asym
;
size_t
helixLength
=
0
;
size_t
helixLength
=
0
;
for
(
auto
r
:
inResidues
)
for
(
auto
r
:
inResidues
)
{
{
if
(
r
.
mM
.
asymID
()
!=
asym
)
if
(
r
.
mM
.
asymID
()
!=
asym
)
{
{
...
@@ -1014,7 +1016,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
...
@@ -1014,7 +1016,7 @@ void CalculateAlphaHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats,
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
CalculatePPHelices
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
,
int
stretch_length
)
void
CalculatePPHelices
(
std
::
vector
<
Res
>
&
inResidues
,
DSSP_Statistics
&
stats
,
int
stretch_length
)
{
{
size_t
N
=
inResidues
.
size
();
size_t
N
=
inResidues
.
size
();
...
@@ -1150,18 +1152,19 @@ void CalculatePPHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats, in
...
@@ -1150,18 +1152,19 @@ void CalculatePPHelices(std::vector<Res>& inResidues, DSSP_Statistics& stats, in
struct
DSSPImpl
struct
DSSPImpl
{
{
DSSPImpl
(
const
Structure
&
s
,
int
min_poly_proline_stretch_length
);
DSSPImpl
(
const
Structure
&
s
,
int
min_poly_proline_stretch_length
);
const
Structure
&
mStructure
;
const
Structure
&
mStructure
;
const
std
::
list
<
Polymer
>
&
mPolymers
;
const
std
::
list
<
Polymer
>
&
mPolymers
;
std
::
vector
<
Res
>
mResidues
;
std
::
vector
<
Res
>
mResidues
;
std
::
vector
<
std
::
pair
<
Res
*
,
Res
*>>
mSSBonds
;
std
::
vector
<
std
::
pair
<
Res
*
,
Res
*>>
mSSBonds
;
int
m_min_poly_proline_stretch_length
;
int
m_min_poly_proline_stretch_length
;
auto
findRes
(
const
std
::
string
&
asymID
,
int
seqID
)
auto
findRes
(
const
std
::
string
&
asymID
,
int
seqID
)
{
{
return
std
::
find_if
(
mResidues
.
begin
(),
mResidues
.
end
(),
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
asymID
and
r
.
mM
.
seqID
()
==
seqID
;
});
return
std
::
find_if
(
mResidues
.
begin
(),
mResidues
.
end
(),
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
asymID
and
r
.
mM
.
seqID
()
==
seqID
;
});
}
}
void
calculateSurface
();
void
calculateSurface
();
...
@@ -1172,24 +1175,25 @@ struct DSSPImpl
...
@@ -1172,24 +1175,25 @@ struct DSSPImpl
// --------------------------------------------------------------------
// --------------------------------------------------------------------
DSSPImpl
::
DSSPImpl
(
const
Structure
&
s
,
int
min_poly_proline_stretch_length
)
DSSPImpl
::
DSSPImpl
(
const
Structure
&
s
,
int
min_poly_proline_stretch_length
)
:
mStructure
(
s
)
:
mStructure
(
s
)
,
mPolymers
(
mStructure
.
polymers
())
,
mPolymers
(
mStructure
.
polymers
())
,
m_min_poly_proline_stretch_length
(
min_poly_proline_stretch_length
)
,
m_min_poly_proline_stretch_length
(
min_poly_proline_stretch_length
)
{
{
size_t
nRes
=
accumulate
(
mPolymers
.
begin
(),
mPolymers
.
end
(),
size_t
nRes
=
accumulate
(
mPolymers
.
begin
(),
mPolymers
.
end
(),
0ULL
,
[](
size_t
s
,
auto
&
p
)
{
return
s
+
p
.
size
();
});
0ULL
,
[](
size_t
s
,
auto
&
p
)
{
return
s
+
p
.
size
();
});
mStats
.
nrOfChains
=
static_cast
<
uint32_t
>
(
mPolymers
.
size
());
mStats
.
nrOfChains
=
static_cast
<
uint32_t
>
(
mPolymers
.
size
());
mResidues
.
reserve
(
nRes
);
mResidues
.
reserve
(
nRes
);
int
resNumber
=
0
;
int
resNumber
=
0
;
for
(
auto
&
p
:
mPolymers
)
for
(
auto
&
p
:
mPolymers
)
{
{
ChainBreak
brk
=
ChainBreak
::
NewChain
;
ChainBreak
brk
=
ChainBreak
::
NewChain
;
for
(
auto
&
m
:
p
)
for
(
auto
&
m
:
p
)
{
{
if
(
not
m
.
isComplete
())
if
(
not
m
.
isComplete
())
continue
;
continue
;
...
@@ -1226,8 +1230,8 @@ DSSPImpl::DSSPImpl(const Structure& s, int min_poly_proline_stretch_length)
...
@@ -1226,8 +1230,8 @@ DSSPImpl::DSSPImpl(const Structure& s, int min_poly_proline_stretch_length)
void
DSSPImpl
::
calculateSecondaryStructure
()
void
DSSPImpl
::
calculateSecondaryStructure
()
{
{
auto
&
db
=
mStructure
.
getFile
().
data
();
auto
&
db
=
mStructure
.
getFile
().
data
();
for
(
auto
r
:
db
[
"struct_conn"
].
find
(
cif
::
Key
(
"conn_type_id"
)
==
"disulf"
))
for
(
auto
r
:
db
[
"struct_conn"
].
find
(
cif
::
Key
(
"conn_type_id"
)
==
"disulf"
))
{
{
std
::
string
asym1
,
asym2
;
std
::
string
asym1
,
asym2
;
int
seq1
,
seq2
;
int
seq1
,
seq2
;
...
@@ -1261,12 +1265,12 @@ void DSSPImpl::calculateSecondaryStructure()
...
@@ -1261,12 +1265,12 @@ void DSSPImpl::calculateSecondaryStructure()
if
(
cif
::
VERBOSE
>
1
)
if
(
cif
::
VERBOSE
>
1
)
{
{
for
(
auto
&
r
:
mResidues
)
for
(
auto
&
r
:
mResidues
)
{
{
auto
&
m
=
r
.
mM
;
auto
&
m
=
r
.
mM
;
char
helix
[
5
]
=
{
};
char
helix
[
5
]
=
{};
for
(
HelixType
helixType
:
{
HelixType
::
rh_3_10
,
HelixType
::
rh_alpha
,
HelixType
::
rh_pi
,
HelixType
::
rh_pp
})
for
(
HelixType
helixType
:
{
HelixType
::
rh_3_10
,
HelixType
::
rh_alpha
,
HelixType
::
rh_pi
,
HelixType
::
rh_pp
})
{
{
switch
(
r
.
GetHelixFlag
(
helixType
))
switch
(
r
.
GetHelixFlag
(
helixType
))
{
{
...
@@ -1292,7 +1296,7 @@ void DSSPImpl::calculateSecondaryStructure()
...
@@ -1292,7 +1296,7 @@ void DSSPImpl::calculateSecondaryStructure()
mStats
.
nrOfIntraChainSSBridges
=
0
;
mStats
.
nrOfIntraChainSSBridges
=
0
;
uint8_t
ssBondNr
=
0
;
uint8_t
ssBondNr
=
0
;
for
(
const
auto
&
[
a
,
b
]
:
mSSBonds
)
for
(
const
auto
&
[
a
,
b
]
:
mSSBonds
)
{
{
if
(
a
==
b
)
if
(
a
==
b
)
{
{
...
@@ -1308,7 +1312,7 @@ void DSSPImpl::calculateSecondaryStructure()
...
@@ -1308,7 +1312,7 @@ void DSSPImpl::calculateSecondaryStructure()
}
}
mStats
.
nrOfHBonds
=
0
;
mStats
.
nrOfHBonds
=
0
;
for
(
auto
&
r
:
mResidues
)
for
(
auto
&
r
:
mResidues
)
{
{
auto
donor
=
r
.
mHBondDonor
;
auto
donor
=
r
.
mHBondDonor
;
...
@@ -1332,7 +1336,7 @@ void DSSPImpl::calculateSurface()
...
@@ -1332,7 +1336,7 @@ void DSSPImpl::calculateSurface()
// --------------------------------------------------------------------
// --------------------------------------------------------------------
const
Monomer
&
DSSP
::
ResidueInfo
::
residue
()
const
const
Monomer
&
DSSP
::
ResidueInfo
::
residue
()
const
{
{
return
mImpl
->
mM
;
return
mImpl
->
mM
;
}
}
...
@@ -1377,7 +1381,7 @@ double DSSP::ResidueInfo::accessibility() const
...
@@ -1377,7 +1381,7 @@ double DSSP::ResidueInfo::accessibility() const
return
mImpl
->
mAccessibility
;
return
mImpl
->
mAccessibility
;
}
}
std
::
tuple
<
DSSP
::
ResidueInfo
,
int
,
bool
>
DSSP
::
ResidueInfo
::
bridgePartner
(
int
i
)
const
std
::
tuple
<
DSSP
::
ResidueInfo
,
int
,
bool
>
DSSP
::
ResidueInfo
::
bridgePartner
(
int
i
)
const
{
{
auto
bp
=
mImpl
->
GetBetaPartner
(
i
);
auto
bp
=
mImpl
->
GetBetaPartner
(
i
);
...
@@ -1391,37 +1395,37 @@ int DSSP::ResidueInfo::sheet() const
...
@@ -1391,37 +1395,37 @@ int DSSP::ResidueInfo::sheet() const
return
mImpl
->
GetSheet
();
return
mImpl
->
GetSheet
();
}
}
std
::
tuple
<
DSSP
::
ResidueInfo
,
double
>
DSSP
::
ResidueInfo
::
acceptor
(
int
i
)
const
std
::
tuple
<
DSSP
::
ResidueInfo
,
double
>
DSSP
::
ResidueInfo
::
acceptor
(
int
i
)
const
{
{
auto
&
a
=
mImpl
->
mHBondAcceptor
[
i
];
auto
&
a
=
mImpl
->
mHBondAcceptor
[
i
];
return
{
ResidueInfo
(
a
.
residue
),
a
.
energy
};
return
{
ResidueInfo
(
a
.
residue
),
a
.
energy
};
}
}
std
::
tuple
<
DSSP
::
ResidueInfo
,
double
>
DSSP
::
ResidueInfo
::
donor
(
int
i
)
const
std
::
tuple
<
DSSP
::
ResidueInfo
,
double
>
DSSP
::
ResidueInfo
::
donor
(
int
i
)
const
{
{
auto
&
d
=
mImpl
->
mHBondDonor
[
i
];
auto
&
d
=
mImpl
->
mHBondDonor
[
i
];
return
{
ResidueInfo
(
d
.
residue
),
d
.
energy
};
return
{
ResidueInfo
(
d
.
residue
),
d
.
energy
};
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
DSSP
::
iterator
::
iterator
(
Res
*
res
)
DSSP
::
iterator
::
iterator
(
Res
*
res
)
:
mCurrent
(
res
)
:
mCurrent
(
res
)
{
{
}
}
DSSP
::
iterator
::
iterator
(
const
iterator
&
i
)
DSSP
::
iterator
::
iterator
(
const
iterator
&
i
)
:
mCurrent
(
i
.
mCurrent
)
:
mCurrent
(
i
.
mCurrent
)
{
{
}
}
DSSP
::
iterator
&
DSSP
::
iterator
::
operator
=
(
const
iterator
&
i
)
DSSP
::
iterator
&
DSSP
::
iterator
::
operator
=
(
const
iterator
&
i
)
{
{
mCurrent
=
i
.
mCurrent
;
mCurrent
=
i
.
mCurrent
;
return
*
this
;
return
*
this
;
}
}
DSSP
::
iterator
&
DSSP
::
iterator
::
operator
++
()
DSSP
::
iterator
&
DSSP
::
iterator
::
operator
++
()
{
{
++
mCurrent
.
mImpl
;
++
mCurrent
.
mImpl
;
return
*
this
;
return
*
this
;
...
@@ -1429,7 +1433,7 @@ DSSP::iterator& DSSP::iterator::operator++()
...
@@ -1429,7 +1433,7 @@ DSSP::iterator& DSSP::iterator::operator++()
// --------------------------------------------------------------------
// --------------------------------------------------------------------
DSSP
::
DSSP
(
const
Structure
&
s
,
int
min_poly_proline_stretch
,
bool
calculateSurfaceAccessibility
)
DSSP
::
DSSP
(
const
Structure
&
s
,
int
min_poly_proline_stretch
,
bool
calculateSurfaceAccessibility
)
:
mImpl
(
new
DSSPImpl
(
s
,
min_poly_proline_stretch
))
:
mImpl
(
new
DSSPImpl
(
s
,
min_poly_proline_stretch
))
{
{
if
(
calculateSurfaceAccessibility
)
if
(
calculateSurfaceAccessibility
)
...
@@ -1455,7 +1459,7 @@ DSSP::iterator DSSP::begin() const
...
@@ -1455,7 +1459,7 @@ DSSP::iterator DSSP::begin() const
DSSP
::
iterator
DSSP
::
end
()
const
DSSP
::
iterator
DSSP
::
end
()
const
{
{
// careful now, MSVC is picky when it comes to dereferencing iterators that are at the end.
// careful now, MSVC is picky when it comes to dereferencing iterators that are at the end.
Res
*
res
=
nullptr
;
Res
*
res
=
nullptr
;
if
(
not
mImpl
->
mResidues
.
empty
())
if
(
not
mImpl
->
mResidues
.
empty
())
{
{
res
=
mImpl
->
mResidues
.
data
();
res
=
mImpl
->
mResidues
.
data
();
...
@@ -1465,11 +1469,12 @@ DSSP::iterator DSSP::end() const
...
@@ -1465,11 +1469,12 @@ DSSP::iterator DSSP::end() const
return
iterator
(
res
);
return
iterator
(
res
);
}
}
SecondaryStructureType
DSSP
::
operator
()(
const
std
::
string
&
inAsymID
,
int
inSeqID
)
const
SecondaryStructureType
DSSP
::
operator
()(
const
std
::
string
&
inAsymID
,
int
inSeqID
)
const
{
{
SecondaryStructureType
result
=
ssLoop
;
SecondaryStructureType
result
=
ssLoop
;
auto
i
=
find_if
(
mImpl
->
mResidues
.
begin
(),
mImpl
->
mResidues
.
end
(),
auto
i
=
find_if
(
mImpl
->
mResidues
.
begin
(),
mImpl
->
mResidues
.
end
(),
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
inAsymID
and
r
.
mM
.
seqID
()
==
inSeqID
;
});
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
inAsymID
and
r
.
mM
.
seqID
()
==
inSeqID
;
});
if
(
i
!=
mImpl
->
mResidues
.
end
())
if
(
i
!=
mImpl
->
mResidues
.
end
())
result
=
i
->
mSecondaryStructure
;
result
=
i
->
mSecondaryStructure
;
else
if
(
cif
::
VERBOSE
)
else
if
(
cif
::
VERBOSE
)
...
@@ -1477,16 +1482,17 @@ SecondaryStructureType DSSP::operator()(const std::string& inAsymID, int inSeqID
...
@@ -1477,16 +1482,17 @@ SecondaryStructureType DSSP::operator()(const std::string& inAsymID, int inSeqID
return
result
;
return
result
;
}
}
SecondaryStructureType
DSSP
::
operator
()(
const
Monomer
&
m
)
const
SecondaryStructureType
DSSP
::
operator
()(
const
Monomer
&
m
)
const
{
{
return
operator
()(
m
.
asymID
(),
m
.
seqID
());
return
operator
()(
m
.
asymID
(),
m
.
seqID
());
}
}
double
DSSP
::
accessibility
(
const
std
::
string
&
inAsymID
,
int
inSeqID
)
const
double
DSSP
::
accessibility
(
const
std
::
string
&
inAsymID
,
int
inSeqID
)
const
{
{
SecondaryStructureType
result
=
ssLoop
;
SecondaryStructureType
result
=
ssLoop
;
auto
i
=
find_if
(
mImpl
->
mResidues
.
begin
(),
mImpl
->
mResidues
.
end
(),
auto
i
=
find_if
(
mImpl
->
mResidues
.
begin
(),
mImpl
->
mResidues
.
end
(),
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
inAsymID
and
r
.
mM
.
seqID
()
==
inSeqID
;
});
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
inAsymID
and
r
.
mM
.
seqID
()
==
inSeqID
;
});
if
(
i
!=
mImpl
->
mResidues
.
end
())
if
(
i
!=
mImpl
->
mResidues
.
end
())
result
=
i
->
mSecondaryStructure
;
result
=
i
->
mSecondaryStructure
;
else
if
(
cif
::
VERBOSE
)
else
if
(
cif
::
VERBOSE
)
...
@@ -1494,20 +1500,21 @@ double DSSP::accessibility(const std::string& inAsymID, int inSeqID) const
...
@@ -1494,20 +1500,21 @@ double DSSP::accessibility(const std::string& inAsymID, int inSeqID) const
return
result
;
return
result
;
}
}
double
DSSP
::
accessibility
(
const
Monomer
&
m
)
const
double
DSSP
::
accessibility
(
const
Monomer
&
m
)
const
{
{
return
accessibility
(
m
.
asymID
(),
m
.
seqID
());
return
accessibility
(
m
.
asymID
(),
m
.
seqID
());
}
}
bool
DSSP
::
isAlphaHelixEndBeforeStart
(
const
Monomer
&
m
)
const
bool
DSSP
::
isAlphaHelixEndBeforeStart
(
const
Monomer
&
m
)
const
{
{
return
isAlphaHelixEndBeforeStart
(
m
.
asymID
(),
m
.
seqID
());
return
isAlphaHelixEndBeforeStart
(
m
.
asymID
(),
m
.
seqID
());
}
}
bool
DSSP
::
isAlphaHelixEndBeforeStart
(
const
std
::
string
&
inAsymID
,
int
inSeqID
)
const
bool
DSSP
::
isAlphaHelixEndBeforeStart
(
const
std
::
string
&
inAsymID
,
int
inSeqID
)
const
{
{
auto
i
=
find_if
(
mImpl
->
mResidues
.
begin
(),
mImpl
->
mResidues
.
end
(),
auto
i
=
find_if
(
mImpl
->
mResidues
.
begin
(),
mImpl
->
mResidues
.
end
(),
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
inAsymID
and
r
.
mM
.
seqID
()
==
inSeqID
;
});
[
&
](
auto
&
r
)
{
return
r
.
mM
.
asymID
()
==
inAsymID
and
r
.
mM
.
seqID
()
==
inSeqID
;
});
bool
result
=
false
;
bool
result
=
false
;
...
@@ -1524,4 +1531,4 @@ DSSP_Statistics DSSP::GetStatistics() const
...
@@ -1524,4 +1531,4 @@ DSSP_Statistics DSSP::GetStatistics() const
return
mImpl
->
mStats
;
return
mImpl
->
mStats
;
}
}
}
}
// namespace mmcif
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