Commit 1bd675e1 by Maarten L. Hekkelman

Merge branch 'develop' into trunk

parents 49306a57 722c616a
......@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.15)
# set the project name
project(mkdssp VERSION 4.3.2 LANGUAGES CXX)
project(mkdssp VERSION 4.4.0 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......@@ -211,6 +211,10 @@ install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
)
set(CIFPP_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/libcifpp")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/mmcif_pdbx/dssp-extension.dic"
DESTINATION ${CIFPP_DATA_DIR})
# manual
find_program(PANDOC pandoc)
......@@ -265,7 +269,9 @@ if(ENABLE_TESTING)
add_executable(unit-test-dssp ${PROJECT_SOURCE_DIR}/test/unit-test-dssp.cpp ${PROJECT_SOURCE_DIR}/src/dssp-io.cpp)
if(USE_RSRC)
mrc_target_resources(unit-test-dssp ${CIFPP_SHARE_DIR}/mmcif_pdbx.dic ${CIFPP_SHARE_DIR}/mmcif_ddl.dic)
mrc_target_resources(unit-test-dssp
${CIFPP_SHARE_DIR}/mmcif_pdbx.dic ${CIFPP_SHARE_DIR}/mmcif_ddl.dic
${CMAKE_CURRENT_SOURCE_DIR}/mmcif_pdbx/dssp-extension.dic)
endif()
target_include_directories(unit-test-dssp PRIVATE
......
Version 4.3.2
Version 4.4.0
- Packaging (split out the web server again)
- Added markdown doc file, all doc files are now created from mkdssp.1
using pandoc, if that is installed.
......
......@@ -172,6 +172,7 @@ class dssp
std::tuple<residue_info, int, bool> bridge_partner(int i) const;
int sheet() const;
int strand() const;
/// \brief return resinfo and the energy of the bond
std::tuple<residue_info, double> acceptor(int i) const;
......
......@@ -477,6 +477,9 @@ save_dssp_struct_ladder
;
;
_dssp_struct_ladder.id A
_dssp_struct_ladder.sheet_id A
_dssp_struct_ladder.range_id_1 A
_dssp_struct_ladder.range_id_2 B
_dssp_struct_ladder.type anti-parallel
_dssp_struct_ladder.beg_1_label_comp_id GLY
_dssp_struct_ladder.beg_1_label_asym_id A
......@@ -520,6 +523,39 @@ save__dssp_struct_ladder.id
_item_type.code code
save_
save__dssp_struct_ladder.sheet_id
_item.description
; This data item is a pointer to _struct_sheet.id in the
STRUCT_SHEET category.
;
_item.name '_dssp_struct_ladder.sheet_id'
_item.category_id dssp_struct_ladder
_item.mandatory_code yes
_item_type.code code
save_
save__dssp_struct_ladder.range_id_1
_item.description
; This data item is a pointer to _struct_sheet_range.id in
the STRUCT_SHEET_RANGE category.
;
_item.name '_dssp_struct_ladder.range_id_1'
_item.category_id dssp_struct_ladder
_item.mandatory_code yes
_item_type.code code
save_
save__dssp_struct_ladder.range_id_2
_item.description
; This data item is a pointer to _struct_sheet_range.id in
the STRUCT_SHEET_RANGE category.
;
_item.name '_dssp_struct_ladder.range_id_2'
_item.category_id dssp_struct_ladder
_item.mandatory_code yes
_item_type.code code
save_
save__dssp_struct_ladder.type
_item.description
; The type of the ladder, be it parallel or anti-parallel
......@@ -1466,9 +1502,10 @@ save_dssp_struct_summary
_dssp_struct_summary.helix_pp .
_dssp_struct_summary.bend S
_dssp_struct_summary.chirality +
_dssp_struct_summary.sheet .
_dssp_struct_summary.strand .
_dssp_struct_summary.ladder_1 .
_dssp_struct_summary.ladder_2 .
_dssp_struct_summary.sheet .
_dssp_struct_summary.accessibility 23.1
_dssp_struct_summary.TCO 0.940
_dssp_struct_summary.kappa 73.9
......@@ -1655,31 +1692,43 @@ save__dssp_struct_summary.chirality
'-'
save_
save__dssp_struct_summary.ladder_1
save__dssp_struct_summary.sheet
_item.description
; Label for the first beta bridge of which this residue is part.
; This data item is a pointer to _struct_sheet.id in
the STRUCT_SHEET category.
;
_item.name '_dssp_struct_summary.ladder_1'
_item.name '_dssp_struct_summary.sheet'
_item.category dssp_struct_summary
_item.mandatory_code no
_item_type.code code
save_
save__dssp_struct_summary.ladder_2
save__dssp_struct_summary.strand
_item.description
; Label for the second beta bridge of which this residue is part.
; This data item is a pointer to _struct_sheet_range.id in
the STRUCT_SHEET_RANGE category.
;
_item.name '_dssp_struct_summary.ladder_2'
_item.name '_dssp_struct_summary.strand'
_item.category dssp_struct_summary
_item.mandatory_code no
_item_type.code code
save_
save__dssp_struct_summary.sheet
save__dssp_struct_summary.ladder_1
_item.description
; Label for the sheet of which this residue is part.
; Label for the first beta bridge of which this residue is part.
;
_item.name '_dssp_struct_summary.sheet'
_item.name '_dssp_struct_summary.ladder_1'
_item.category dssp_struct_summary
_item.mandatory_code no
_item_type.code code
save_
save__dssp_struct_summary.ladder_2
_item.description
; Label for the second beta bridge of which this residue is part.
;
_item.name '_dssp_struct_summary.ladder_2'
_item.category dssp_struct_summary
_item.mandatory_code no
_item_type.code code
......
......@@ -27,7 +27,6 @@
// Calculate DSSP-like secondary structure information
#include "dssp.hpp"
#include "queue.hpp"
#include "dssp-io.hpp"
......@@ -43,8 +42,6 @@ using helix_type = dssp::helix_type;
using helix_position_type = dssp::helix_position_type;
using chain_break_type = dssp::chain_break_type;
using queue_type = blocking_queue<std::tuple<uint32_t,uint32_t>>;
// --------------------------------------------------------------------
const double
......@@ -421,6 +418,9 @@ struct dssp::residue
void SetSheet(uint32_t inSheet) { mSheet = inSheet; }
uint32_t GetSheet() const { return mSheet; }
void SetStrand(uint32_t inStrand) { mStrand = inStrand; }
uint32_t GetStrand() const { return mStrand; }
bool IsBend() const { return mBend; }
void SetBend(bool inBend) { mBend = inBend; }
......@@ -548,6 +548,7 @@ struct dssp::residue
HBond mHBondDonor[2] = {}, mHBondAcceptor[2] = {};
bridge_partner mBetaPartner[2] = {};
uint32_t mSheet = 0;
uint32_t mStrand = 0; // Added to ease the writing of mmCIF's struct_sheet and friends
helix_position_type mHelixFlags[4] = { helix_position_type::None, helix_position_type::None, helix_position_type::None, helix_position_type::None }; //
bool mBend = false;
chain_break_type mChainBreak = chain_break_type::None;
......@@ -1099,6 +1100,26 @@ void CalculateBetaSheets(std::vector<residue> &inResidues, statistics &stats, st
inResidues[i].SetSheet(bridge.sheet);
}
}
// Create 'strands'. A strand is a range of residues without a gap in between
// that belong to the same sheet.
int strand = 0;
for (uint32_t iSheet = 1; iSheet < sheet; ++iSheet)
{
int lastNr = -1;
for (auto &res : inResidues)
{
if (res.mSheet != iSheet)
continue;
if (lastNr + 1 < res.mNumber)
++strand;
res.mStrand = strand;
lastNr = res.mNumber;
}
}
}
// --------------------------------------------------------------------
......@@ -1487,7 +1508,10 @@ DSSP_impl::DSSP_impl(const cif::datablock &db, int model_nr, int min_poly_prolin
nextNext.mCAlpha,
cur.mCAlpha);
float skap = std::sqrt(1 - ckap * ckap);
cur.mKappa = std::atan2(skap, ckap) * static_cast<float>(180 / kPI);
auto kappa = std::atan2(skap, ckap) * static_cast<float>(180 / kPI);
if (not std::isnan(kappa))
cur.mKappa = kappa;
}
}
......@@ -2138,6 +2162,11 @@ int dssp::residue_info::sheet() const
return m_impl->GetSheet();
}
int dssp::residue_info::strand() const
{
return m_impl->GetStrand();
}
std::tuple<dssp::residue_info, double> dssp::residue_info::acceptor(int i) const
{
auto &a = m_impl->mHBondAcceptor[i];
......
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 NKI/AVL, Netherlands Cancer Institute
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <condition_variable>
#include <mutex>
#include <queue>
template <typename T, size_t N = 100>
class blocking_queue
{
public:
void push(T const &value)
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.size() >= N)
m_full_signal.wait(lock);
m_queue.push(value);
m_empty_signal.notify_one();
}
T pop()
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.empty())
m_empty_signal.wait(lock);
auto value = m_queue.front();
m_queue.pop();
m_full_signal.notify_one();
return value;
}
template<class Rep, class Period>
std::tuple<bool,T> pop(const std::chrono::duration<Rep, Period>& wait_for)
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.empty())
{
auto now = std::chrono::system_clock::now();
if (m_empty_signal.wait_until(lock, now + wait_for) == std::cv_status::timeout)
return { true , T{} };
}
auto value = m_queue.front();
m_queue.pop();
m_full_signal.notify_one();
return { false, value };
}
bool is_full() const
{
std::unique_lock<std::mutex> lock(m_guard);
return m_queue.size() >= N;
}
private:
std::queue<T> m_queue;
mutable std::mutex m_guard;
std::condition_variable m_empty_signal, m_full_signal;
};
template <typename T, size_t N = 10>
class non_blocking_queue
{
public:
bool push(T const &value)
{
bool result = false;
std::unique_lock<std::mutex> lock(m_guard);
if (m_queue.size() < N)
{
m_queue.push(value);
m_empty_signal.notify_one();
result = true;
}
return result;
}
T pop()
{
std::unique_lock<std::mutex> lock(m_guard);
while (m_queue.empty())
m_empty_signal.wait(lock);
auto value = m_queue.front();
m_queue.pop();
return value;
}
private:
std::queue<T> m_queue;
mutable std::mutex m_guard;
std::condition_variable m_empty_signal;
};
\ No newline at end of file
==== Secondary Structure Definition by the program DSSP, NKI version 4.0 ==== DATE=2021-08-25 .
==== Secondary Structure Definition by the program DSSP, NKI version 4.4.0 ==== DATE=2021-08-25 .
REFERENCE W. KABSCH AND C.SANDER, BIOPOLYMERS 22 (1983) 2577-2637 .
HEADER RETINOIC-ACID TRANSPORT 28-SEP-94 1CBS .
COMPND MOL_ID: 1; MOLECULE: CELLULAR RETINOIC ACID BINDING PROTEIN TYPE II; CHAIN: A; ENGINEERED: YES .
......
......@@ -32,6 +32,8 @@
#include "dssp.hpp"
#include "dssp-io.hpp"
#include <cif++/dictionary_parser.hpp>
namespace fs = std::filesystem;
// --------------------------------------------------------------------
......@@ -97,7 +99,7 @@ BOOST_AUTO_TEST_CASE(ut_dssp)
std::string line_t, line_r;
BOOST_CHECK(std::getline(test, line_t) and std::getline(reference, line_r));
const char *kHeaderLineStart = "==== Secondary Structure Definition by the program DSSP, NKI version 4.3 ====";
const char *kHeaderLineStart = "==== Secondary Structure Definition by the program DSSP, NKI version 4.4.0 ====";
BOOST_CHECK(line_t.compare(0, std::strlen(kHeaderLineStart), kHeaderLineStart) == 0);
// BOOST_CHECK(line_r.compare(0, std::strlen(kHeaderLineStart), kHeaderLineStart) == 0);
......@@ -225,4 +227,19 @@ BOOST_AUTO_TEST_CASE(dssp_2)
BOOST_CHECK_EQUAL(ri.seq_id(), seqID);
BOOST_CHECK_EQUAL((char)ri.type(), secstr.front());
}
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE(dssp_3)
{
cif::file f(gTestDir / "1cbs.cif.gz");
BOOST_ASSERT(f.is_valid());
dssp dssp(f.front(), 1, 3, true);
dssp.annotate(f.front(), true, true);
BOOST_TEST(f.is_valid());
}
\ No newline at end of file
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