Commit 43eda65d by Maarten L. Hekkelman

WIP on trunk: 7c5bf010 calculate surface only when needed, added deuterium

parents 7c5bf010 3a943847
......@@ -14,6 +14,7 @@ enum AtomType : uint8_t
Nn = 0, // Unknown
H = 1, // Hydro­gen
D = 129, // Deuterium
He = 2, // He­lium
Li = 3, // Lith­ium
......
......@@ -91,7 +91,7 @@ enum class ChainBreak
class DSSP
{
public:
DSSP(const Structure& s, int min_poly_proline_stretch_length);
DSSP(const Structure& s, int min_poly_proline_stretch_length, bool calculateSurfaceAccessibility);
~DSSP();
DSSP(const DSSP&) = delete;
......
......@@ -17,6 +17,7 @@ const AtomTypeInfo kKnownAtoms[] =
{
{ Nn, "Unknown", "Nn", 0, false, { kNA, kNA, kNA, kNA, kNA, kNA, kNA } }, // 0 Nn Unknown
{ H, "Hydrogen", "H", 1.008, false, { 53, 25, 37, 32, kNA, kNA, 120 } }, // 1 H Hydro­gen
{ D, "Deuterium", "D", 2.014, false, { 53, 25, 37, 32, kNA, kNA, 120 } }, // 1 D Deuterium
{ He, "Helium", "He", 4.0026, false, { 31, kNA, 32, 46, kNA, kNA, 140 } }, // 2 He He­lium
{ Li, "Lithium", "Li", 6.94, true, { 167, 145, 134, 133, 124, kNA, 182 } }, // 3 Li Lith­ium
{ Be, "Beryllium", "Be", 9.0122, true, { 112, 105, 90, 102, 90, 85, kNA } }, // 4 Be Beryl­lium
......
......@@ -1150,6 +1150,9 @@ struct DSSPImpl
return std::find_if(mResidues.begin(), mResidues.end(), [&](auto& r) { return r.mM.asymID() == asymID and r.mM.seqID() == seqID; });
}
void calculateSurface();
void calculateSecondaryStructure();
DSSP_Statistics mStats = {};
};
......@@ -1208,12 +1211,11 @@ DSSPImpl::DSSPImpl(const Structure& s, int min_poly_proline_stretch_length)
mResidues[i + 1].assignHydrogen();
}
}
std::thread ta(std::bind(&CalculateAccessibilities, std::ref(mResidues), std::ref(mStats)));
try
{
auto& db = s.getFile().data();
void DSSPImpl::calculateSecondaryStructure()
{
auto& db = mStructure.getFile().data();
for (auto r: db["struct_conn"].find(cif::Key("conn_type_id") == "disulf"))
{
std::string asym1, asym2;
......@@ -1310,14 +1312,11 @@ DSSPImpl::DSSPImpl(const Structure& s, int min_poly_proline_stretch_length)
}
}
}
}
catch (const std::exception& ex)
{
ta.join();
throw;
}
}
ta.join();
void DSSPImpl::calculateSurface()
{
CalculateAccessibilities(mResidues, mStats);
}
// --------------------------------------------------------------------
......@@ -1424,9 +1423,17 @@ DSSP::iterator& DSSP::iterator::operator++()
// --------------------------------------------------------------------
DSSP::DSSP(const Structure& s, int min_poly_proline_stretch)
DSSP::DSSP(const Structure& s, int min_poly_proline_stretch, bool calculateSurfaceAccessibility)
: mImpl(new DSSPImpl(s, min_poly_proline_stretch))
{
if (calculateSurfaceAccessibility)
{
std::thread t(std::bind(&DSSPImpl::calculateSurface, mImpl));
mImpl->calculateSecondaryStructure();
t.join();
}
else
mImpl->calculateSecondaryStructure();
}
DSSP::~DSSP()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment